Skip to content

Commit

Permalink
Remove state rates, control rates, and t_phase from the timeseries by…
Browse files Browse the repository at this point in the history
… default, and remove type prefix. (#935)

* Remove state rates, control rates, and t_phase from the timeseries by default.

* No longer apply variable type prefix to timeseries output, by default.

* when requesting rate source values in timeseries but without prefixes, use the rate source name as the timeseries output

* more fixes for timeseries change

* more changes to accommodate removal of timeseries prefixes.

* more timeseries change accommodations

* more changes from the timeseries output renaming

* fixes for no_pyoptsparse tests

* continued progress on the timeseries name output change.

* Make dymos options temporary in tests to avoid sticky issues.

* fixed tandem phase documents that relied on timeseries prefixes

* BACKWARDS INCOMPATIBILITY: Changed dymos global use_timeseries_prefix option to a phase timeseries_option called use_prefix.
Previous global behavior was being "sticky" during tests and could potentially cause trouble when loading phases.  That functionality is next.

* Continuing to cleanup tests.

* adapt balanced field length doc test to the timeseries changes

* add duration timings to testflo since latest is running considerably longer

* apply timeseries name changing to the implciit t_duration tests

* updated implicit duration docs for new timeseries updates

* another timeseries prefix usage fixed in test
  • Loading branch information
robfalck authored Jun 29, 2023
1 parent 684a7a7 commit 32352cb
Show file tree
Hide file tree
Showing 128 changed files with 1,222 additions and 1,209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dymos_tests_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ jobs:
testflo -n 1 joss/test --pre_announce
testflo -b benchmark --pre_announce
cd $HOME
testflo dymos -n 2 --show_skipped --coverage --coverpkg dymos
testflo dymos -n 2 --show_skipped --coverage --durations 20 --coverpkg dymos
- name: Submit coverage
if: (github.event_name != 'workflow_dispatch')
Expand Down
14 changes: 7 additions & 7 deletions benchmark/benchmark_brachistochrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ def run_asserts(self, p):
t_initial = p.get_val('phase0.timeseries.time')[0]
tf = p.get_val('phase0.timeseries.time')[-1]

x0 = p.get_val('phase0.timeseries.states:x')[0]
xf = p.get_val('phase0.timeseries.states:x')[-1]
x0 = p.get_val('phase0.timeseries.x')[0]
xf = p.get_val('phase0.timeseries.x')[-1]

y0 = p.get_val('phase0.timeseries.states:y')[0]
yf = p.get_val('phase0.timeseries.states:y')[-1]
y0 = p.get_val('phase0.timeseries.y')[0]
yf = p.get_val('phase0.timeseries.y')[-1]

v0 = p.get_val('phase0.timeseries.states:v')[0]
vf = p.get_val('phase0.timeseries.states:v')[-1]
v0 = p.get_val('phase0.timeseries.v')[0]
vf = p.get_val('phase0.timeseries.v')[-1]

g = p.get_val('phase0.parameter_vals:g')[0]

thetaf = p.get_val('phase0.timeseries.controls:theta')[-1]
thetaf = p.get_val('phase0.timeseries.theta')[-1]

assert_near_equal(t_initial, 0.0)
assert_near_equal(x0, 0.0)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_racecar.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _run_racecar_problem(transcription, timeseries=False, make_plots=False):
dm.run_problem(p, run_driver=True, simulate=False, make_plots=make_plots)
print('Optimization finished')

t = p.get_val('traj.phase0.timeseries.states:t')
t = p.get_val('traj.phase0.timeseries.t')
assert_near_equal(t[-1], 22.2657, tolerance=0.01)


Expand Down
8 changes: 4 additions & 4 deletions docs/dymos_book/examples/balanced_field/balanced_field.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@
"\n",
"fig, axes = plt.subplots(2, 1, sharex=True, gridspec_kw={'top': 0.92}, figsize=(12,6))\n",
"for phase in ['br_to_v1', 'rto', 'v1_to_vr', 'rotate', 'climb']:\n",
" r = sim_case.get_val(f'traj.{phase}.timeseries.states:r', units='ft')\n",
" v = sim_case.get_val(f'traj.{phase}.timeseries.states:v', units='kn')\n",
" r = sim_case.get_val(f'traj.{phase}.timeseries.r', units='ft')\n",
" v = sim_case.get_val(f'traj.{phase}.timeseries.v', units='kn')\n",
" t = sim_case.get_val(f'traj.{phase}.timeseries.time', units='s')\n",
" axes[0].plot(t, r, '-', label=phase)\n",
" axes[1].plot(t, v, '-', label=phase)\n",
Expand All @@ -727,10 +727,10 @@
"axes[1].grid(True)\n",
"\n",
"tv1 = sim_case.get_val('traj.br_to_v1.timeseries.time', units='s')[-1, 0]\n",
"v1 = sim_case.get_val('traj.br_to_v1.timeseries.states:v', units='kn')[-1, 0]\n",
"v1 = sim_case.get_val('traj.br_to_v1.timeseries.v', units='kn')[-1, 0]\n",
"\n",
"tf_rto = sim_case.get_val('traj.rto.timeseries.time', units='s')[-1, 0]\n",
"rf_rto = sim_case.get_val('traj.rto.timeseries.states:r', units='ft')[-1, 0]\n",
"rf_rto = sim_case.get_val('traj.rto.timeseries.r', units='ft')[-1, 0]\n",
"\n",
"axes[0].annotate(f'field length = {r[-1, 0]:5.1f} ft', xy=(t[-1, 0], r[-1, 0]),\n",
" xycoords='data', xytext=(0.7, 0.5),\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@
"\n",
"fig, axes = plt.subplots(2, 1, sharex=True, gridspec_kw={'top': 0.92}, figsize=(12, 6))\n",
"for phase in ['br_to_v1', 'rto', 'v1_to_vr', 'rotate', 'climb']:\n",
" r = sim_case.get_val(f'traj.{phase}.timeseries.states:r', units='ft')\n",
" v = sim_case.get_val(f'traj.{phase}.timeseries.states:v', units='kn')\n",
" r = sim_case.get_val(f'traj.{phase}.timeseries.r', units='ft')\n",
" v = sim_case.get_val(f'traj.{phase}.timeseries.v', units='kn')\n",
" t = sim_case.get_val(f'traj.{phase}.timeseries.time', units='s')\n",
" axes[0].plot(t, r, '-', label=phase)\n",
" axes[1].plot(t, v, '-', label=phase)\n",
Expand All @@ -464,10 +464,10 @@
"axes[1].grid(True)\n",
"\n",
"tv1 = sim_case.get_val('traj.br_to_v1.timeseries.time', units='s')[-1, 0]\n",
"v1 = sim_case.get_val('traj.br_to_v1.timeseries.states:v', units='kn')[-1, 0]\n",
"v1 = sim_case.get_val('traj.br_to_v1.timeseries.v', units='kn')[-1, 0]\n",
"\n",
"tf_rto = sim_case.get_val('traj.rto.timeseries.time', units='s')[-1, 0]\n",
"rf_rto = sim_case.get_val('traj.rto.timeseries.states:r', units='ft')[-1, 0]\n",
"rf_rto = sim_case.get_val('traj.rto.timeseries.r', units='ft')[-1, 0]\n",
"\n",
"axes[0].annotate(f'field length = {r[-1, 0]:5.1f} ft', xy=(t[-1, 0], r[-1, 0]),\n",
" xycoords='data', xytext=(0.7, 0.5),\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@
"# Generate the explicitly simulated trajectory\n",
"exp_out = traj.simulate()\n",
"\n",
"plot_results([('traj.phase0.timeseries.states:x', 'traj.phase0.timeseries.states:y',\n",
"plot_results([('traj.phase0.timeseries.x', 'traj.phase0.timeseries.y',\n",
" 'x (m)', 'y (m)'),\n",
" ('traj.phase0.timeseries.time', 'traj.phase0.timeseries.controls:theta',\n",
" ('traj.phase0.timeseries.time', 'traj.phase0.timeseries.theta',\n",
" 'time (s)', 'theta (deg)')],\n",
" title='Brachistochrone Solution\\nHigh-Order Gauss-Lobatto Method',\n",
" p_sol=p, p_sim=exp_out)\n",
Expand Down Expand Up @@ -649,9 +649,9 @@
},
"outputs": [],
"source": [
"plot_results([('traj.phase0.timeseries.states:x', 'traj.phase0.timeseries.states:y',\n",
"plot_results([('traj.phase0.timeseries.x', 'traj.phase0.timeseries.y',\n",
" 'x (m)', 'y (m)'),\n",
" ('traj.phase0.timeseries.time', 'traj.phase0.timeseries.controls:theta',\n",
" ('traj.phase0.timeseries.time', 'traj.phase0.timeseries.theta',\n",
" 'time (s)', 'theta (deg)')],\n",
" title='Brachistochrone Solution\\nExplicit Shooting Method',\n",
" p_sol=p)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@
"#\n",
"p.model.connect('phase0.t_duration', 'phase1.t_duration')\n",
"\n",
"p.model.connect('phase0.timeseries2.controls:theta', 'phase1.controls:theta')\n",
"p.model.connect('phase0.timeseries2.states:v', 'phase1.controls:v')\n",
"p.model.connect('phase0.timeseries2.theta', 'phase1.controls:theta')\n",
"p.model.connect('phase0.timeseries2.v', 'phase1.controls:v')\n",
"\n",
"# Minimize time\n",
"phase1.add_objective('time', loc='final', ref=1)\n",
Expand Down Expand Up @@ -308,12 +308,12 @@
"\n",
"sol_case = om.CaseReader('dymos_solution.db').get_case('final')\n",
"\n",
"sol_x = sol_case.get_val('phase0.timeseries.states:x')\n",
"sol_y = sol_case.get_val('phase0.timeseries.states:y')\n",
"sol_v = sol_case.get_val('phase0.timeseries.states:v')\n",
"sol_x = sol_case.get_val('phase0.timeseries.x')\n",
"sol_y = sol_case.get_val('phase0.timeseries.y')\n",
"sol_v = sol_case.get_val('phase0.timeseries.v')\n",
"sol_t0 = sol_case.get_val('phase0.timeseries.time')\n",
"sol_t1 = sol_case.get_val('phase1.timeseries.time')\n",
"sol_s = sol_case.get_val('phase1.timeseries.states:S')\n",
"sol_s = sol_case.get_val('phase1.timeseries.S')\n",
"\n",
"def add_plot(p, x, y, label, i):\n",
" circle = p.circle(x.ravel(), y.ravel(), color=c[i], size=5)\n",
Expand Down Expand Up @@ -357,7 +357,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.11.0"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@
"# Plot the results\n",
"fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 4.5))\n",
"\n",
"axes[0].plot(p.get_val('traj.phase0.timeseries.states:x'),\n",
" p.get_val('traj.phase0.timeseries.states:y'),\n",
"axes[0].plot(p.get_val('traj.phase0.timeseries.x'),\n",
" p.get_val('traj.phase0.timeseries.y'),\n",
" 'ro', label='solution')\n",
"\n",
"axes[0].plot(sim_out.get_val('traj.phase0.timeseries.states:x'),\n",
" sim_out.get_val('traj.phase0.timeseries.states:y'),\n",
"axes[0].plot(sim_out.get_val('traj.phase0.timeseries.x'),\n",
" sim_out.get_val('traj.phase0.timeseries.y'),\n",
" 'b-', label='simulation')\n",
"\n",
"axes[0].set_xlabel('x (m)')\n",
Expand All @@ -199,11 +199,11 @@
"axes[0].grid()\n",
"\n",
"axes[1].plot(p.get_val('traj.phase0.timeseries.time'),\n",
" p.get_val('traj.phase0.timeseries.controls:theta', units='deg'),\n",
" p.get_val('traj.phase0.timeseries.theta', units='deg'),\n",
" 'ro', label='solution')\n",
"\n",
"axes[1].plot(sim_out.get_val('traj.phase0.timeseries.time'),\n",
" sim_out.get_val('traj.phase0.timeseries.controls:theta', units='deg'),\n",
" sim_out.get_val('traj.phase0.timeseries.theta', units='deg'),\n",
" 'b-', label='simulation')\n",
"\n",
"axes[1].set_xlabel('time (s)')\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"# Connect x0 to the state error component so we can constrain the given value of x0\n",
"# to be equal to the value chosen in the phase.\n",
"# p.model.connect('x0', 'state_error_comp.x0_target')\n",
"# p.model.connect('traj.phase0.timeseries.states:x', 'state_error_comp.x0_actual',\n",
"# p.model.connect('traj.phase0.timeseries.x', 'state_error_comp.x0_actual',\n",
"# src_indices=[0])\n",
"p.model.connect('t_initial', 'traj.phase0.t_initial')\n",
"p.model.connect('t_duration', 'traj.phase0.t_duration')\n",
Expand Down Expand Up @@ -188,21 +188,21 @@
"\n",
"# Plot the results\n",
"fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 4.5))\n",
"axes[0].plot(sol.get_val('traj.phase0.timeseries.states:x'),\n",
" sol.get_val('traj.phase0.timeseries.states:y'),\n",
"axes[0].plot(sol.get_val('traj.phase0.timeseries.x'),\n",
" sol.get_val('traj.phase0.timeseries.y'),\n",
" 'ro', label='solution')\n",
"axes[0].plot(sim.get_val('traj.phase0.timeseries.states:x'),\n",
" sim.get_val('traj.phase0.timeseries.states:y'),\n",
"axes[0].plot(sim.get_val('traj.phase0.timeseries.x'),\n",
" sim.get_val('traj.phase0.timeseries.y'),\n",
" 'b-', label='simulation')\n",
"axes[0].set_xlabel('x (m)')\n",
"axes[0].set_ylabel('y (m/s)')\n",
"axes[0].legend()\n",
"axes[0].grid()\n",
"axes[1].plot(sol.get_val('traj.phase0.timeseries.time'),\n",
" sol.get_val('traj.phase0.timeseries.controls:theta', units='deg'),\n",
" sol.get_val('traj.phase0.timeseries.theta', units='deg'),\n",
" 'ro', label='solution')\n",
"axes[1].plot(sim.get_val('traj.phase0.timeseries.time'),\n",
" sim.get_val('traj.phase0.timeseries.controls:theta', units='deg'),\n",
" sim.get_val('traj.phase0.timeseries.theta', units='deg'),\n",
" 'b-', label='simulation')\n",
"axes[1].set_xlabel('time (s)')\n",
"axes[1].set_ylabel(r'$\\theta$ (deg)')\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"# Connect x0 to the state error component so we can constrain the given value of x0\n",
"# to be equal to the value chosen in the phase.\n",
"p.model.connect('x0', 'state_error_comp.x0_target')\n",
"p.model.connect('traj.phase0.timeseries.states:x', 'state_error_comp.x0_actual', src_indices=[0])\n",
"p.model.connect('traj.phase0.timeseries.x', 'state_error_comp.x0_actual', src_indices=[0])\n",
"\n",
"#\n",
"# Define a Trajectory object\n",
Expand Down Expand Up @@ -203,12 +203,12 @@
"# Plot the results\n",
"fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 4.5))\n",
"\n",
"axes[0].plot(p.get_val('traj.phase0.timeseries.states:x'),\n",
" p.get_val('traj.phase0.timeseries.states:y'),\n",
"axes[0].plot(p.get_val('traj.phase0.timeseries.x'),\n",
" p.get_val('traj.phase0.timeseries.y'),\n",
" 'ro', label='solution')\n",
"\n",
"axes[0].plot(sim_out.get_val('traj.phase0.timeseries.states:x'),\n",
" sim_out.get_val('traj.phase0.timeseries.states:y'),\n",
"axes[0].plot(sim_out.get_val('traj.phase0.timeseries.x'),\n",
" sim_out.get_val('traj.phase0.timeseries.y'),\n",
" 'b-', label='simulation')\n",
"\n",
"axes[0].set_xlabel('x (m)')\n",
Expand All @@ -217,11 +217,11 @@
"axes[0].grid()\n",
"\n",
"axes[1].plot(p.get_val('traj.phase0.timeseries.time'),\n",
" p.get_val('traj.phase0.timeseries.controls:theta', units='deg'),\n",
" p.get_val('traj.phase0.timeseries.theta', units='deg'),\n",
" 'ro', label='solution')\n",
"\n",
"axes[1].plot(sim_out.get_val('traj.phase0.timeseries.time'),\n",
" sim_out.get_val('traj.phase0.timeseries.controls:theta', units='deg'),\n",
" sim_out.get_val('traj.phase0.timeseries.theta', units='deg'),\n",
" 'b-', label='simulation')\n",
"\n",
"axes[1].set_xlabel('time (s)')\n",
Expand Down
16 changes: 8 additions & 8 deletions docs/dymos_book/examples/bryson_denham/bryson_denham.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -450,17 +450,17 @@
"sim = om.CaseReader('dymos_simulation.db').get_case('final')\n",
"\n",
"t = sol.get_val('traj.phase0.timeseries.time')\n",
"x = sol.get_val('traj.phase0.timeseries.states:x')\n",
"v = sol.get_val('traj.phase0.timeseries.states:v')\n",
"J = sol.get_val('traj.phase0.timeseries.states:J')\n",
"u = sol.get_val('traj.phase0.timeseries.controls:u')\n",
"x = sol.get_val('traj.phase0.timeseries.x')\n",
"v = sol.get_val('traj.phase0.timeseries.v')\n",
"J = sol.get_val('traj.phase0.timeseries.J')\n",
"u = sol.get_val('traj.phase0.timeseries.u')\n",
"h = np.sin(3 * x) / 3\n",
"\n",
"t_sim = sim.get_val('traj.phase0.timeseries.time')\n",
"x_sim = sim.get_val('traj.phase0.timeseries.states:x')\n",
"v_sim = sim.get_val('traj.phase0.timeseries.states:v')\n",
"J_sim = sim.get_val('traj.phase0.timeseries.states:J')\n",
"u_sim = sim.get_val('traj.phase0.timeseries.controls:u')\n",
"x_sim = sim.get_val('traj.phase0.timeseries.x')\n",
"v_sim = sim.get_val('traj.phase0.timeseries.v')\n",
"J_sim = sim.get_val('traj.phase0.timeseries.J')\n",
"u_sim = sim.get_val('traj.phase0.timeseries.u')\n",
"h_sim = np.sin(3 * x_sim) / 3\n",
"\n",
"fig = plt.figure(constrained_layout=True, figsize=(12, 4))\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@
"print(f'optimal radius: {rad} m ')\n",
"mass = p.get_val('size_comp.mass', units='kg')[0]\n",
"print(f'cannonball mass: {mass} kg ')\n",
"angle = p.get_val('traj.phase.timeseries.states:gam', units='deg')[0, 0]\n",
"angle = p.get_val('traj.phase.timeseries.gam', units='deg')[0, 0]\n",
"print(f'launch angle: {angle} deg')\n",
"max_range = p.get_val('traj.phase.timeseries.states:r')[-1, 0]\n",
"max_range = p.get_val('traj.phase.timeseries.r')[-1, 0]\n",
"print(f'maximum range: {max_range} m')\n",
"\n",
"fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(10, 6))\n",
Expand All @@ -383,13 +383,13 @@
"\n",
"time_exp = exp_out.get_val('traj.phase.timeseries.time')\n",
"\n",
"r_imp = p.get_val('traj.phase.timeseries.states:r')\n",
"r_imp = p.get_val('traj.phase.timeseries.r')\n",
"\n",
"r_exp = exp_out.get_val('traj.phase.timeseries.states:r')\n",
"r_exp = exp_out.get_val('traj.phase.timeseries.r')\n",
"\n",
"h_imp = p.get_val('traj.phase.timeseries.states:h')\n",
"h_imp = p.get_val('traj.phase.timeseries.h')\n",
"\n",
"h_exp = exp_out.get_val('traj.phase.timeseries.states:h')\n",
"h_exp = exp_out.get_val('traj.phase.timeseries.h')\n",
"\n",
"axes.plot(r_imp, h_imp, 'bo')\n",
"\n",
Expand All @@ -401,9 +401,9 @@
"fig, axes = plt.subplots(nrows=4, ncols=1, figsize=(10, 6))\n",
"states = ['r', 'h', 'v', 'gam']\n",
"for i, state in enumerate(states):\n",
" x_imp = p.get_val(f'traj.phase.timeseries.states:{state}')\n",
" x_imp = p.get_val(f'traj.phase.timeseries.{state}')\n",
"\n",
" x_exp = exp_out.get_val(f'traj.phase.timeseries.states:{state}')\n",
" x_exp = exp_out.get_val(f'traj.phase.timeseries.{state}')\n",
"\n",
" axes[i].set_ylabel(state)\n",
"\n",
Expand All @@ -426,16 +426,9 @@
"source": [
"from openmdao.utils.assert_utils import assert_near_equal\n",
"\n",
"assert_near_equal(p.get_val('traj.phase.states:r')[-1],\n",
"assert_near_equal(p.get_val('traj.phase.timeseries.r')[-1],\n",
" 3183.25, tolerance=1.0E-2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down Expand Up @@ -463,7 +456,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
16 changes: 8 additions & 8 deletions docs/dymos_book/examples/cart_pole/cart_pole.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,17 @@
"sim = om.CaseReader('dymos_simulation.db').get_case('final')\n",
"\n",
"# plot time histories of x, x_dot, theta, theta_dot\n",
"plot_results([('traj.phase.timeseries.time', 'traj.phase.timeseries.states:x', 'time (s)', 'x (m)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.states:x_dot', 'time (s)', 'vx (m/s)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.states:theta', 'time (s)', 'theta (rad)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.states:theta_dot', 'time (s)', 'theta_dot (rad/s)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.controls:f', 'time (s)', 'control (N)')],\n",
"plot_results([('traj.phase.timeseries.time', 'traj.phase.timeseries.x', 'time (s)', 'x (m)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.x_dot', 'time (s)', 'vx (m/s)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.theta', 'time (s)', 'theta (rad)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.theta_dot', 'time (s)', 'theta_dot (rad/s)'),\n",
" ('traj.phase.timeseries.time', 'traj.phase.timeseries.f', 'time (s)', 'control (N)')],\n",
" title='Cart-Pole Problem', p_sol=sol, p_sim=sim)\n",
"\n",
"# uncomment the following lines to show the cart-pole animation\n",
"### x = sol.get_val('traj.phase.timeseries.states:x', units='m')\n",
"### theta = sol.get_val('traj.phase.timeseries.states:theta', units='rad')\n",
"### force = sol.get_val('traj.phase.timeseries.controls:f', units='N')\n",
"### x = sol.get_val('traj.phase.timeseries.x', units='m')\n",
"### theta = sol.get_val('traj.phase.timeseries.theta', units='rad')\n",
"### force = sol.get_val('traj.phase.timeseries.f', units='N')\n",
"### npts = len(x)\n",
"\n",
"### from dymos.examples.cart_pole.animate_cartpole import animate_cartpole\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@
"source": [
"from openmdao.utils.assert_utils import assert_near_equal\n",
"\n",
"assert_near_equal(p.get_val('traj.phase0.timeseries.states:range', units='NM')[-1],\n",
"assert_near_equal(p.get_val('traj.phase0.timeseries.range', units='NM')[-1],\n",
" 726.85, tolerance=1.0E-2)"
]
},
Expand Down
Loading

0 comments on commit 32352cb

Please sign in to comment.