You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The check magnitudes are all 0's for the states with input_initial=True
Example
importopenmdao.apiasomimportdymosasdmimportmatplotlib.pyplotaspltfromdymos.examples.oscillator.oscillator_odeimportOscillatorODE# Instantiate an OpenMDAO Problem instance.prob=om.Problem()
idv: om.IndepVarComp=prob.model.add_subsystem('idv', om.IndepVarComp())
idv.add_output('obj')
idv.add_objective('obj')
# Instantiate a Dymos Trajectory and add it to the Problem model.traj=dm.Trajectory()
prob.model.add_subsystem('traj', traj)
# Instantiate a Phase and add it to the Trajectory.# Here the transcription is necessary but not particularly relevant.phase=dm.Phase(ode_class=OscillatorODE, transcription=dm.Radau(num_segments=4))
traj.add_phase('phase0', phase)
phase.set_time_options(fix_initial=True, fix_duration=True)
# Tell Dymos the states to be propagated using the given ODE.phase.add_state('v', rate_source='v_dot', targets=['v'], units='m/s', input_initial=True)
phase.add_state('x', rate_source='v', targets=['x'], units='m')
# The spring constant, damping coefficient, and mass are inputs to the system# that are constant throughout the phase.phase.add_parameter('k', units='N/m', targets=['k'])
phase.add_parameter('c', units='N*s/m', targets=['c'])
phase.add_parameter('m', units='kg', targets=['m'])
# Setup the OpenMDAO problemprob.setup()
# Assign values to the times and statesprob.set_val('traj.phase0.t_initial', 0.0)
prob.set_val('traj.phase0.t_duration', 15.0)
prob.set_val('traj.phase0.states:x', 10.0)
prob.set_val('traj.phase0.states:v', 0.0)
prob.set_val('traj.phase0.parameters:k', 1.0)
prob.set_val('traj.phase0.parameters:c', 0.5)
prob.set_val('traj.phase0.parameters:m', 1.0)
# Perform a single execution of the model (executing the model is required before simulation).prob.driver=om.ScipyOptimizeDriver()
prob.run_driver()
prob.check_totals(show_only_incorrect=True)
Description
The check magnitudes are all 0's for the states with
input_initial=True
Example
Output:
Dymos Version
1.10.0
Relevant environment information
openmdao==3.33.0
The text was updated successfully, but these errors were encountered: