Generic Simulation Modules

class pymoskito.generic_simulation_modules.AdditiveMixer(settings)[source]

Signal Mixer that accumulates all input signals.

Processing is done according to rules of numpy broadcasting.

class pymoskito.generic_simulation_modules.DeadTimeSensor(settings)[source]

Sensor that adds a measurement delay on chosen states

class pymoskito.generic_simulation_modules.Feedthrough(settings)[source]

A simple feedthrough that passes the reference trajectory to its output.

class pymoskito.generic_simulation_modules.GaussianNoise(settings)[source]

Noise generator for gaussian noise

class pymoskito.generic_simulation_modules.HarmonicTrajectory(settings)[source]

This generator provides a scalar harmonic sinus signal with derivatives up to order n

class pymoskito.generic_simulation_modules.InterpolatorTrajectory(settings)[source]

Generic trajectory that interpolates between the given values

This class basically is a wrapper for scipy’s interp1d.

Note

Values outside the given time domain will not be extrapolated but held at their last values.

Parameters:
  • kind (string) – The type of interpolation to use, possible values are

  • 'linear'

  • 'nearest'

  • 'nearest-up'

  • 'zero'

  • 'slinear'

  • 'quadratic'

  • 'cubic'

  • 'previous'

  • 'next'. (or)

  • x_data (array) – Time steps to work on

  • y_data (array) – Corresponding values

class pymoskito.generic_simulation_modules.LinearStateSpaceController(settings)[source]

A controller that is based on a state space model of a linear system.

This controller needs a linear statespace model, just as the LinearStateSpaceModel . The file provided in config file should therefore contain a dict holding the entries: model, op_inputs and op_outputs .

If poles is given (differing from None ) the state-feedback will be computed using pymoskito.place_siso() . Furthermore, an appropriate prefilter is calculated, which establishes stationary attainment of the desired output values.

Note

If a SIMO or MIMO system is given, the control package as well as the slycot package are needed the perform the pole placement.

class pymoskito.generic_simulation_modules.LinearStateSpaceModel(settings)[source]

The state space model of a linear system.

The parameters of this model can be provided in form of a file whose path is given by the setting config file . This path should point to a pickled dict holding the following keys:

system:

An Instance of scipy.signal.StateSpace (from scipy) representing the system,

op_inputs:

An array-like object holding the operational point’s inputs,

op_outputs:

An array-like object holding the operational point’s outputs.

calc_output(input_vector)[source]

Main evaluation routine.

Every time the solver has made the amount of steps specified in tick_divider, this method will be called to compute the next output of the module. This is typically where the main logic of a module is implemented.

state_function(t, x, args)[source]

Calculate the state derivatives of a system with state x at time t.

Parameters:
  • x (Array-like) – System state.

  • t (float) – System time.

  • args – Extra arguments.

Returns:

Temporal derivative of the system state at time t.

class pymoskito.generic_simulation_modules.ModelInputLimiter(settings)[source]

ModelInputLimiter that limits the model input values.

Settings:

Limits: (List of) list(s) that hold (min, max) pairs for the corresponding input.

class pymoskito.generic_simulation_modules.ODEInt(settings)[source]

Wrapper for ode_int from the Scipy project

Parameters:

settings (OrderedDict) – Dictionary holding the config options for this module. See Solver and scipy’s odeint for details.

integrate(*, t=None)[source]

Solve the system equations for one step

Parameters:

t (float) – Target time to stop at, if None use step size from settings

Returns:

system state at target time

set_input(*args)[source]

propagate input changes to ode_int

property t

The current simulation time.

class pymoskito.generic_simulation_modules.PIDController(settings)[source]

A simple scalar PID Controller with basic anti-windup

This class will run a PID controller with the given settings for each component of the model output listed in ‘input indexes’.

class pymoskito.generic_simulation_modules.Setpoint(settings)[source]

Provides setpoints for every output component.

If the output is not scalar, just add more entries to the list. By querying the differential order from the controller (if available) the required derivatives are given.

Note

Keep in mind that while this class provides zeros for all derivatives of the desired value, they actually strive to infinity for t=0 .

class pymoskito.generic_simulation_modules.SmoothTransition(settings)[source]

provides (differential) smooth transition between two scalar states