Class UnitModel
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: UnitParametersImplements
Inherited Members
Namespace: TimeSeriesAnalysis.Dynamic
Assembly: TimeSeriesAnalysis.dll
Syntax
public class UnitModel : ModelBaseClass, ISimulatableModel
Constructors
| Edit this page View SourceUnitModel()
Declaration
public UnitModel()
UnitModel(UnitParameters, string)
Constructor
Declaration
[JsonConstructor]
public UnitModel(UnitParameters modelParameters, string ID = "not_named")
Parameters
Type | Name | Description |
---|---|---|
UnitParameters | modelParameters | model parameter object |
string | ID | 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.
Declaration
public UnitModel(UnitParameters modelParameters, UnitDataSet dataSet, string ID = "not_named")
Parameters
Type | Name | Description |
---|---|---|
UnitParameters | modelParameters | |
UnitDataSet | dataSet | |
string | ID | a unique string that identifies this model in larger process models |
Fields
| Edit this page View SourcemodelParameters
The parameters of the UnitModel.
Declaration
public UnitParameters modelParameters
Field Value
Type | Description |
---|---|
UnitParameters |
Methods
| Edit this page View SourceClone(string)
Create a deep copy of itself
Declaration
public ISimulatableModel Clone(string IDexternal = null)
Parameters
Type | Name | Description |
---|---|---|
string | IDexternal |
Returns
Type | Description |
---|---|
ISimulatableModel | deep copy |
GetFittedDataSet()
Returns a copy of the dataset against which the model was fitted.
Declaration
public UnitDataSet GetFittedDataSet()
Returns
Type | Description |
---|---|
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.
Declaration
public override int GetLengthOfInputVector()
Returns
Type | Description |
---|---|
int |
Overrides
| Edit this page View SourceGetModelParameters()
Get the object of model parameters contained in the model.
Declaration
public UnitParameters GetModelParameters()
Returns
Type | Description |
---|---|
UnitParameters | Model parameter object |
GetOutputSignalType()
Get the type of output signal.
Declaration
public override SignalType GetOutputSignalType()
Returns
Type | Description |
---|---|
SignalType |
Overrides
| Edit this page View SourceGetSteadyStateInput(double, int, double[])
Calcuate the steady-state input if the output and all-but-one input are known.
Declaration
public double? GetSteadyStateInput(double x0, int inputIdx = 0, double[] givenInputs = null)
Parameters
Type | Name | Description |
---|---|---|
double | x0 | If no additive inputs y=x, otherwise subtract additive inputs from y to get x |
int | inputIdx | |
double[] | givenInputs |
Returns
Type | Description |
---|---|
double? |
GetSteadyStateOutput(double[], double)
Get the steady state output y for a given input (including additive terms).
Declaration
public double? GetSteadyStateOutput(double[] u, double badDataID = -9999)
Parameters
Type | Name | Description |
---|---|---|
double[] | u | vector of input values |
double | badDataID |
Returns
Type | Description |
---|---|
double? |
InitSim(UnitParameters)
Initalize the process model with a sampling time.
Declaration
public void InitSim(UnitParameters modelParameters)
Parameters
Type | Name | Description |
---|---|---|
UnitParameters | modelParameters | model parameters object |
IsModelSimulatable(out string)
Answers if the model can be simulated with the inputs provided.
Declaration
public bool IsModelSimulatable(out string explainStr)
Parameters
Type | Name | Description |
---|---|---|
string | explainStr | a string that explains why the model cannot be simulated if that is the case |
Returns
Type | Description |
---|---|
bool |
IsModelStatic()
Is the model static or dynamic?
Declaration
public bool IsModelStatic()
Returns
Type | Description |
---|---|
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.
Declaration
public double[] Iterate(double[] inputs, double timeBase_s, double badValueIndicator = -9999)
Parameters
Type | Name | Description |
---|---|---|
double[] | inputs | vector of inputs U. Optionally the output disturbance D can be added as the last value. |
double | timeBase_s | the time in seconds between samples |
double | badValueIndicator | value in U that is to be treated as NaN |
Returns
Type | Description |
---|---|
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 |
SetFittedDataSet(UnitDataSet)
Store the fitted dataset.
Declaration
public void SetFittedDataSet(UnitDataSet dataset)
Parameters
Type | Name | Description |
---|---|---|
UnitDataSet | dataset |
SetModelParameters(UnitParameters)
Update the parameter object of the model.
Declaration
public void SetModelParameters(UnitParameters parameters)
Parameters
Type | Name | Description |
---|---|---|
UnitParameters | parameters |
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.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceWarmStart(double[], double)
Warm-starting.
Declaration
public void WarmStart(double[] inputs = null, double output = 0)
Parameters
Type | Name | Description |
---|---|---|
double[] | inputs | not used, leave as null |
double | output | not used, leave as null |
test()
Declaration
public string test()
Returns
Type | Description |
---|---|
string |