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:

y1=f1(x1,x2,,xn)y2=f2(x1,x2,,xn)ym=fm(x1,x2,,xn)

where each yi is a name-assigned expression on the output field and each xi is an element drawn from the input field.

Each xi and yj may have arbitrary shape. Condor can automatically calculate the derivatives dyjdxi as needed for parent solvers, etc.

input = <FreeField: ExplicitSystem.input>

the inputs of the model (e.g., xi)

output = <AssignedField: ExplicitSystem.output>

the outputs of the model (e.g., yi=fi(x))

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 u and implicit variables x, is driven to a solution at x:

R1(u1,,um,x1,,xn)=0Rn(u1,,um,x1,,xn)=0

Condor solves for the xi and can automatically calculate the derivatives dxiduj as needed for parent solvers, etc.

Additional explicit outputs at the solution may also be included:

y1=f1(u1,,um,x1,,xn)yl=fm(x1,,um,x1,,xn)
parameter = <FreeField: AlgebraicSystem.parameter>

parameters held constant during solution of the system, u

variable = <InitializedField: AlgebraicSystem.variable>

variables used to drive residuals to 0, x

residual = <FreeAssignedField: AlgebraicSystem.residual>

residuals to satisfy, R

output = <AssignedField: AlgebraicSystem.output>

additional explicit outputs, y

classmethod set_initial(**kwargs)

Set initial values for the variables of the model

class condor.contrib.OptimizationProblem(*args, **kwargs)

Representation of a general optimization problem

The problem is of the form:

minimizex1,,xnf(x1,,xn,p1,pm)subject tolxixiuxilgjgj(x1,,xn,p1,pm)ugj

The variables xi are driven by the optimization algorithm to minimize the objective function f while respecting bounds on the variables as well as constraint functions gj.

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, x

parameter = <FreeField: OptimizationProblem.parameter>

parameters held constant during solution of the system, p

constraint = <BoundedAssignmentField: OptimizationProblem.constraint>

constraints g expressed as relationals

objective = <OptimizationProblem.placeholder: objective>

scalar objective to minimize, f

classmethod set_initial(**kwargs)

Set initial values for the variables of the model

Overrides 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 y:

x˙i=f(t,x1,,xn,p1,,pm)yi=h(t,x1,,xn,p1,,pm)

where x are the states fully defining the evolution of the system, t is the independent variable (typically time, but may be anything), and p are constant parameters.

Typically used in combination with one or more TrajectoryAnalysis submodels. Mode and Event submodels may also be added.

t = <ODESystem.placeholder: t>

independent variable t

state = <FreeField: ODESystem.state>

state variables x

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 p

dot = <MatchedField: ODESystem.dot>

derivatives of the state variables with respect to t, x˙

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 y

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 the TrajectoryAnalysis)

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 modals 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 before tf

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).