def compute_entrance_SAC(self): k = SAC.k nump = SAC.nump nCV = 7 xb = SAC.xb xe = xb + self.Lr yb = self.Amax ye = 0. yap = self.Aap Xc = self.Xr ab = 0. ae = 0. ini_v = InitializeControlVertices(xb, yb, xe, ye, alphae=ae, alphab=ab, Cab_given=0., Cae_given=0., nCV=7, slope='down') curve = spline.Bspline(ini_v.vertices, k, nump) interval_data, small = interval_bounds(curve) FPD = FormParameterDict(curve) #FPD.add_AreaConstraint(kind='equality', value = curve_area) FPD.add_AngleConstraint(kind='equality', value=0., location=0.) FPD.add_AngleConstraint(kind='equality', value=0., location=1.) FPD.add_CurvatureConstraint(kind='equality', value=0., location=0.) FPD.add_CurvatureConstraint(kind='equality', value=0., location=1.) FPD.add_XcConstraint(kind='equality', value=3.5) FPD.add_E1(kind='LS', weight=1.) FPD.add_E2(kind='LS', weight=1.) FPD.add_E3(kind='LS', weight=1.) FPD.add_ArcLengthApprox(kind='LS', weight=1.) L = Lagrangian(FPD) interval_data, small = lagrangian_bounds(L, interval_data, small, 1.e4) Lspline = IntervalLagrangeSpline(curve, L, data=interval_data) Lspline.compute_lagrangian() Lspline.display(mytitle='SAC_fwd_ini', x_axis_name='x', y_axis_name='z') Lspline.optimize() Lspline.display(mytitle='SAC_fwd', x_axis_name='x', y_axis_name='z') return Lspline
def compute_midbody_SAC(self): k = SAC.k nump = SAC.nump n = 7 xb = SAC.xb xe = xb + self.Lm yb = self.Amax ye = self.Amax Xc = self.Xm ab = 0. ae = 0. vertices = linear_vertices([xb, yb], [xe, ye], num=n) curve = spline.Bspline(vertices, k, nump) interval_data, small = interval_bounds(curve) FPD = FormParameterDict(curve) #FPD.add_AreaConstraint(kind='equality', value = curve_area) FPD.add_AngleConstraint(kind='equality', value=0., location=0.) FPD.add_AngleConstraint(kind='equality', value=0., location=1.) FPD.add_CurvatureConstraint(kind='equality', value=0., location=0.) FPD.add_CurvatureConstraint(kind='equality', value=0., location=1.) #FPD.add_XcConstraint(kind = 'equality', value = 6.) FPD.add_E1(kind='LS', weight=1.) FPD.add_E2(kind='LS', weight=1.) FPD.add_E3(kind='LS', weight=1.) FPD.add_ArcLengthApprox(kind='LS', weight=1.) L = Lagrangian(FPD) interval_data, small = lagrangian_bounds(L, interval_data, small, 1.e4) Lspline = IntervalLagrangeSpline(curve, L, data=interval_data) Lspline.compute_lagrangian() Lspline.display(mytitle='SAC_mid_ini', x_axis_name='x', y_axis_name='z') Lspline.optimize() Lspline.display(mytitle='SAC_mid', x_axis_name='x', y_axis_name='z') return Lspline
location=0.6666666666, value=12.) FPD.add_E1(kind='LS', weight=.5) FPD.add_E2(kind='LS', weight=.5) FPD.add_E3(kind='LS', weight=.5) FPD.add_ArcLengthApprox(kind='LS', weight=.5) L = Lagrangian(FPD) interval_data, small = lagrangian_bounds(L, interval_data, small, 1.e4) Lspline = IntervalLagrangeSpline(curve, L, data=interval_data) Lspline.curve.compute_arclength() print 'initial Initial sac arc length = ', Lspline.curve.AL save_ini_al = copy.deepcopy(Lspline.curve.AL) Lspline.compute_lagrangian() save_ini_curve = copy.deepcopy(Lspline) keys = Lspline.Lagrangian.obj.keys() #Lspline.Lagrangian.obj ini_ans = {} for key in keys: print Lspline.Lagrangian.obj[ key].type, key, ' : ', Lspline.Lagrangian.obj[ key].computed_value ini_ans[Lspline.Lagrangian.obj[key]. type] = Lspline.Lagrangian.obj[key].computed_value Lspline.curve.pts_M_pts() Lspline.curve.compute_arclength() print 'initial arc length = ', Lspline.curve.AL Lspline.optimize()
# FPD.add_xVertexConstraint(kind='min', value=4.6, index=3) # #********************************************************************** FPD.add_E1(kind='LS', weight=1.) FPD.add_E2(kind='LS', weight=1.) FPD.add_E3(kind='LS', weight=1.) #FPD.add_ArcLength(kind='LS', weight = 1.) FPD.add_ArcLengthApprox(kind='LS', weight=1.) #********************************************************************** L = Lagrangian(FPD) interval_data, small = lagrangian_bounds(L, interval_data, small, 1.e4) Lspline = IntervalLagrangeSpline(curve, L, data=interval_data) vertices = [Lspline.curve.xpts, Lspline.curve.ypts] Lspline.compute_lagrangian(vertices, Lspline.Lagrangian) Lspline.display(mytitle='initial_basic_curve') Lspline.curve.verbose = True self = Lspline vertices = [self.curve.xpts, self.curve.ypts] vertices = Lspline.optimize(vertices, stop=100, Lagrangian=self.Lagrangian) #Lspline.display(mytitle = 'final basic curve') Lspline.curve.plotcurve_detailed() print Lspline.curve.vertices