BD.connect(vehicle, planet, inputs=np.arange(vehicle.dim_output)) planet.initial_condition = planet.ic_from_planetodetic( lamda_E=long_ic, phi_E=lat_ic, h=h_ic, V_N=V_N_ic, V_E=V_E_ic, V_D=V_D_ic, psi=psi_ic, theta=theta_ic, phi=phi_ic, p_B=p_b_ic, q_B=q_b_ic, r_B=r_b_ic, ) # planet.initial_condition[-3:] = omega_X_ic, omega_Y_ic, omega_Z_ic planet.initial_condition[-2] = 0. import time tstart = time.time() res = BD.simulate(30, integrator_options=int_opts) tend = time.time() tdelta = tend - tstart print("time to simulate: %f eval time to run time: %f" % (tdelta, res.t[-1] / tdelta)) glob_path = os.path.join(data_relative_path, 'Atmospheric_checkcases', 'Atmos_10_NorthwardCannonball', 'Atmos_10_sim_*.csv') plot_nesc_comparisons(res, glob_path, '10')
planet = simupy_flight.Planet( gravity=simupy_flight.earth_J2_gravity, winds=simupy_flight.get_constant_winds(), atmosphere=simupy_flight.atmosphere_1976, planetodetics=simupy_flight.Planetodetic( a=simupy_flight.earth_equitorial_radius, omega_p=simupy_flight.earth_rotation_rate, f=simupy_flight.earth_f ) ) vehicle = simupy_flight.Vehicle(base_aero_coeffs=simupy_flight.get_constant_aero(CD_b=0.1), m=m, I_xx=Ixx, I_yy=Iyy, I_zz=Izz, I_xy=Ixy, I_yz=Iyz, I_xz=Izx, x_com=x, y_com=y, z_com=z, x_mrc=x, y_mrc=y, z_mrc=z, S_A=S_A, a_l=a_l, b_l=b_l, c_l=c_l, d_l=0.,) BD = BlockDiagram(planet, vehicle) BD.connect(planet, vehicle, inputs=np.arange(planet.dim_output)) BD.connect(vehicle, planet, inputs=np.arange(vehicle.dim_output)) planet.initial_condition = planet.ic_from_planetodetic( lamda_E=long_ic, phi_E=lat_ic, h=h_ic, V_N=V_N_ic, V_E=V_E_ic, V_D=V_D_ic, psi=psi_ic, theta=theta_ic, phi=phi_ic, p_B=p_b_ic, q_B=q_b_ic, r_B=r_b_ic,) # planet.initial_condition[-3:] = omega_X_ic, omega_Y_ic, omega_Z_ic planet.initial_condition[-2] = 0. with benchmark() as b: res = BD.simulate(30, integrator_options=int_opts) b.tfinal = res.t[-1] plot_nesc_comparisons(res, '10')
) BD = BlockDiagram(planet, vehicle) BD.connect(planet, vehicle, inputs=np.arange(planet.dim_output)) BD.connect(vehicle, planet, inputs=np.arange(vehicle.dim_output)) lat_ic = 0. * np.pi / 180 long_ic = 0. * np.pi / 180 h_ic = 30_000 / ft_per_m V_N_ic = 0. V_E_ic = 0. V_D_ic = 0. psi_ic = 0. * np.pi / 180 theta_ic = 0. * np.pi / 180 phi_ic = 0. * np.pi / 180 omega_X_ic = 10. * np.pi / 180 omega_Y_ic = 20. * np.pi / 180 omega_Z_ic = 30. * np.pi / 180 planet.initial_condition = planet.ic_from_planetodetic(long_ic, lat_ic, h_ic, V_N_ic, V_E_ic, V_D_ic, psi_ic, theta_ic, phi_ic) planet.initial_condition[-3:] = omega_X_ic, omega_Y_ic, omega_Z_ic with benchmark() as b: res = BD.simulate(30, integrator_options=int_opts) b.tfinal = res.t[-1] plot_nesc_comparisons(res, '02')
from simupy import systems from scipy import interpolate from nesc_testcase_helper import plot_nesc_comparisons, plot_F16_controls, benchmark from nesc_testcase_helper import ft_per_m from nesc_case11 import int_opts, get_controller_function, BD, spec_ic_args, opt_ctrl, dim_feedback int_opts['max_step'] = 0.0 #2**-4 int_opts['name'] = 'dop853' altCmdBlock = systems.SystemFromCallable( interpolate.make_interp_spline( [0, 5], [spec_ic_args['h'] * ft_per_m, spec_ic_args['h'] * ft_per_m + 100.0], k=0), 0, 1) BD.systems[-3] = altCmdBlock BD.systems[2] = systems.SystemFromCallable( get_controller_function(*opt_ctrl, sasOn=True, apOn=True), dim_feedback + 4, 4) with benchmark() as b: res = BD.simulate(20, integrator_options=int_opts) b.tfinal = res.t[-1] plot_nesc_comparisons(res, '13p1') plot_F16_controls(res, '13p1')