Table of Contents

Class ConnectionParser

Namespace
TimeSeriesAnalysis.Dynamic
Assembly
TimeSeriesAnalysis.dll

Class that tracks which model is connected to which in a set of models.

This is important when traversing the models when simulating with the PlantSimulator, as these models need to be run in a specific order

public class ConnectionParser
Inheritance
ConnectionParser
Inherited Members

Constructors

ConnectionParser()

Constructor

public ConnectionParser()

Fields

connections

List of connections

[JsonInclude]
public List<(string, string)> connections

Field Value

List<(string, string)>

Methods

FindComputationalLoops(Dictionary<string, ISimulatableModel>)

Parses models and determines if there are co-dependent models

public Dictionary<string, List<string>> FindComputationalLoops(Dictionary<string, ISimulatableModel> modelDict)

Parameters

modelDict Dictionary<string, ISimulatableModel>

Returns

Dictionary<string, List<string>>

a dictionary with an ID and a list of all involved modelIDs

GetAllDownstreamModelIDs(string)

Get all the models which are connected to a given model one level directly downstream of it

public List<string> GetAllDownstreamModelIDs(string modelID)

Parameters

modelID string

Returns

List<string>

GetAllUpstreamModels(string)

Get all the models which are connected to a given model one level directly upstream of it

public List<string> GetAllUpstreamModels(string modelID)

Parameters

modelID string

Returns

List<string>

GetUnitModelControlledByPID(string, Dictionary<string, ISimulatableModel>)

Get unit model controlled by PDI

public string GetUnitModelControlledByPID(string pidModelID, Dictionary<string, ISimulatableModel> modelDict)

Parameters

pidModelID string
modelDict Dictionary<string, ISimulatableModel>

Returns

string

returns null if no model is found

GetUpstreamPIDIds(string, Dictionary<string, ISimulatableModel>)

Get the ID of the PID-controller that is upstream a given modelID

public string[] GetUpstreamPIDIds(string modelID, Dictionary<string, ISimulatableModel> modelDict)

Parameters

modelID string
modelDict Dictionary<string, ISimulatableModel>

Returns

string[]

HasUpstreamPID(string, Dictionary<string, ISimulatableModel>)

Query if the model has an upstream PID-model.

public bool HasUpstreamPID(string modelID, Dictionary<string, ISimulatableModel> modelDict)

Parameters

modelID string
modelDict Dictionary<string, ISimulatableModel>

Returns

bool

InitAndDetermineCalculationOrderOfModels(Dictionary<string, ISimulatableModel>)

Determine the order in which the models must be solved

public (List<string>, Dictionary<string, List<string>>) InitAndDetermineCalculationOrderOfModels(Dictionary<string, ISimulatableModel> modelDict)

Parameters

modelDict Dictionary<string, ISimulatableModel>

Returns

(List<string>, Dictionary<string, List<string>>)

returns the string of sorted model IDs, the order in which modelDict models are to be run. If the plant contains computational loops, the IDs of the computational loops are also in these lists instead of the indivudal models.