Skip to content

Commit de4c75c

Browse files
committed
generate iosys warning if solve_ivp does not succeed
1 parent 395dbbb commit de4c75c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

control/iosys.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,11 @@ def ivp_rhs(t, x):
18701870
ivp_rhs, (T0, Tf), X0, t_eval=T,
18711871
vectorized=False, **solve_ivp_kwargs)
18721872

1873+
if not soln.success or soln.status != 0:
1874+
# Something went wrong
1875+
warn("sp.integrate.solve_ivp failed")
1876+
print("Return bunch:", soln)
1877+
18731878
# Compute the output associated with the state (and use sys.out to
18741879
# figure out the number of outputs just in case it wasn't specified)
18751880
u = U[0] if len(U.shape) == 1 else U[:, 0]
@@ -1886,7 +1891,7 @@ def ivp_rhs(t, x):
18861891
"equally spaced.")
18871892

18881893
# Make sure the sample time matches the given time
1889-
if (sys.dt is not True):
1894+
if sys.dt is not True:
18901895
# Make sure that the time increment is a multiple of sampling time
18911896

18921897
# TODO: add back functionality for undersampling

0 commit comments

Comments
 (0)