Martin, C. and A. Urquia and S. Dormido (2007): Implementation of Interactive Virtual Laboratories for Control Education Using Modelica. Proceedings of European Control Conference 2007, Kos (Greece), pp. 2679-2686.
Name | Description |
---|---|
![]() | Liquid source |
![]() | Industrial boiler model |
![]() | Valve |
![]() | Controlled system + 2 PID controllers |
![]() | Set-point |
![]() | Water CV |
viewBoiler | Modelica description of the virtual-lab view |
Interactive | Modelica description of the virtual-lab |
![]() | Switch between two Real signals |
Controller of the heat source
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Type | Name | Description |
---|---|---|
cutEmitter | setPointSignal | Set-point of the total volumetric flow, component volume fraction and temperature |
cutReceiver | cutReceiver |
model sourceLiqCntrl "Liquid source" extends JARA2i.interf.sourceVolLiqSignalI(nComp=1); Real flowVSP( unit="L3.t-1", start=0) "Setpoint of the volumetric flow"; Real tempSP( unit="T", start=297) "Setpoint of the flow temperature"; JARA2i.cutsB.cutReceiver cutReceiver(dim = 1); equation totalVolFSP = flowVSP; volFractSP = {1}; tempFSP = tempSP; cutReceiver.signal[1] = -flowVSP; der(tempSP) = 0; end sourceLiqCntrl;
Type | Name | Default | Description |
---|---|---|---|
Boolean | Ejs | true | Global variable - Runtime interactivity |
Boolean | Sysquake | false | Global variable - Batch interactivity |
Real | perfGasConst | 8.31 | Constant of the perfect gases [J/(mol*K)] |
Real | CpCoefML[1, 7] | [4.18E3, 0, 0, 0, 0, 0, 0] | Heat capacity per mass unit of the liquid. [Cp]: J/(Kg*K) |
Real | CpCoefNG[1, 7] | [55.486, 54.24E-3, 0, 0, 0, ... | Molar heat capacity, at constant pressure, of the vapor. [Cp]:J/(mol*K) |
Real | molecWeigth[:] | {18E-3} | Molecular weigth of the water [Kg/mol] |
Real | density[:] | {1E3} | Density of liquid water [Kg/m3] |
Real | molEnthalpyGRef[:] | {-241.8322E3} | Reference molar enthalpy of the vapor [J/mol] |
Real | massEnthalpyLRef[:] | {-15.88E6} | Reference enthalpy per mass unit of the liquid [J/Kg] |
Real | tempRef | 298 | Enthalpy reference temperature [K] |
Real | Kprop | 10 | Parameter of the boiling model [Kg/(s*K)] |
Real | Kvalve | (1.1E-7/molecWeigth[1]) | Valve coefficient [mol/(s*N/m**2)] |
Real | pressDownStreamInitial | 11 | Output pressure [N/m**2] |
Real | tempDownStreamInitial | 300 | Output temperature [K] |
Real | sectionInitial | 1 | Boiler cross-section [m2] |
Real | vesselVolumeInitial | 5.66 | Boiler volume [m3] |
Real | molVaporInitial[:] | {1273} | [mol] |
Real | tempVaporInitial | 463 | [K] |
Real | massWaterInitial[:] | {2200} | [Kg] |
Real | tempWaterInitial | 420 | [K] |
partial model steamPowerBoiler "Industrial boiler model" // Interactivity inner parameter Boolean Ejs = true "Global variable - Runtime interactivity"; inner parameter Boolean Sysquake = false "Global variable - Batch interactivity"; parameter Real perfGasConst( unit="J/(mol*K)") = 8.31 "Constant of the perfect gases"; parameter Real CpCoefML[1,7] = [ 4.18E3, 0, 0, 0, 0, 0, 0] "Heat capacity per mass unit of the liquid. [Cp]: J/(Kg*K)"; parameter Real CpCoefNG[1,7] = [ 55.486, 54.24E-3, 0, 0, 0, 0, 0] "Molar heat capacity, at constant pressure, of the vapor. [Cp]:J/(mol*K)"; parameter Real molecWeigth[:]( unit="Kg/mol") = {18E-3} "Molecular weigth of the water"; parameter Real density[:]( unit="Kg/m3") = {1E3} "Density of liquid water"; parameter Real molEnthalpyGRef[:]( unit="J/mol") = {-241.8322E3} "Reference molar enthalpy of the vapor"; parameter Real massEnthalpyLRef[:]( unit="J/Kg") = {- 15.88E6} "Reference enthalpy per mass unit of the liquid"; parameter Real tempRef( unit="K") = 298 "Enthalpy reference temperature"; parameter Real Kprop( unit="Kg/(s*K)") = 10 "Parameter of the boiling model"; parameter Real Kvalve( unit="mol/(s*N/m**2)") = ( 1.1E-7 / molecWeigth[1]) "Valve coefficient"; parameter Real pressDownStreamInitial( unit="N/m**2") = 11 "Output pressure"; //1.2e5/101385 =1.18 parameter Real tempDownStreamInitial( unit="K") = 300 "Output temperature"; parameter Real sectionInitial( unit="m2") = 1 "Boiler cross-section"; parameter Real vesselVolumeInitial( unit="m3") = 5.66 "Boiler volume"; //3 parameter Real molVaporInitial[:]( unit="mol") = {1273}; //1273 parameter Real tempVaporInitial( unit="K") = 463; //450 parameter Real massWaterInitial[:]( unit="Kg") = {2200}; //1600 parameter Real tempWaterInitial( unit="K") = 420; //420 JARA2i.gas.semiPerfGasCp6B vapor( nComp=1,perfGasConst=perfGasConst,CpCoefN=CpCoefNG, tempRef=tempRef,molEnthalpyRef=molEnthalpyGRef, molGinitial=molVaporInitial,tempGinitial=tempVaporInitial); JARA2i.CaseStudies.Boiler.VirtualLab.water water( nComp=1,CpCoefMInitial=CpCoefML, massEnthalpyRefInitial = massEnthalpyLRef, tempRefInitial=tempRef,densityInitial=density, sectionInitial = sectionInitial, massLinitial=massWaterInitial,tempLinitial=tempWaterInitial); JARA2i.liq.vesselLiqB vessel( vesselVolumeInitial=vesselVolumeInitial); PhysicalModel.waterBoil boil( nComp=1,CpCoefML=CpCoefML,CpCoefNG=CpCoefNG,Kprop=Kprop, molecWeigth=molecWeigth,molEnthalpyGRef=molEnthalpyGRef, massEnthalpyLRef=massEnthalpyLRef,tempRef=tempRef); JARA2i.heat.sourceHeatFB heatSource( nComp=1); valve valveG( Kv=Kvalve,CpCoefN=CpCoefNG,molEnthalpyRef=molEnthalpyGRef, tempRef=tempRef); PhysicalModel.pressDownStream outValvePress( pressGinitial=pressDownStreamInitial, tempGinitial = tempDownStreamInitial, atm=true); JARA2i.liq.sourceVolLiqFB liqSource( nComp=1, densityInitial=density, CpCoefMInitial=CpCoefML,tempRefInitial=tempRef,pmax=1E8, pcodo=9.5E7,pmin=100, peps=50, massEnthalpyRefInitial = massEnthalpyLRef); sourceLiqCntrl sourceLiqCtrl; equation // Mass flow connect( vapor.inMol, boil.outMol); connect( water.inMassTop, boil.inMass); connect( vapor.inMol, valveG.inMol); connect( outValvePress.inMol, valveG.outMol); connect( liqSource.inMass, water.inMassBot); connect( vapor.constraintV, vessel.constraintV); connect( water.constraintV, vessel.constraintV); connect( liqSource.setPointSignal, sourceLiqCtrl.setPointSignal); connect(heatSource.inHeat, water.inHeat); // Volume constraint // Heat flow // Control signals end steamPowerBoiler;
Controller of the heat source
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Real | CpCoefN[nComp, 7] | Coefficients of the molar heat capacity at constant pressure CpMol[i] = CpCoefN[i,1] + CpCoefN[i,2]*T + ... + CpCoefN[i,7]*T**6 | |
Real | eps | 1.E-10 | Small constant to avoid by-zero division |
Real | molEnthalpyRef[nComp] | zeros(nComp) | Molar enthalpy of the components at the reference temperature [M.L2.t-2.mol-1] |
Real | tempRef | 298 | Reference temperature for enthalpy [T] |
Real | Kv | Valve parameter [mol.L.t.M-1] |
Type | Name | Description |
---|---|---|
cutGasR | inMol | Gas flow - Connector Resistive. |
cutGasR | outMol | Gas flow - Connector Resistive. |
cutHeatFC | inHeat | Heat flow - Connector F-C. Connector for the heat convection. |
cutEmitter | cutEmitter |
model valve "Valve" extends JARA2i.gas.convecGasFlowB(nComp=1); parameter Real Kv( unit="mol.L.t.M-1") "Valve parameter"; Real valveOpening( min=0, max=1, start=1, fixed=true) "Valve opening"; JARA2i.cutsB.cutEmitter cutEmitter(dim=1); equation der(valveOpening) = 0; cutEmitter.signal = {totalMolF}; // Valve constitutive relation totalMolF = if inMol.pressG > outMol.pressG then valveOpening * Kv * sqrt( abs( inMol.pressG * ( inMol.pressG - outMol.pressG))) else - valveOpening * Kv * sqrt( abs( outMol.pressG * ( outMol.pressG - inMol.pressG))); end valve;
Type | Name | Default | Description |
---|---|---|---|
Boolean | Ejs | true | Global variable - Runtime interactivity |
Boolean | Sysquake | false | Global variable - Batch interactivity |
Real | perfGasConst | 8.31 | Constant of the perfect gases [J/(mol*K)] |
Real | CpCoefML[1, 7] | [4.18E3, 0, 0, 0, 0, 0, 0] | Heat capacity per mass unit of the liquid. [Cp]: J/(Kg*K) |
Real | CpCoefNG[1, 7] | [55.486, 54.24E-3, 0, 0, 0, ... | Molar heat capacity, at constant pressure, of the vapor. [Cp]:J/(mol*K) |
Real | molecWeigth[:] | {18E-3} | Molecular weigth of the water [Kg/mol] |
Real | density[:] | {1E3} | Density of liquid water [Kg/m3] |
Real | molEnthalpyGRef[:] | {-241.8322E3} | Reference molar enthalpy of the vapor [J/mol] |
Real | massEnthalpyLRef[:] | {-15.88E6} | Reference enthalpy per mass unit of the liquid [J/Kg] |
Real | tempRef | 298 | Enthalpy reference temperature [K] |
Real | Kprop | 10 | Parameter of the boiling model [Kg/(s*K)] |
Real | Kvalve | (1.1E-7/molecWeigth[1]) | Valve coefficient [mol/(s*N/m**2)] |
Real | pressDownStreamInitial | 11 | Output pressure [N/m**2] |
Real | tempDownStreamInitial | 300 | Output temperature [K] |
Real | sectionInitial | 1 | Boiler cross-section [m2] |
Real | vesselVolumeInitial | 5.66 | Boiler volume [m3] |
Real | molVaporInitial[:] | {1273} | [mol] |
Real | tempVaporInitial | 463 | [K] |
Real | massWaterInitial[:] | {2200} | [Kg] |
Real | tempWaterInitial | 420 | [K] |
model controlledSystem "Controlled system + 2 PID controllers" extends steamPowerBoiler; auto.PIDLim pIDResistor( Tt0=1, samplePeriod0=1, Ti0=2.1, Td0=0.022, N0=1, Kp0=7e6, ulow0=0.00001, uhigh0=5e6); auto.PIDLim pIDWater( Tt0=1, samplePeriod0=1, Td0=0.1, Kp0=1, Ti0=9, ulow0=-0.02, uhigh0=0.02); SetPoint MolFSP(startSP=3.8); SetPoint waterSP(startSP=2); Switch switch; SetPoint heatFlow; SetPoint automatic; Switch switch1; SetPoint liqFlow(startSP=0); equation connect(valveG.cutEmitter, pIDResistor.yVarSignal); connect(switch.y, heatSource.setPointSignal); connect(water.cutEmitter, pIDWater.yVarSignal); connect(heatFlow.signal, switch.u3); connect(MolFSP.signal, pIDResistor.setPointSignal); connect(pIDWater.setPointSignal, waterSP.signal); connect(automatic.signal, switch1.u2); connect(switch.u2, automatic.signal); connect(switch.u1, pIDResistor.uVarSignal); connect(liqFlow.signal, switch1.u3); connect(pIDWater.uVarSignal, switch1.u1); connect(switch1.y, sourceLiqCtrl.cutReceiver); end controlledSystem;
Type | Name | Default | Description |
---|---|---|---|
Integer | dim | 1 | Number of components of the signal vector |
Real | startSP | 1 |
Type | Name | Description |
---|---|---|
cutEmitter | signal | Information |
model SetPoint "Set-point" extends JARA2i.interf.emitter1I; parameter Real startSP = 1; Real setPoint(start = startSP); equation signal.signal[1] = setPoint; der(setPoint) = 0; end SetPoint;
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Real | massLinitial[nComp] | Initial condition - Mass inside the CV [M] | |
Real | tempLinitial | Initial condition - Temperature of the CV [T] | |
Real | sectionInitial | 1 | Initial cross-section of the vessel [L2] |
Real | g | 9.8 | Gravitatorial acceleration [L.t-2] |
Real | angle | 1.5707963 | Angle with the horizontal [rad] |
Real | eps | 1.E-6 | Small constant to avoid by-zero division |
Real | CpCoefMInitial[nComp, 7] | Coefficients of the specific (per mass) heat capacity CpM[i] = CpCoefM[i,1] + CpCoefM[i,2]*T + ... + CpCoefM[i,7]*T**6 | |
Real | densityInitial[nComp] | Density of the pure components [M.L-3] | |
Real | massEnthalpyRefInitial[nComp] | zeros(nComp) | Specific (per mass) enthalpy at the reference temperature [L2.t-2] |
Real | tempRefInitial | 298 | Reference temperature for the enthalpy [T] |
Real | percentVolSmallStep | 0.9 | Proportion of the vessel volume that triggers the reduction in the integration step-size |
Real | compressCoef | 1.E-8 | Numeric compressibility coefficient [L.t2.M-1] |
Type | Name | Description |
---|---|---|
cutLiquidC | inMassTop | Connector for the liquid flow |
cutLiquidC | inMassBot | Connector for the liquid flow |
cutHeatMC | inHeat | Connector for the heat flow |
cutVolConstrLiq | constraintV | Connector for the volume constraint - Liquid |
cutEmitter | cutEmitter |
model water "Water CV" extends JARA2i.liq.liquidCp6B; JARA2i.cutsB.cutEmitter cutEmitter( dim = 1); equation cutEmitter.signal[1] = fluidV; end water;
model viewBoiler "Modelica description of the virtual-lab view" import VirtualLabBuilder; extends VirtualLabBuilder.VLabModels.PartialView( fileName = "boiler.java", Tcom = 0.05); Real deltaPipe; Real y0; Real h; VirtualLabBuilder.ViewElements.Containers.MainFrame mainFrame(Width=493, Height=770); VirtualLabBuilder.ViewElements.Drawables.Oval pumpTop(lineColorp={0,0,0,255}, fillColorp={0,0,0,255}, intCenter=1); VirtualLabBuilder.ViewElements.Containers.DrawingPanel drawingPanel( XMin=-8, XMax=8, YMin=-0.5, YMax=1.5); VirtualLabBuilder.ViewElements.Drawables.Polygon pumpBase( lineColorp={0,0,0,255}, fillColorp={0,0,0,255}, nPoints=4, intVertexesX={1,1,1,1}); VirtualLabBuilder.ViewElements.Drawables.Polygon boiler(filled="false", nPoints=8, intVertexesX=ones(8)); VirtualLabBuilder.ViewElements.Drawables.Polygon resistor( nPoints=15, filled="false", closed="false"); VirtualLabBuilder.ViewElements.Drawables.Polygon valveHandle( fillColorp={0,0,0,255}, nPoints=8, intVertexesX=ones(8)); VirtualLabBuilder.ViewElements.Drawables.Polygon valve(nPoints=4, fillColorp={0,0,0,255}, intVertexesX=ones(4)); VirtualLabBuilder.ViewElements.Drawables.Oval PID1(filled="true", fillColorp={255,255, 255,255}, intCenter=1); VirtualLabBuilder.ViewElements.Drawables.Oval PID2(filled="true", fillColorp={255,255, 255,255}, intCenter=1); VirtualLabBuilder.ViewElements.Containers.Panel panelNorth( LayoutPolicy="GridLayout", position="NORTH", nRows=2, nColumns=4); VirtualLabBuilder.ViewElements.InteractiveControls.Slider waterM( minimum=2000, maximum=10000, stringFormat="waterM(kg) = 0", tickFormat="0"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider waterT( minimum=270, maximum=800, tickFormat="0.0", stringFormat="waterT (K) = 0.0"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider pressure(stringFormat="pressure (atm) = 0.0", maximum=30, tickNumber=10); VirtualLabBuilder.ViewElements.InteractiveControls.Slider volume( minimum=1, stringFormat="Boiler volume (m^3) = 0.0", maximum=8); VirtualLabBuilder.ViewElements.InteractiveControls.Slider opening(stringFormat="opening = 0.00", tickFormat="0.0"); VirtualLabBuilder.ViewElements.BasicElements.Label label(text="Set Point", sizeOfFont=20, foreground={0,0,0,255}); VirtualLabBuilder.ViewElements.InteractiveControls.Slider vaporMol( stringFormat="vaporMol = 0", tickFormat="0", maximum=2000); VirtualLabBuilder.ViewElements.InteractiveControls.Slider gasTemp( stringFormat="gasTemp (K) = 0.0", minimum=270, maximum=800, tickFormat="0.0"); VirtualLabBuilder.ViewElements.Drawables.Polygon liquid( nPoints=6, lineColorp={0,0,255,255}, fillColorp={0,0,255,255}, intVertexesY={0,0,0,1,1,0}, intVertexesX=ones(6)); VirtualLabBuilder.ViewElements.InteractiveControls.Slider waterSP( maximum=3, tickFormat="0.0", stringFormat="waterSP(m^3) = 0.0"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider vaporMolSP( stringFormat="vaporMol = 0", tickFormat="0", minimum=0, maximum=20); VirtualLabBuilder.ViewElements.Drawables.Polygon line1( nPoints=4, filled="false", lineColorp={0,0,0,255}, closed="false", intVertexesX={1,0,0,0}); VirtualLabBuilder.ViewElements.Drawables.Polygon line2( nPoints=4, filled="false", closed="false", intVertexesX={1,0,0,0}); VirtualLabBuilder.ViewElements.Containers.Dialog dialog( yPosition=400, Width=390, LayoutPolicy="GridLayout", nRows=8, nColumns=2, Height=500, varName="ctrl", xPosition=493); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Kp1( minimum=0, stringFormat="Kp1 = 0", tickFormat="0", tickNumber=3, maximum=1e7); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Kp2( minimum=0, stringFormat="Kp2 = 0.0", tickFormat="0.0", tickNumber=10, maximum=2); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Ti1( stringFormat="Ti1= 0.0", tickFormat="0.0", minimum=1, maximum=10); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Ti2( minimum=1, maximum=10, stringFormat="Ti2 = 0.0", tickFormat="0.0"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Td1( stringFormat="Td1 = 0.0", tickFormat="0.0", maximum=100, tickNumber=3); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Td2(stringFormat="Td2 = 0.00"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider N1( stringFormat="N1 = 0", tickFormat="0.0", maximum=100, tickNumber=3); VirtualLabBuilder.ViewElements.InteractiveControls.Slider N2( stringFormat="N2 = 0", tickFormat="0.0", maximum=100, tickNumber=3); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Tt1( stringFormat="Tt1 = 0.0", maximum=100, tickFormat="0.0", tickNumber=3); VirtualLabBuilder.ViewElements.InteractiveControls.Slider Tt2( stringFormat="Tt2 = 0.0", tickFormat="0.0", maximum=100, tickNumber=3); VirtualLabBuilder.ViewElements.InteractiveControls.Slider B1( stringFormat="B1 = 0.0", tickFormat="0.0", maximum=2); VirtualLabBuilder.ViewElements.InteractiveControls.Slider B2( stringFormat="B2 = 0.0", tickFormat="0.0", maximum=2); VirtualLabBuilder.ViewElements.InteractiveControls.Slider ulow1( minimum=-10, maximum=0, tickFormat="0.0", stringFormat="ulow1=0.00"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider ulow2( maximum=1e6, stringFormat="ulow2 = 0", tickFormat="0", tickNumber=3); VirtualLabBuilder.ViewElements.InteractiveControls.Slider uhigh1( maximum=10, tickFormat="0.0", stringFormat="uhigh1 = 0.00"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider uhigh2( stringFormat="uhigh=0", minimum=0.1, maximum=1e7, tickFormat="0", tickNumber=3); VirtualLabBuilder.ViewElements.Drawables.Text C1text(textString="C1", intCenter=1); VirtualLabBuilder.ViewElements.Drawables.Text C2text(textString="C2", intCenter=1); VirtualLabBuilder.ViewElements.Drawables.Arrow arrow(intOrigin=1, intStroke=1); VirtualLabBuilder.ViewElements.InteractiveControls.RadioButton automatic(text="automatic"); VirtualLabBuilder.ViewElements.InteractiveControls.RadioButton manual(buttonValue="false", text= "manual"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider heatFlow( tickFormat="0", tickNumber=3, maximum=1e7, stringFormat="heatFlow (W) = 0"); VirtualLabBuilder.ViewElements.InteractiveControls.Slider liqFlow( minimum=-0.02, maximum=0.02, tickNumber=3, stringFormat="liquid (m^3/s) = 0.0"); VirtualLabBuilder.ViewElements.Containers.Panel panelSouth( LayoutPolicy="GridLayout", nColumns=2, nRows=5); VirtualLabBuilder.ViewElements.Containers.Dialog dialog1( LayoutPolicy="GridLayout", nRows=2, nColumns=2, Width=600, Height=600, varName="plots", xPosition=493); VirtualLabBuilder.ViewElements.Containers.PlottingPanel plottingPanel( autoScaleY="false", titleX="time (s)", title="Total molar flow (mols/s)", maxY=8); VirtualLabBuilder.ViewElements.Containers.PlottingPanel plottingPanel1( autoScaleY="false", maxY=3, title="Liquid Volume ( m**3 )"); VirtualLabBuilder.ViewElements.Containers.PlottingPanel plottingPanel2( autoScaleY="false", minY=-1e6, maxY=6e6, title="Heat Flow (J/s)", titleX="time (s)"); VirtualLabBuilder.ViewElements.Containers.PlottingPanel plottingPanel3( autoScaleY="false", minY=-5, title="Total mass flow (Kg/s)", maxY=30); VirtualLabBuilder.ViewElements.Drawables.Trail trailMol(nSkip=1); VirtualLabBuilder.ViewElements.Drawables.Trail trailMolSP(lineColor={255,0,0,255}, nSkip=1); VirtualLabBuilder.ViewElements.Drawables.Trail trailFluid(nSkip=1); VirtualLabBuilder.ViewElements.Drawables.Trail trailFluidSP(lineColor={255,0,0,255}, nSkip=1); VirtualLabBuilder.ViewElements.Drawables.Trail trailHeat(nSkip=1); VirtualLabBuilder.ViewElements.Drawables.Trail trailMass(nSkip=1); VirtualLabBuilder.ViewElements.BasicElements.CheckBox checkBox(varName="ctrl", label= "control param. "); VirtualLabBuilder.ViewElements.BasicElements.CheckBox checkBox1(label="Show plots", varName="plots"); VirtualLabBuilder.ViewElements.BasicElements.PauseButton pauseButton; VirtualLabBuilder.ViewElements.BasicElements.InfoButton infoButton(path= "D:\\ModelicaLibraries\\JARA\\boilerIntroduction.html", image= "D:\\ModelicaLibraries\\JARA\\boilerIntroduction_archivos\\info.jpgl"); equation resistor.x[1] = 0.6; resistor.y[1] = -0.1; resistor.x[2] = 0.6; resistor.y[2] = 0; resistor.x[3] = 0.5414; resistor.y[3] =0.1414; resistor.x[4] = 0.4; resistor.y[4] = 0.2; resistor.x[5] = 0.2586; resistor.y[5] = 0.1414; resistor.x[6] = 0.2; resistor.y[6] = 0; resistor.x[7] = 0.1414; resistor.y[7] = 0.1414; resistor.x[8] = 0; resistor.y[8] = 0.2; resistor.x[9] = -0.1414; resistor.y[9] = 0.1414; resistor.x[10] = -0.2; resistor.y[10] = 0; resistor.x[11] = -0.2586; resistor.y[11] = 0.1414; resistor.x[12] = -0.4; resistor.y[12] = 0.2; resistor.x[13] = -0.5414; resistor.y[13] =0.1414; resistor.x[14] = -0.6; resistor.y[14] = 0; resistor.x[15] = -0.6; resistor.y[15] = -0.1; y0 = (2)/4-0.5; h = 1; deltaPipe = (h-y0)*0.2; boiler.y[1] = y0; boiler.y[2] = y0 + deltaPipe/2; boiler.y[3] = boiler.y[2]; boiler.y[4] = y0+h; boiler.y[5] = boiler.y[4]; boiler.y[6] = boiler.y[5]-deltaPipe/2; boiler.y[7] = boiler.y[6]; boiler.y[8] = boiler.y[1]; liquid.y[1] = boiler.y[1]; liquid.y[2] = boiler.y[2]; liquid.y[3] = boiler.y[3]; liquid.y[6] = boiler.y[8]; pumpTop.Center[2] = y0+deltaPipe/2; pumpTop.Axes[1] = 3*deltaPipe; pumpTop.Axes[2] = 1.5*deltaPipe; pumpBase.y[1] = y0-deltaPipe/2; pumpBase.y[2] = y0; pumpBase.y[3] = pumpBase.y[2]; pumpBase.y[4] = pumpBase.y[1]; PID1.Center[1] = -5; PID1.Center[2] = 0.5; PID1.Axes[1] = 1; PID1.Axes[2] = 0.15; PID2.Center[1] = 5; PID2.Center[2] = 0.5; PID2.Axes[1] = 1; PID2.Axes[2] = 0.15; C1text.Center[1] = PID1.Center[1]; C2text.Center[1] = PID2.Center[1]; C1text.Center[2] = PID1.Center[2]*0.95; C2text.Center[2] = PID2.Center[2]*0.95; valveHandle.y[1] = y0+h-deltaPipe/8; valveHandle.y[2] = y0+h+deltaPipe/4+deltaPipe/4; valveHandle.y[3] = valveHandle.y[2]; valveHandle.y[4] = valveHandle.y[3] + deltaPipe/4+deltaPipe/4; valveHandle.y[5] = valveHandle.y[4]; valveHandle.y[6] = valveHandle.y[3]; valveHandle.y[7] = valveHandle.y[6]; valveHandle.y[8] = valveHandle.y[1]; valve.y[1] =h-deltaPipe-deltaPipe*0.1+deltaPipe/4; valve.y[2] = h+deltaPipe*0.1+deltaPipe/4; valve.y[3] = valve.y[1]; valve.y[4] = valve.y[2]; arrow.stroke = 5; connect(root.cLLeft, mainFrame.pLLeft); connect(mainFrame.cLLeft, dialog.pLLeft); connect(dialog.cLLeft, dialog1.pLLeft); connect(mainFrame.cLRight, drawingPanel.pLLeft); connect(drawingPanel.cRight, line1.pLeft); connect(line1.cLeft, line2.pLeft); connect(line2.cLeft, pumpBase.pLeft); connect(pumpBase.cLeft, liquid.pLeft); connect(liquid.cLeft, boiler.pLeft); connect(boiler.cLeft, valveHandle.pLeft); connect(valveHandle.cLeft, valve.pLeft); connect(valve.cLeft, PID1.pLeft); connect(PID1.cLeft, PID2.pLeft); connect(PID2.cLeft, resistor.pLeft); connect(resistor.cLeft, pumpTop.pLeft); connect(pumpTop.cLeft, C1text.pLeft); connect(C1text.cLeft, C2text.pLeft); connect(C2text.cLeft, arrow.pLeft); connect(panelNorth.cLRight, checkBox.pLLeft); connect(checkBox.cLLeft, automatic.pLLeft); connect(manual.cLLeft, checkBox1.pLLeft); connect(checkBox1.cLLeft, heatFlow.pLLeft); connect(heatFlow.cLLeft, liqFlow.pLLeft); connect(liqFlow.cLLeft, pauseButton.pLLeft); connect(pauseButton.cLLeft, infoButton.pLLeft); connect(pressure.pLLeft, panelSouth.cLRight); connect(pressure.cLLeft, volume.pLLeft); connect(volume.cLLeft, opening.pLLeft); connect(opening.cLLeft, waterM.pLLeft); connect(waterM.cLLeft, label.pLLeft); connect(waterT.cLLeft, waterSP.pLLeft); connect(waterSP.cLLeft, vaporMol.pLLeft); connect(vaporMol.cLLeft, vaporMolSP.pLLeft); connect(gasTemp.pLLeft, vaporMolSP.cLLeft); connect(label.cLLeft, waterT.pLLeft); connect(plottingPanel.cRight, trailMol.pLeft); connect(trailMol.cLeft, trailMolSP.pLeft); connect(plottingPanel1.cRight, trailFluid.pLeft); connect(trailFluid.cLeft, trailFluidSP.pLeft); connect(plottingPanel2.cRight, trailHeat.pLeft); connect(plottingPanel3.cRight, trailMass.pLeft); connect(dialog1.cLRight, plottingPanel.pLLeft); connect(plottingPanel.cLLeft, plottingPanel1.pLLeft); connect(plottingPanel1.cLLeft, plottingPanel2.pLLeft); connect(plottingPanel2.cLLeft, plottingPanel3.pLLeft); connect(drawingPanel.cLLeft, panelNorth.pLLeft); connect(panelNorth.cLLeft, panelSouth.pLLeft); connect(dialog.cLRight, Kp1.pLLeft); connect(Kp1.cLLeft, Kp2.pLLeft); connect(Kp2.cLLeft, Ti1.pLLeft); connect(Ti1.cLLeft, Ti2.pLLeft); connect(Ti2.cLLeft, Td1.pLLeft); connect(Td1.cLLeft, Td2.pLLeft); connect(Td2.cLLeft, N1.pLLeft); connect(N1.cLLeft, N2.pLLeft); connect(N2.cLLeft, Tt1.pLLeft); connect(Tt1.cLLeft, Tt2.pLLeft); connect(Tt2.cLLeft, B1.pLLeft); connect(B1.cLLeft, B2.pLLeft); connect(B2.cLLeft, ulow1.pLLeft); connect(ulow1.cLLeft, ulow2.pLLeft); connect(ulow2.cLLeft, uhigh1.pLLeft); connect(uhigh1.cLLeft, uhigh2.pLLeft); connect(automatic.cLLeft, manual.pLLeft); end viewBoiler;
model Interactive "Modelica description of the virtual-lab" VirtualLabBuilder.VLabModels.VirtualLab interactive(redeclare model ViewI = viewBoiler, redeclare model ModelI = controlledSystem, fileName="boiler.java", Tcom=0.05); Real manual; equation interactive.View.boiler.x[1] = -interactive.Model.vessel.vesselVolume/2-5*interactive.View.deltaPipe; interactive.View.boiler.x[2] = interactive.View.boiler.x[1]; interactive.View.boiler.x[3] = -interactive.Model.vessel.vesselVolume/2; interactive.View.boiler.x[4] = interactive.View.boiler.x[3]; interactive.View.boiler.x[5] = -interactive.View.boiler.x[1]; interactive.View.boiler.x[6] = interactive.View.boiler.x[5]; interactive.View.boiler.x[7] = interactive.Model.vessel.vesselVolume/2; interactive.View.boiler.x[8] = interactive.View.boiler.x[7]; interactive.View.arrow.Origin[1] = interactive.View.boiler.x[3]-1; interactive.View.arrow.Origin[2] = interactive.Model.waterSP.setPoint/interactive.View.h/interactive.Model.vessel.vesselVolume+interactive.View.boiler.y[1]; interactive.View.arrow.Length[1] = 1; interactive.View.arrow.Length[2] = 0; interactive.View.line1.x[1] = interactive.View.boiler.x[3]; interactive.View.line1.x[2] = interactive.View.PID1.Center[1]; interactive.View.line1.x[3] = interactive.View.line1.x[2]; interactive.View.line1.x[4] = interactive.View.pumpTop.Center[1]; interactive.View.line1.y[1] = interactive.View.h/2; interactive.View.line1.y[2] =interactive.View.line1.y[1]; interactive.View.line1.y[3] = interactive.View.pumpTop.Center[2]; interactive.View.line1.y[4] = interactive.View.line1.y[3]; interactive.View.line2.x[1] = interactive.View.valveHandle.x[2]; interactive.View.line2.x[2] = interactive.View.PID2.Center[1]; interactive.View.line2.x[3] = interactive.View.line2.x[2]; interactive.View.line2.x[4] = interactive.View.resistor.x[1]; interactive.View.line2.y[1] = interactive.View.valveHandle.y[2]; interactive.View.line2.y[2] =interactive.View.line2.y[1]; interactive.View.line2.y[3] = interactive.View.resistor.y[1]; interactive.View.line2.y[4] = interactive.View.line2.y[3]; interactive.View.liquid.x[1] = interactive.View.boiler.x[1]; interactive.View.liquid.x[2] = interactive.View.boiler.x[2]; interactive.View.liquid.x[3] = interactive.View.boiler.x[3]; interactive.View.liquid.x[4] = interactive.View.boiler.x[3]; interactive.View.liquid.x[5] = interactive.View.boiler.x[7]; interactive.View.liquid.x[6] = interactive.View.boiler.x[8]; interactive.View.liquid.y[4] = interactive.Model.water.fluidV/interactive.View.h/interactive.Model.vessel.vesselVolume; interactive.View.liquid.y[5] = interactive.View.liquid.y[4]; interactive.View.pumpTop.Center[1] = interactive.View.boiler.x[1]; interactive.View.pumpBase.x[1] = interactive.View.boiler.x[1]-interactive.View.deltaPipe*1.4; //Corregir interactive.View.pumpBase.x[2] = interactive.View.boiler.x[1]-1.1*interactive.View.deltaPipe/2; interactive.View.pumpBase.x[3] = interactive.View.boiler.x[1]+1.1*interactive.View.deltaPipe/2; //Corregir interactive.View.pumpBase.x[4] = interactive.View.boiler.x[1]+interactive.View.deltaPipe*1.4; interactive.View.valveHandle.x[1] = interactive.View.boiler.x[7]+2*interactive.View.deltaPipe; //Corregir interactive.View.valveHandle.x[2] = interactive.View.valveHandle.x[1]; interactive.View.valveHandle.x[3] = interactive.View.boiler.x[7]+1.7*interactive.View.deltaPipe; //Corregir interactive.View.valveHandle.x[4] = interactive.View.valveHandle.x[3]; interactive.View.valveHandle.x[5] = interactive.View.boiler.x[7]+2.3*interactive.View.deltaPipe; //Corregir interactive.View.valveHandle.x[6] = interactive.View.valveHandle.x[5]; interactive.View.valveHandle.x[7] = interactive.View.boiler.x[7]+2.0*interactive.View.deltaPipe; //Corregir interactive.View.valveHandle.x[8] = interactive.View.valveHandle.x[7]; interactive.View.valve.x[1] = interactive.View.boiler.x[7]+1*interactive.View.deltaPipe; //Corregir interactive.View.valve.x[2] = interactive.View.boiler.x[7]+3*interactive.View.deltaPipe; interactive.View.valve.x[3] = interactive.View.valve.x[2]; //Corregir interactive.View.valve.x[4] = interactive.View.valve.x[1]; interactive.View.pressure.var = interactive.Model.outValvePress.pressG; interactive.View.volume.var = interactive.Model.vessel.vesselVolume; interactive.View.opening.var = interactive.Model.valveG.valveOpening; interactive.View.waterM.var = interactive.Model.water.massL[1]; interactive.View.waterT.var = interactive.Model.water.tempL; interactive.View.vaporMolSP.var = interactive.Model.MolFSP.setPoint; interactive.View.vaporMol.var = interactive.Model.vapor.molG[1]; interactive.View.gasTemp.var = interactive.Model.vapor.tempG; interactive.View.waterSP.var = interactive.Model.waterSP.setPoint; interactive.View.Kp1.var = interactive.Model.pIDResistor.Kp; interactive.View.Kp2.var = interactive.Model.pIDWater.Kp; interactive.View.Ti1.var = interactive.Model.pIDResistor.Ti; interactive.View.Ti2.var = interactive.Model.pIDWater.Ti; interactive.View.Td1.var = interactive.Model.pIDResistor.Td; interactive.View.Td2.var = interactive.Model.pIDWater.Td; interactive.View.N1.var = interactive.Model.pIDResistor.N; interactive.View.N2.var = interactive.Model.pIDWater.N; interactive.View.Tt1.var = interactive.Model.pIDResistor.Tt; interactive.View.Tt2.var = interactive.Model.pIDWater.Tt; interactive.View.B1.var = interactive.Model.pIDResistor.B; interactive.View.B2.var = interactive.Model.pIDWater.B; interactive.View.ulow1.var = interactive.Model.pIDResistor.ulow; interactive.View.ulow2.var = interactive.Model.pIDWater.ulow; interactive.View.uhigh1.var = interactive.Model.pIDResistor.uhigh; interactive.View.uhigh2.var = interactive.Model.pIDWater.uhigh; interactive.View.automatic.var = interactive.Model.automatic.setPoint; interactive.View.manual.var = manual; interactive.View.heatFlow.var = interactive.Model.heatFlow.setPoint; interactive.View.liqFlow.var = interactive.Model.liqFlow.setPoint; interactive.View.trailMol.point = {time, interactive.Model.valveG.totalMolF}; interactive.View.trailMolSP.point = {time, interactive.Model.MolFSP.setPoint}; interactive.View.trailFluid.point = {time, interactive.Model.water.fluidV}; interactive.View.trailFluidSP.point = {time, interactive.Model.waterSP.setPoint}; interactive.View.trailHeat.point = {time, interactive.Model.heatSource.heatFSP}; interactive.View.trailMass.point = {time, interactive.Model.liqSource.totalMassF}; der(manual) = 0; end Interactive;
The Logical.Switch switches, depending on the logical connector u2 (the middle connector) between the two possible input signals u1 (upper connector) and u3 (lower connector).
If u2 is true, the output signal y is set equal to u1, else it is set equal to u3.
Type | Name | Description |
---|---|---|
cutReceiver | u1 | |
cutReceiver | u2 | |
cutReceiver | u3 | |
cutEmitter | y |
model Switch "Switch between two Real signals" JARA2i.cutsB.cutReceiver u1( dim = 1); JARA2i.cutsB.cutReceiver u2( dim = 1); JARA2i.cutsB.cutReceiver u3( dim = 1); JARA2i.cutsB.cutEmitter y( dim = 1); equation y.signal[1] = if u2.signal[1]>0.5 then u1.signal[1] else u3.signal[1]; end Switch;