Table of Contents

Class UnitModel

Namespace
TimeSeriesAnalysis.Dynamic
Assembly
TimeSeriesAnalysis.dll

Simulatable "default" process model.

This is a model that can be either dynamic or static, have one or multiple inputs and can be either linear in inputs or have inputs nonlinearity described by a second-order polynominal. Dynamics can be either 1. order time-constant, time-delay or both. The model also supports "additive" signals added to its output (intended for modeling disturbances).

The model is designed to lend itself well to identification from industrial time-series datasets, and is supported by the accompanying identification method UnitIdentifier.

This model is also intended to be co-simulated with PidModel by PlantSimulator to study process control feedback loops.

It is assumed that most unit processes in industrial process control systems can be described sufficiently by this model, and thus that larger plants can be modeled by connecting unit models based on this model structure.

It would be possible to extend this model to also describe second-order dynamics along the same principles by the introduction of one additional parameter in future work.

See also: UnitParameters
public class UnitModel : ModelBaseClass, ISimulatableModel
Inheritance
UnitModel
Implements
Inherited Members

Constructors

UnitModel()

Empty constructor

public UnitModel()

UnitModel(UnitParameters, string)

Constructor

[JsonConstructor]
public UnitModel(UnitParameters modelParameters, string ID = "not_named")

Parameters

modelParameters UnitParameters

model parameter object

ID string

a unique string that identifies this model in larger process models

UnitModel(UnitParameters, UnitDataSet, string)

Initalizer of model that for the given dataSet also creates the resulting y_sim.

public UnitModel(UnitParameters modelParameters, UnitDataSet dataSet, string ID = "not_named")

Parameters

modelParameters UnitParameters
dataSet UnitDataSet
ID string

a unique string that identifies this model in larger process models

Fields

modelParameters

The parameters of the UnitModel.

public UnitParameters modelParameters

Field Value

UnitParameters

Methods

Clone(string)

Create a deep copy of itself

public ISimulatableModel Clone(string IDexternal = null)

Parameters

IDexternal string

Returns

ISimulatableModel

deep copy

GetFittedDataSet()

Returns a copy of the dataset against which the model was fitted.

public UnitDataSet GetFittedDataSet()

Returns

UnitDataSet

GetLengthOfInputVector()

Returns the number of external inputs U of the model. Note that this model may have a disturbance signal added to the output in addition to the other signals.

public override int GetLengthOfInputVector()

Returns

int

GetModelParameters()

Get the object of model parameters contained in the model.

public UnitParameters GetModelParameters()

Returns

UnitParameters

Model parameter object

GetOutputSignalType()

Get the type of output signal.

public override SignalType GetOutputSignalType()

Returns

SignalType

GetSteadyStateInput(double, int, double[])

Calcuate the steady-state input if the output and all-but-one input are known.

public double? GetSteadyStateInput(double x0, int inputIdx = 0, double[] givenInputs = null)

Parameters

x0 double

If no additive inputs y=x, otherwise subtract additive inputs from y to get x

inputIdx int
givenInputs double[]

Returns

double?

GetSteadyStateOutput(double[], double)

Get the steady state output y for a given input (including additive terms).

public double? GetSteadyStateOutput(double[] u, double badDataID = -9999)

Parameters

u double[]

vector of input values

badDataID double

Returns

double?

InitSim(UnitParameters)

Initalize the process model with a sampling time.

public void InitSim(UnitParameters modelParameters)

Parameters

modelParameters UnitParameters

model parameters object

IsModelSimulatable(out string)

Answers if the model can be simulated with the inputs provided.

public bool IsModelSimulatable(out string explainStr)

Parameters

explainStr string

a string that explains why the model cannot be simulated if that is the case

Returns

bool

IsModelStatic()

Is the model static or dynamic?

public bool IsModelStatic()

Returns

bool

Returns true if the model is static(no time constant or time delay terms),otherwise false.

Iterate(double[], double, double)

Iterates the process model state one time step, based on the inputs given.

public double[] Iterate(double[] inputs, double timeBase_s, double badValueIndicator = -9999)

Parameters

inputs double[]

vector of inputs U. Optionally the output disturbance D can be added as the last value.

timeBase_s double

the time in seconds between samples

badValueIndicator double

value in U that is to be treated as NaN

Returns

double[]

the updated process model state (x) - the output without any output noise or disturbance. NaN is returned if model was not able to be identfied, or if no good U values have been given yet. If some data points in U inputs are NaN or equal to badValueIndicator, the last good value is returned

RemoveAdditiveInputs()

Removes the addtive inputs.

public void RemoveAdditiveInputs()

SetFittedDataSet(UnitDataSet)

Store the fitted dataset.

public void SetFittedDataSet(UnitDataSet dataset)

Parameters

dataset UnitDataSet

SetModelParameters(UnitParameters)

Update the parameter object of the model.

public void SetModelParameters(UnitParameters parameters)

Parameters

parameters UnitParameters

ToString()

Create a nice human-readable summary of all the important data contained in the model object. This is especially useful for unit-testing and development.

public override string ToString()

Returns

string

WarmStart(double[], double)

Warm-starting.

public void WarmStart(double[] inputs = null, double output = 0)

Parameters

inputs double[]

not used, leave as null

output double

not used, leave as null