@@ -115,7 +115,7 @@ class for a set of subclasses that are used to implement specific
115115 difference equation for the system. This must be specified by the
116116 subclass for the system.
117117
118- * _out (t, x, u): compute the output for the current state of the system.
118+ * output (t, x, u): compute the output for the current state of the system.
119119 The default is to return the entire system state.
120120
121121 """
@@ -392,7 +392,7 @@ def dynamics(self, t, x, u):
392392 NotImplemented ("Dynamics not implemented for system of type " ,
393393 type (self ))
394394
395- def _out (self , t , x , u , params = {}):
395+ def output (self , t , x , u , params = {}):
396396 """Compute the output of the system
397397
398398 Given time `t`, input `u` and state `x`, returns the output of the
@@ -574,7 +574,7 @@ def linearize(self, x0, u0, t=0, params={}, eps=1e-6,
574574 """
575575 #
576576 # If the linearization is not defined by the subclass, perform a
577- # numerical linearization use the `dynamics()` and `_out ()` member
577+ # numerical linearization use the `dynamics()` and `output ()` member
578578 # functions.
579579 #
580580
@@ -589,14 +589,14 @@ def linearize(self, x0, u0, t=0, params={}, eps=1e-6,
589589 u0 = np .ones ((ninputs ,)) * u0
590590
591591 # Compute number of outputs by evaluating the output function
592- noutputs = _find_size (self .noutputs , self ._out (t , x0 , u0 ))
592+ noutputs = _find_size (self .noutputs , self .output (t , x0 , u0 ))
593593
594594 # Update the current parameters
595595 self ._update_params (params )
596596
597597 # Compute the nominal value of the update law and output
598598 F0 = self .dynamics (t , x0 , u0 )
599- H0 = self ._out (t , x0 , u0 )
599+ H0 = self .output (t , x0 , u0 )
600600
601601 # Create empty matrices that we can fill up with linearizations
602602 A = np .zeros ((nstates , nstates )) # Dynamics matrix
@@ -609,14 +609,14 @@ def linearize(self, x0, u0, t=0, params={}, eps=1e-6,
609609 dx = np .zeros ((nstates ,))
610610 dx [i ] = eps
611611 A [:, i ] = (self .dynamics (t , x0 + dx , u0 ) - F0 ) / eps
612- C [:, i ] = (self ._out (t , x0 + dx , u0 ) - H0 ) / eps
612+ C [:, i ] = (self .output (t , x0 + dx , u0 ) - H0 ) / eps
613613
614614 # Perturb each of the input variables and compute linearization
615615 for i in range (ninputs ):
616616 du = np .zeros ((ninputs ,))
617617 du [i ] = eps
618618 B [:, i ] = (self .dynamics (t , x0 , u0 + du ) - F0 ) / eps
619- D [:, i ] = (self ._out (t , x0 , u0 + du ) - H0 ) / eps
619+ D [:, i ] = (self .output (t , x0 , u0 + du ) - H0 ) / eps
620620
621621 # Create the state space system
622622 linsys = LinearIOSystem (
@@ -741,7 +741,7 @@ def dynamics(self, t, x, u):
741741 + np .dot (self .B , np .reshape (u , (- 1 , 1 )))
742742 return np .array (xdot ).reshape ((- 1 ,))
743743
744- def _out (self , t , x , u ):
744+ def output (self , t , x , u ):
745745 # Convert input to column vector and then change output to 1D array
746746 y = np .dot (self .C , np .reshape (x , (- 1 , 1 ))) \
747747 + np .dot (self .D , np .reshape (u , (- 1 , 1 )))
@@ -890,12 +890,12 @@ def __call__(sys, u, params=None, squeeze=None):
890890 "function evaluation is only supported for static "
891891 "input/output systems" )
892892
893- # If we received any parameters, update them before calling _out ()
893+ # If we received any parameters, update them before calling output ()
894894 if params is not None :
895895 sys ._update_params (params )
896896
897897 # Evaluate the function on the argument
898- out = sys ._out (0 , np .array ((0 ,)), np .asarray (u ))
898+ out = sys .output (0 , np .array ((0 ,)), np .asarray (u ))
899899 _ , out = _process_time_response (sys , None , out , None , squeeze = squeeze )
900900 return out
901901
@@ -909,7 +909,7 @@ def dynamics(self, t, x, u):
909909 if self .updfcn is not None else []
910910 return np .array (xdot ).reshape ((- 1 ,))
911911
912- def _out (self , t , x , u ):
912+ def output (self , t , x , u ):
913913 y = self .outfcn (t , x , u , self ._current_params ) \
914914 if self .outfcn is not None else x
915915 return np .array (y ).reshape ((- 1 ,))
@@ -1098,7 +1098,7 @@ def dynamics(self, t, x, u):
10981098
10991099 return xdot
11001100
1101- def _out (self , t , x , u ):
1101+ def output (self , t , x , u ):
11021102 # Make sure state and input are vectors
11031103 x = np .array (x , ndmin = 1 )
11041104 u = np .array (u , ndmin = 1 )
@@ -1130,7 +1130,7 @@ def _compute_static_io(self, t, x, u):
11301130 state_index , input_index , output_index = 0 , 0 , 0
11311131 for sys in self .syslist :
11321132 # Compute outputs for each system from current state
1133- ysys = sys ._out (
1133+ ysys = sys .output (
11341134 t , x [state_index :state_index + sys .nstates ],
11351135 ulist [input_index :input_index + sys .ninputs ])
11361136
@@ -1521,10 +1521,10 @@ def input_output_response(sys, T, U=0., X0=0, params={}, method='RK45',
15211521 if nstates == 0 :
15221522 # No states => map input to output
15231523 u = U [0 ] if len (U .shape ) == 1 else U [:, 0 ]
1524- y = np .zeros ((np .shape (sys ._out (T [0 ], X0 , u ))[0 ], len (T )))
1524+ y = np .zeros ((np .shape (sys .output (T [0 ], X0 , u ))[0 ], len (T )))
15251525 for i in range (len (T )):
15261526 u = U [i ] if len (U .shape ) == 1 else U [:, i ]
1527- y [:, i ] = sys ._out (T [i ], [], u )
1527+ y [:, i ] = sys .output (T [i ], [], u )
15281528 return _process_time_response (
15291529 sys , T , y , np .array ((0 , 0 , np .asarray (T ).size )),
15301530 transpose = transpose , return_x = return_x , squeeze = squeeze )
@@ -1551,10 +1551,10 @@ def ivp_dynamics(t, x): return sys.dynamics(t, x, u(t))
15511551 # Compute the output associated with the state (and use sys.out to
15521552 # figure out the number of outputs just in case it wasn't specified)
15531553 u = U [0 ] if len (U .shape ) == 1 else U [:, 0 ]
1554- y = np .zeros ((np .shape (sys ._out (T [0 ], X0 , u ))[0 ], len (T )))
1554+ y = np .zeros ((np .shape (sys .output (T [0 ], X0 , u ))[0 ], len (T )))
15551555 for i in range (len (T )):
15561556 u = U [i ] if len (U .shape ) == 1 else U [:, i ]
1557- y [:, i ] = sys ._out (T [i ], soln .y [:, i ], u )
1557+ y [:, i ] = sys .output (T [i ], soln .y [:, i ], u )
15581558
15591559 elif isdtime (sys ):
15601560 # Make sure the time vector is uniformly spaced
@@ -1587,7 +1587,7 @@ def ivp_dynamics(t, x): return sys.dynamics(t, x, u(t))
15871587 for i in range (len (T )):
15881588 # Store the current state and output
15891589 soln .y .append (x )
1590- y .append (sys ._out (T [i ], x , u (T [i ])))
1590+ y .append (sys .output (T [i ], x , u (T [i ])))
15911591
15921592 # Update the state for the next iteration
15931593 x = sys .dynamics (T [i ], x , u (T [i ]))
@@ -1713,19 +1713,19 @@ def find_eqpt(sys, x0, u0=[], y0=None, t=0, params={},
17131713 # TODO: update to allow discrete time systems
17141714 def ode_dynamics (z ): return sys .dynamics (t , z , u0 )
17151715 result = root (ode_dynamics , x0 , ** kw )
1716- z = (result .x , u0 , sys ._out (t , result .x , u0 ))
1716+ z = (result .x , u0 , sys .output (t , result .x , u0 ))
17171717 else :
17181718 # Take y0 as fixed and minimize over x and u
17191719 def rootfun (z ):
17201720 # Split z into x and u
17211721 x , u = np .split (z , [nstates ])
17221722 # TODO: update to allow discrete time systems
17231723 return np .concatenate (
1724- (sys .dynamics (t , x , u ), sys ._out (t , x , u ) - y0 ), axis = 0 )
1724+ (sys .dynamics (t , x , u ), sys .output (t , x , u ) - y0 ), axis = 0 )
17251725 z0 = np .concatenate ((x0 , u0 ), axis = 0 ) # Put variables together
17261726 result = root (rootfun , z0 , ** kw ) # Find the eq point
17271727 x , u = np .split (result .x , [nstates ]) # Split result back in two
1728- z = (x , u , sys ._out (t , x , u ))
1728+ z = (x , u , sys .output (t , x , u ))
17291729
17301730 else :
17311731 # General case: figure out what variables to constrain
@@ -1826,7 +1826,7 @@ def rootfun(z):
18261826 dx = sys .dynamics (t , x , u ) - dx0
18271827 if dtime :
18281828 dx -= x # TODO: check
1829- dy = sys ._out (t , x , u ) - y0
1829+ dy = sys .output (t , x , u ) - y0
18301830
18311831 # Map the results into the constrained variables
18321832 return np .concatenate ((dx [deriv_vars ], dy [output_vars ]), axis = 0 )
@@ -1840,7 +1840,7 @@ def rootfun(z):
18401840 # Extract out the results and insert into x and u
18411841 x [state_vars ] = result .x [:nstate_vars ]
18421842 u [input_vars ] = result .x [nstate_vars :]
1843- z = (x , u , sys ._out (t , x , u ))
1843+ z = (x , u , sys .output (t , x , u ))
18441844
18451845 # Return the result based on what the user wants and what we found
18461846 if not return_y :
0 commit comments