Contrib Models¶
Built-in model templates
- class condor.contrib.ExplicitSystem(*args, **kwargs)¶
Representation of a system of explicit equations
Outputs are functions solely of inputs:
where each
is a name-assigned expression on theoutput
field and each is an element drawn from theinput
field.Each
and may have arbitrary shape. Condor can automatically calculate the derivatives as needed for parent solvers, etc.- input = <FreeField: ExplicitSystem.input>¶
the inputs of the model (e.g.,
)
- output = <AssignedField: ExplicitSystem.output>¶
the outputs of the model (e.g.,
)
- class condor.contrib.TableLookup(*args, **kwargs)¶
Spline interpolation for gridded data
- __original_init__(xx, yy, degrees=3, bcs=(-1, 0))¶
Construct a
TableLookup
model from data- Parameters:
xx (dict) – a dictionary where keys are input element names and values are the grid points for data on that axis, so the collection of values can be passed to
np.meshgrid
to construct a rectilinear grid; input should be a single dimension.yy (dict) – a dictionary where keys are output element names and values are the values on the input grid to be interpolated
degrees (float or array-like, optional) – Degree of interpolant for each axis (or broadcastable). Default is 3.
bcs (array-like, optional) – Array of boundary conditions broadcastable to
(xdim, 2, 2)
.bc[xdim, 0 for left | 1 for right, :] = (order, value)
for specifying derivative conditions. Use (-1, 0) to specify the not-a-knot boundary conditions (default), where the boundary polynomial is the same as it neighbor.
- class condor.contrib.AlgebraicSystem(*args, **kwargs)¶
Representation of a system of algebraic equations
An algebraic system with parameters
and implicit variables , is driven to a solution at :Condor solves for the
and can automatically calculate the derivatives as needed for parent solvers, etc.Additional explicit outputs at the solution may also be included:
- parameter = <FreeField: AlgebraicSystem.parameter>¶
parameters held constant during solution of the system,
- variable = <InitializedField: AlgebraicSystem.variable>¶
variables used to drive residuals to 0,
- residual = <FreeAssignedField: AlgebraicSystem.residual>¶
residuals to satisfy,
- output = <AssignedField: AlgebraicSystem.output>¶
additional explicit outputs,
- classmethod set_initial(**kwargs)¶
Set initial values for the
variable
s of the model
- class condor.contrib.OptimizationProblem(*args, **kwargs)¶
Representation of a general optimization problem
The problem is of the form:
The variables
are driven by the optimization algorithm to minimize the objective function while respecting bounds on the variables as well as constraint functions .If an objective isn’t provided, the default is constant 0 (i.e. a feasibility problem).
- variable = <InitializedField: OptimizationProblem.variable>¶
variables driven to solve the problem,
- parameter = <FreeField: OptimizationProblem.parameter>¶
parameters held constant during solution of the system,
- constraint = <BoundedAssignmentField: OptimizationProblem.constraint>¶
constraints
expressed as relationals
- objective = <OptimizationProblem.placeholder: objective>¶
scalar objective to minimize,
- classmethod set_initial(**kwargs)¶
Set initial values for the
variable
s of the modelOverrides initial values provided to the
variable
field in the model declaration.
- classmethod from_values(**kwargs)¶
Construct an instance of a solved model from variable and parameter values
- class condor.contrib.ODESystem(*args, **kwargs)¶
Representation of a dynamical system
The system is defined by a set of ordinary differential equations (ODEs) and optionally additional outputs
:where
are the states fully defining the evolution of the system, is the independent variable (typically time, but may be anything), and are constant parameters.Typically used in combination with one or more
TrajectoryAnalysis
submodels.Mode
andEvent
submodels may also be added.- t = <ODESystem.placeholder: t>¶
independent variable
- state = <FreeField: ODESystem.state>¶
state variables
- initial = <MatchedField: ODESystem.initial>¶
initial values for the states; may also/instead be specified at the
TrajectoryAnalysis
level
- parameter = <FreeField: ODESystem.parameter>¶
constant (in time) parameters
- dot = <MatchedField: ODESystem.dot>¶
derivatives of the state variables with respect to
,
- modal = <WithDefaultField: ODESystem.modal>¶
elements with deferred behavior, for implementing things such as control inputs
- dynamic_output = <AssignedField: ODESystem.dynamic_output>¶
additional time-varying outputs
- class condor.contrib.Event(*args, **kwargs)¶
Instantaneous event for
ODESystem
models.Events may be declared at a specific time (
at_time
) or as a function with zero-crossings dictating the event time (function
).- update = <MatchedField: Event.update>¶
instantaneous updates for any states in the ODE system
- terminate = <Event.placeholder: terminate>¶
flag to specify whether the event should terminate the simulation (overriding
tf
on theTrajectoryAnalysis
)
- function = <Event.placeholder: function>¶
expression where zero-crossings indicate event times
- at_time = <Event.placeholder: at_time>¶
time at which the event occurs; periodic events may be specified with a slice object (stop=None for infinite) with both start and stop inclusive
- class condor.contrib.Mode(*args, **kwargs)¶
Conditional behavior of dynamics and/or controls for
ODESystem
- condition = <Mode.placeholder: condition>¶
expression for triggering the mode
- action = <MatchedField: Mode.action>¶
behaviors of the declared
modal
s in this mode
- class condor.contrib.TrajectoryAnalysis(*args, **kwargs)¶
Simulation of an
ODESystem
The trajectory analysis specifies the parameters for numerical integration of the ODE system.
The parameters, final states and state rates, and final time from the ODE system are all available for use in expressions for
trajectory_output
.- trajectory_output = <TrajectoryOutputField: TrajectoryAnalysis.trajectory_output>¶
additional output calculated from the terminal state and/or integrand terms
- tf = <TrajectoryAnalysis.placeholder: tf>¶
final time; may not be reached if the system has a terminating
Event
occuring beforetf
- t0 = <TrajectoryAnalysis.placeholder: t0>¶
intitial time (default 0)
- classmethod initial_condition(*args, **kwargs)¶
- classmethod point_analysis(t, *args, **kwargs)¶
Compute the state rates for the ODESystems that were bound (at the time of construction).