Skip to content

Commit 97e08c6

Browse files
committed
move warning to before conversion
1 parent fa58099 commit 97e08c6

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

control/timeresp.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
302302
"return_x specified for a transfer function system. Internal "
303303
"conversion to state space used; results may meaningless.")
304304

305+
# If we are passed a transfer function and X0 is non-zero, warn the user
306+
if isinstance(sys, TransferFunction) and np.any(X0 != 0):
307+
warnings.warn(
308+
"Non-zero initial condition given for transfer function system. "
309+
"Internal conversion to state space used; may not be consistent "
310+
"with given X0.")
311+
305312
sys = _convert_to_statespace(sys)
306313
A, B, C, D = np.asarray(sys.A), np.asarray(sys.B), np.asarray(sys.C), \
307314
np.asarray(sys.D)
@@ -358,12 +365,6 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
358365
X0 = _check_convert_array(X0, [(n_states,), (n_states, 1)],
359366
'Parameter ``X0``: ', squeeze=True)
360367

361-
# If we are passed a transfer function and X0 is non-zero, warn the user
362-
if isinstance(sys, TransferFunction) and np.any(X0 != 0):
363-
warnings.warn(
364-
"Non-zero initial condition given for transfer function system. "
365-
"Internal conversion to state space used; may not be consistent "
366-
"with given X0.")
367368

368369
xout = np.zeros((n_states, n_steps))
369370
xout[:, 0] = X0

doc/conventions.rst

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ The timebase argument can be given when a system is constructed:
8383
* dt = 0: continuous time system (default)
8484
* dt > 0: discrete time system with sampling period 'dt'
8585
* dt = True: discrete time with unspecified sampling period
86-
* dt = None: no timebase specified
86+
* dt = None: no timebase specified
8787

8888
Only the :class:`StateSpace`, :class:`TransferFunction`, and
8989
:class:`InputOutputSystem` classes allow explicit representation of
9090
discrete time systems.
9191

92-
Systems must have compatible timebases in order to be combined. A discrete time
93-
system with unspecified sampling time (`dt = True`) can be combined with a system
92+
Systems must have compatible timebases in order to be combined. A discrete time
93+
system with unspecified sampling time (`dt = True`) can be combined with a system
9494
having a specified sampling time; the result will be a discrete time system with the sample time of the latter
9595
system. Similarly, a system with timebase `None` can be combined with a system having a specified
96-
timebase; the result will have the timebase of the latter system. For continuous
96+
timebase; the result will have the timebase of the latter system. For continuous
9797
time systems, the :func:`sample_system` function or the :meth:`StateSpace.sample` and :meth:`TransferFunction.sample` methods
9898
can be used to create a discrete time system from a continuous time system.
9999
See :ref:`utility-and-conversions`. The default value of 'dt' can be changed by
@@ -179,6 +179,10 @@ can be computed like this::
179179

180180
ft = D * U
181181

182+
183+
.. currentmodule:: control
184+
.. _package-configuration-parameters:
185+
182186
Package configuration parameters
183187
================================
184188

@@ -207,25 +211,25 @@ on standard configurations.
207211
Selected variables that can be configured, along with their default values:
208212
209213
* bode.dB (False): Bode plot magnitude plotted in dB (otherwise powers of 10)
210-
214+
211215
* bode.deg (True): Bode plot phase plotted in degrees (otherwise radians)
212-
216+
213217
* bode.Hz (False): Bode plot frequency plotted in Hertz (otherwise rad/sec)
214-
218+
215219
* bode.grid (True): Include grids for magnitude and phase plots
216-
220+
217221
* freqplot.number_of_samples (None): Number of frequency points in Bode plots
218-
222+
219223
* freqplot.feature_periphery_decade (1.0): How many decades to include in the
220224
frequency range on both sides of features (poles, zeros).
221-
225+
222226
* statesp.use_numpy_matrix (True): set the return type for state space matrices to
223227
`numpy.matrix` (verus numpy.ndarray)
224228
225-
* statesp.default_dt and xferfcn.default_dt (None): set the default value of dt when
229+
* statesp.default_dt and xferfcn.default_dt (None): set the default value of dt when
226230
constructing new LTI systems
227231
228-
* statesp.remove_useless_states (True): remove states that have no effect on the
232+
* statesp.remove_useless_states (True): remove states that have no effect on the
229233
input-output dynamics of the system
230234
231235
Additional parameter variables are documented in individual functions

0 commit comments

Comments
 (0)