Esempio n. 1
0
        ), dim_feedback, 4)

    BD = BlockDiagram(planet, F16_vehicle, gnc_block)
    BD.connect(planet, F16_vehicle, inputs=np.arange(planet.dim_output))
    BD.connect(F16_vehicle, planet, inputs=np.arange(F16_vehicle.dim_output))
    BD.connect(gnc_block,
               F16_vehicle,
               inputs=np.arange(planet.dim_output, planet.dim_output + 4))
    BD.connect(planet, gnc_block, outputs=planet_output_for_gnc_select)

    with benchmark() as b:
        res = BD.simulate(180, integrator_options=int_opts)
        b.tfinal = res.t[-1]

    plot_nesc_comparisons(res, '15')
    plot_F16_controls(res, '15', y_idx_offset=0)

    def xy_for_north_pole_ground_track(lat, long):
        xx = (90 - lat * 180 / np.pi) * np.cos(long)
        yy = (90 - lat * 180 / np.pi) * np.sin(long)
        return xx, yy

    plt.subplots(constrained_layout=True)
    plt.axis('equal')

    sim_lat = res.y[:, planet.phi_D_idx]
    sim_long = res.y[:, planet.lamda_D_idx]

    # refence_lats = np.array([90.0, 90-0.02, 90-0.04, 90-0.06])*np.pi/180
    refence_lats = (90 - np.arange(5) / 60) * np.pi / 180
    reference_longs = np.arange(0, 360, 30) * np.pi / 180
Esempio n. 2
0
    latOffset = latOffsetOutputEquation(t, x)
    if t < 20:
        return latOffset
    else:
        return latOffset - 2000


latOffsetBlock = systems.DynamicalSystem(
    state_equation_function=latOffsetStateEquation,
    output_equation_function=latOffsetOutputEquationShift,
    dim_state=1,
    dim_input=3,
    dim_output=1)

BD.systems[-2] = latOffsetBlock
BD.systems[2] = systems.SystemFromCallable(
    get_controller_function(*opt_ctrl, sasOn=True, apOn=True),
    dim_feedback + 4, 4)
BD.connect(baseChiCmdBlock, latOffsetBlock, inputs=[0])
BD.connect(planet,
           latOffsetBlock,
           outputs=[planet.V_N_idx, planet.V_E_idx],
           inputs=[1, 2])

with benchmark() as b:
    res = BD.simulate(60, integrator_options=int_opts)
    b.tfinal = res.t[-1]

plot_nesc_comparisons(res, '13p4')
plot_F16_controls(res, '13p4')