Interactive.Examples.tank

Tank with multiple state selections

Information

tank package

This model intends to illustrate the case of a model supporting several state selections. This model describes a tank with one output at the bottom and one pump placed at the top.
It executes correctly in Dymola but not in OpenModelica.
        

Package Content

Name Description
Interactive.Examples.tank.tank1OutputModel tank1OutputModel Physical model
Interactive.Examples.tank.StateSelection1 StateSelection1 h: state variable
Interactive.Examples.tank.StateSelection2 StateSelection2 V: state variable
Interactive.Examples.tank.StateSelection3 StateSelection3 F: state variable
Interactive.Examples.tank.interactiveModel interactiveModel Interactive model
Interactive.Examples.tank.tank1OutputInteractive tank1OutputInteractive Virtual-lab model
Interactive.Examples.tank.setParamVar setParamVar When clauses to change interactive parameters and input variables
Interactive.Examples.tank.tank1OutputView tank1OutputView Virtual-lab view

Interactive.Examples.tank.tank1OutputModel

Physical model

Information



This model describes a tank with one output at the bottom and one pump placed at the top. It has been adapted for interactive simulation. The boolean vector isState[:], declared in tank1OutputModel, allows controlling the state selection. The size of this vector is equal to the number of interactive time-dependent quantities. The interactive variables of the models are shown in Table 1.

Table 1. Interactive variables.
a Output hole section.
A Tank section.
k Input valve parameter.
vin Input voltage.


Parameters

NameDescription
isState[3]This vector allows controlling the state selection
hIsStatetrue: h is the state variable
VIsStatetrue: V is the state variable
FIsStatetrue: F is the state variable
aInitialInitial value of the output hole section
AInitialInitial value of the tank section
KInitialInitial value of the pump parameter
vInitialInitial value of the pump voltage
hInitialInitial value of the liquid level
VInitialInitial value of the liquid volume
FInitialInitial value of the liquid flow
gConstant of gravity [cm/s2]

Interactive.Examples.tank.StateSelection1

h: state variable

Information



This model inherits from the setParamVar model. The liquid level (h) is the state variable of this model. It includes the code to reinitialize the value of the state variable.

Extends from setParamVar (When clauses to change interactive parameters and input variables).

Parameters

NameDescription
isState[3]This vector allows controlling the state selection
hIsStatetrue: h is the state variable
VIsStatetrue: V is the state variable
FIsStatetrue: F is the state variable
aInitialInitial value of the output hole section
AInitialInitial value of the tank section
KInitialInitial value of the pump parameter
vInitialInitial value of the pump voltage
hInitialInitial value of the liquid level
VInitialInitial value of the liquid volume
FInitialInitial value of the liquid flow
gConstant of gravity [cm/s2]

Interactive.Examples.tank.StateSelection2

V: state variable

Information



This model inherits from the setParamVar model. The liquid volume (V) is the state variable of this model. It includes the code to reinitialize the value of the state variable.

Extends from setParamVar (When clauses to change interactive parameters and input variables).

Parameters

NameDescription
isState[3]This vector allows controlling the state selection
hIsStatetrue: h is the state variable
VIsStatetrue: V is the state variable
FIsStatetrue: F is the state variable
aInitialInitial value of the output hole section
AInitialInitial value of the tank section
KInitialInitial value of the pump parameter
vInitialInitial value of the pump voltage
hInitialInitial value of the liquid level
VInitialInitial value of the liquid volume
FInitialInitial value of the liquid flow
gConstant of gravity [cm/s2]

Interactive.Examples.tank.StateSelection3

F: state variable

Information



This model inherits from the setParamVar model. The liquid flow (F) is the state variable of this model. It includes the code to reinitialize the value of the state variable.

Extends from setParamVar (When clauses to change interactive parameters and input variables).

Parameters

NameDescription
isState[3]This vector allows controlling the state selection
hIsStatetrue: h is the state variable
VIsStatetrue: V is the state variable
FIsStatetrue: F is the state variable
aInitialInitial value of the output hole section
AInitialInitial value of the tank section
KInitialInitial value of the pump parameter
vInitialInitial value of the pump voltage
hInitialInitial value of the liquid level
VInitialInitial value of the liquid volume
FInitialInitial value of the liquid flow
gConstant of gravity [cm/s2]

Interactive.Examples.tank.interactiveModel

Interactive model

Information



This model is composed of three instantiations of the physical-model: SS1, SS2 and SS3. Each model has a different choice of the state variables.

Interactive.Examples.tank.tank1OutputInteractive

Virtual-lab model

Information



This model has been composed by instantiating the VirtualLab Model, which is included in the Interactive library. The tank1OutputInteractive model includes the equations required to link the model and the view variables.

Interactive.Examples.tank.setParamVar

When clauses to change interactive parameters and input variables

Information



The setParamVar class inherits from physicalModel, and it contains the when-clauses required to change the value of the interactive parameters and input variables. The new values of the interactive quantities, specified interactively by the virtual-lab user, are included in the array I[:]. The size of these arrays is equal to the number of interactive parameters plus the number of interactive input variables. The when-clauses are triggered by the boolean variables CK and Enabled. When the value of any of these two variables changes from false to true, then the interactive quantities are re-initialized to the value of the I[:] array.

Extends from tank1OutputModel (Physical model).

Parameters

NameDescription
isState[3]This vector allows controlling the state selection
hIsStatetrue: h is the state variable
VIsStatetrue: V is the state variable
FIsStatetrue: F is the state variable
aInitialInitial value of the output hole section
AInitialInitial value of the tank section
KInitialInitial value of the pump parameter
vInitialInitial value of the pump voltage
hInitialInitial value of the liquid level
VInitialInitial value of the liquid volume
FInitialInitial value of the liquid flow
gConstant of gravity [cm/s2]

Interactive.Examples.tank.tank1OutputView Interactive.Examples.tank.tank1OutputView

Virtual-lab view

Information



This model has been composed by extending the PartialView class and by instantiating and connecting the required components of the Interactive library. The connection rules are described in the documentation of the ViewElements package.

Extends from Interactive.VLabModels.PartialView (Super-class of the model describing the virtual-lab view).

Parameters

NameDescription
TcomCommunication interval
serverPortServer Port number
launchView0/1 not/yes launch the view
ipAddressip Address
sourceCodePathPath where the C-functions, Library.dll and pRun.exe are located
numberGUINumber of GUIs
fileNameCpp file name
compilation 
liquidIX[6]Interactive x components of the liquid polygon
liquidIY[6]Interactive y components of the liquid polygon
vaseIX[6]Interactive x components of the vase polygon
vaseIY[6]Interactive x components of the vase polygon
liquidFromPipeIx[4]Interactive x components of the liquidFromPipe polygon
Initialization
refreshViewTrue only when the model-view communication is established
Automatically generated Thu Apr 28 12:24:22 2022.