Search Results for

    Show / Hide Table of Contents

    Class PlantSimulator

    Simulates larger "plant-models" that is built up of connected sub-models that each implement ISimulatableModel.

    To set up a simulation, first connect models, and then add external input signals. This class handles information about which model is connected to which, and handles calling sub-models in the correct order with the correct input signals.

    By default, the model attempts to start in steady-state, intalization handled by ProcessSimulatorInitializer (this requires no user interaction).

    The building blocks of plant models are UnitModel, PidModel and Select

    UnitModel PidModel PlantSimulatorInitalizer Select
    Inheritance
    object
    PlantSimulator
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: TimeSeriesAnalysis.Dynamic
    Assembly: TimeSeriesAnalysis.dll
    Syntax
    public class PlantSimulator

    Constructors

    | Edit this page View Source

    PlantSimulator(List<ISimulatableModel>, string, string)

    Constructor

    Declaration
    public PlantSimulator(List<ISimulatableModel> processModelList, string plantName = "", string plantDescription = "")
    Parameters
    Type Name Description
    List<ISimulatableModel> processModelList

    A list of process models, each implementing ISimulatableModel

    string plantName

    optional name of plant, used when serializing

    string plantDescription

    optional description of plant

    Fields

    | Edit this page View Source

    PlantFitScore

    The fitScore of the plant the last time it was saved.

    Declaration
    public double PlantFitScore
    Field Value
    Type Description
    double
    | Edit this page View Source

    comments

    A list of comments that the user may have added to track changes made over time.

    Declaration
    public List<Comment> comments
    Field Value
    Type Description
    List<Comment>
    | Edit this page View Source

    connections

    The connection parser object.

    Declaration
    public ConnectionParser connections
    Field Value
    Type Description
    ConnectionParser
    | Edit this page View Source

    externalInputSignalIDs

    List of all external signal IDs.

    Declaration
    public List<string> externalInputSignalIDs
    Field Value
    Type Description
    List<string>
    | Edit this page View Source

    modelDict

    Dictionary of all unit models in the plant simulator (must implement ISimulatableModel).

    Declaration
    public Dictionary<string, ISimulatableModel> modelDict
    Field Value
    Type Description
    Dictionary<string, ISimulatableModel>

    Properties

    | Edit this page View Source

    date

    The date of when the model was last saved.

    Declaration
    public DateTime date { get; set; }
    Property Value
    Type Description
    DateTime
    | Edit this page View Source

    plantDescription

    A short user-friendly description of what the plant is and does.

    Declaration
    public string plantDescription { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    plantName

    User-friendly name that may include white spaces.

    Declaration
    public string plantName { get; set; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    AddAndConnectExternalSignal(ISimulatableModel, string, SignalType, int)

    Add an external signal. Preferred implementation, as the signal can have any ID without naming convention.

    Declaration
    public string AddAndConnectExternalSignal(ISimulatableModel model, string signalID, SignalType type, int index = 0)
    Parameters
    Type Name Description
    ISimulatableModel model
    string signalID
    SignalType type
    int index
    Returns
    Type Description
    string

    signalID or null if something went wrong

    | Edit this page View Source

    AddExternalSignal(ISimulatableModel, SignalType, int)

    Informs the PlantSimulator that a specific sub-model has a specific signal at its input (use for unit testing only, using a naming convention to name signal).

    Declaration
    public string AddExternalSignal(ISimulatableModel model, SignalType type, int index = 0)
    Parameters
    Type Name Description
    ISimulatableModel model
    SignalType type
    int index

    the index of the signal, this is only needed if this is an input to a multi-input model

    Returns
    Type Description
    string
    | Edit this page View Source

    ConnectModelToOutput(ISimulatableModel, ISimulatableModel)

    Add a disturbance model to the output a given model.

    Declaration
    public bool ConnectModelToOutput(ISimulatableModel disturbanceModel, ISimulatableModel model)
    Parameters
    Type Name Description
    ISimulatableModel disturbanceModel
    ISimulatableModel model
    Returns
    Type Description
    bool
    | Edit this page View Source

    ConnectModels(ISimulatableModel, ISimulatableModel, int?)

    Connect the output of the upstream model to the input of the downstream model.

    Declaration
    public string ConnectModels(ISimulatableModel upstreamModel, ISimulatableModel downstreamModel, int? inputIndex = null)
    Parameters
    Type Name Description
    ISimulatableModel upstreamModel

    the upstream model, meaning the model whose output will be connected

    ISimulatableModel downstreamModel

    the downstream model, meaning the model whose input will be connected

    int? inputIndex

    input index of the downstream model to connect to (default is first input)

    Returns
    Type Description
    string

    returns the signal id if all is ok, otherwise null.

    | Edit this page View Source

    ConnectSignalToInput(string, ISimulatableModel, int)

    Connect an existing signal with a given signalID to a new model.

    Declaration
    public bool ConnectSignalToInput(string signalID, ISimulatableModel model, int idx)
    Parameters
    Type Name Description
    string signalID
    ISimulatableModel model
    int idx
    Returns
    Type Description
    bool
    | Edit this page View Source

    GetConnections()

    Get ConnenectionParser object.

    Declaration
    public ConnectionParser GetConnections()
    Returns
    Type Description
    ConnectionParser
    | Edit this page View Source

    GetExternalSignalIDs()

    Get a TimeSeriesDataSet of all external signals of model.

    Declaration
    public string[] GetExternalSignalIDs()
    Returns
    Type Description
    string[]
    | Edit this page View Source

    GetModels()

    Get a dictionary of all models.

    Declaration
    public Dictionary<string, ISimulatableModel> GetModels()
    Returns
    Type Description
    Dictionary<string, ISimulatableModel>
    | Edit this page View Source

    GetUnitDataSetForPID(TimeSeriesDataSet, PidModel)

    Returns a "unitDataSet" for the given pidModel in the plant. This function only works when the unit model connected to the pidModel only has a single input.

    Declaration
    public UnitDataSet GetUnitDataSetForPID(TimeSeriesDataSet inputData, PidModel pidModel)
    Parameters
    Type Name Description
    TimeSeriesDataSet inputData
    PidModel pidModel
    Returns
    Type Description
    UnitDataSet
    | Edit this page View Source

    Serialize(string, string)

    Creates a JSON file representation of this object.

    Declaration
    public bool Serialize(string newPlantName = null, string path = null)
    Parameters
    Type Name Description
    string newPlantName

    the desired file name and plant name (can be null, in which case the filename should be given in the path argument)

    string path

    create file in the given path

    Returns
    Type Description
    bool
    | Edit this page View Source

    SerializeTxt()

    Creates a JSON text string serialization of this object.

    Declaration
    public string SerializeTxt()
    Returns
    Type Description
    string
    | Edit this page View Source

    Simulate(TimeSeriesDataSet, out TimeSeriesDataSet)

    Perform a "plant-wide" full dynamic simulation of the entire plant,i.e. all models in the plant, given the specified connections and external signals.

    The dynamic simulation will also return estimated disturbances in simData, if the plant contains feedback loops where there is an additive disturbance with a signal named according to SignalNamer.EstDisturbance() convention

    The simulation will also set the PlantFitScore which can be used to evalute the fit of the simulation to the plant data. For this score to be calculated, the measured time-series corresponding to simData need to be provided in inputData

    Declaration
    public bool Simulate(TimeSeriesDataSet inputData, out TimeSeriesDataSet simData)
    Parameters
    Type Name Description
    TimeSeriesDataSet inputData

    the external signals for the simulation(also, determines the simulation time span and timebase)

    TimeSeriesDataSet simData

    the simulated data set to be outputted(excluding the external signals)

    Returns
    Type Description
    bool
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX