propagation
get_propagation_solver(state_dot: Dynamics, settings: Config, discretizer: Discretizer) -> callable
¶
Create a propagation solver function.
This function creates a solver that propagates the system state using the specified dynamics and settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_dot
|
Dynamics
|
Dynamics object containing state derivative function. |
required |
settings
|
Config
|
Configuration settings for propagation. |
required |
discretizer
|
Discretizer
|
Discretizer instance (used for |
required |
Returns:
| Name | Type | Description |
|---|---|---|
callable |
callable
|
A function that solves the propagation problem. |
Source code in openscvx/propagation/propagation.py
prop_aug_dy(tau: float, x: np.ndarray, u_current: np.ndarray, u_next: np.ndarray, tau_init: float, node: int, state_dot: callable, foh_mask: np.ndarray, N: int, params: dict) -> np.ndarray
¶
Compute the augmented dynamics for propagation.
This function computes the time-dilated dynamics for propagating the system
state, taking into account the per-control hold type (ZOH or FOH). The
time-dilation multiplication is already included in state_dot
symbolically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau
|
float
|
Current normalized time in [0,1]. |
required |
x
|
ndarray
|
Current state vector. |
required |
u_current
|
ndarray
|
Control input at current node. |
required |
u_next
|
ndarray
|
Control input at next node. |
required |
tau_init
|
float
|
Initial normalized time. |
required |
node
|
int
|
Current node index. |
required |
state_dot
|
callable
|
Function computing time-dilated state derivatives. |
required |
foh_mask
|
ndarray
|
Float array of shape |
required |
N
|
int
|
Number of nodes in trajectory. |
required |
params
|
dict
|
Dictionary of additional parameters passed to state_dot. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Time-dilated state derivatives. |
Source code in openscvx/propagation/propagation.py
s_to_t(x: np.ndarray, u: np.ndarray, settings: Config, discretizer: Discretizer) -> list[float]
¶
Convert normalized time s to real time t.
This function converts the normalized time variable s to real time t based on the hold type of the time-dilation control.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
State trajectory array, shape (N, n_states). |
required |
u
|
ndarray
|
Control trajectory array, shape (N, n_controls). |
required |
settings
|
Config
|
Configuration settings. |
required |
discretizer
|
Discretizer
|
Discretizer instance (used for |
required |
Returns:
| Type | Description |
|---|---|
list[float]
|
list[float]: List of real time points. |
Source code in openscvx/propagation/propagation.py
simulate_nonlinear_time(params: dict, x: np.ndarray, u: np.ndarray, tau_vals: np.ndarray, t: np.ndarray, settings: Config, propagation_solver: callable, dynamics_discrete: Optional[Callable] = None) -> np.ndarray
¶
Simulate the nonlinear system dynamics over time.
This function simulates the system dynamics using the optimal control sequence and returns the resulting state trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict
|
System parameters. |
required |
x
|
ndarray
|
State trajectory array, shape (N, n_states). |
required |
u
|
ndarray
|
Control trajectory array, shape (N, n_controls). |
required |
tau_vals
|
ndarray
|
Normalized time points for simulation. |
required |
t
|
ndarray
|
Real time points. |
required |
settings
|
Config
|
Configuration settings. |
required |
propagation_solver
|
callable
|
Function for propagating the system state. |
required |
dynamics_discrete
|
Optional[Callable]
|
Optional discrete dynamics map f_discrete(x, u, node, params) used to apply impulsive/discrete updates at each node before continuous propagation. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: Simulated state trajectory. |
Source code in openscvx/propagation/propagation.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
t_to_tau(u: np.ndarray, t: np.ndarray, t_nodal: np.ndarray, settings: Config, discretizer: Discretizer) -> tuple[np.ndarray, np.ndarray]
¶
Convert real time t to normalized time tau.
This function converts real time t to normalized time tau and interpolates the control inputs according to each control's hold type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
ndarray
|
Control trajectory array, shape (N, n_controls). |
required |
t
|
ndarray
|
Real time points. |
required |
t_nodal
|
ndarray
|
Nodal time points. |
required |
settings
|
Config
|
Configuration settings. |
required |
discretizer
|
Discretizer
|
Discretizer instance (used for |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: (tau, u_interp) where tau is normalized time and u_interp is interpolated controls. |