LBL logo

Buildings.Examples.VAVReheat.Controls.Examples

Example models to test the components

Information

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

NameDescription
Buildings.Examples.VAVReheat.Controls.Examples.BusUsage BusUsage Demonstrates the usage of a signal bus
Buildings.Examples.VAVReheat.Controls.Examples.OperationModes OperationModes Test model for operation modes


Buildings.Examples.VAVReheat.Controls.Examples.BusUsage Buildings.Examples.VAVReheat.Controls.Examples.BusUsage

Demonstrates the usage of a signal bus

Buildings.Examples.VAVReheat.Controls.Examples.BusUsage

Information

Signal bus concept

In technical systems, such as vehicles, robots or satellites, many signals are exchanged between components. In a simulation system, these signals are usually modelled by signal connections of input/output blocks. Unfortunately, the signal connection structure may become very complicated, especially for hierarchical models.

The same is also true for real technical systems. To reduce complexity and get higher flexibility, many technical systems use data buses to exchange data between components. For the same reasons, it is often better to use a "signal bus" concept also in a Modelica model. This is demonstrated at hand of this model (Modelica.Blocks.Examples.BusUsage):

The control and sub-control bus icons are provided within Modelica.Icons. In Modelica.Blocks.Examples.BusUsage_Utilities.Interfaces the buses for this example are defined. Both the "ControlBus" and the "SubControlBus" are expandable connectors that do not define any variable. For example, Interfaces.ControlBus is defined as:

  expandable connector ControlBus
      extends Modelica.Icons.ControlBus;
      annotation (Icon(Rectangle(extent=[-20, 2; 22, -2],
                       style(rgbcolor={255,204,51}, thickness=0.5))));
  end ControlBus;

Note, the "annotation" in the connector is important since the color and thickness of a connector line are taken from the first line element in the icon annotation of a connector class. Above, a small rectangle in the color of the bus is defined (and therefore this rectangle is not visible). As a result, when connecting from an instance of this connector to another connector instance, the connecting line has the color of the "ControlBus" with double width (due to "thickness=0.5").

An expandable connector is a connector where the content of the connector is constructed by the variables connected to instances of this connector. For example, if "sine.y" is connected to the "controlBus", the following menu pops-up in Dymola:

The "Add variable/New name" field allows the user to define the name of the signal on the "controlBus". When typing "realSignal1" as "New name", a connection of the form:

     connect(sine.y, controlBus.realSignal1)

is generated and the "controlBus" contains the new signal "realSignal1". Modelica tools may give more support in order to list potential signals for a connection. For example, in Dymola all variables are listed in the menu that are contained in connectors which are derived by inheritance from "controlBus". Therefore, in BusUsage_Utilities.Interfaces.InternalConnectors the expected implementation of the "ControlBus" and of the "SubControlBus" are given. For example "Internal.ControlBus" is defined as:

  expandable connector StandardControlBus
    extends BusUsage_Utilities.Interfaces.ControlBus;

    import SI = Modelica.SIunits;
    SI.AngularVelocity    realSignal1   "First Real signal";
    SI.Velocity           realSignal2   "Second Real signal";
    Integer               integerSignal "Integer signal";
    Boolean               booleanSignal "Boolean signal";
    StandardSubControlBus subControlBus "Combined signal";
  end StandardControlBus;

Consequently, when connecting now from "sine.y" to "controlBus", the menu looks differently:

Note, even if the signals from "Internal.StandardControlBus" are listed, these are just potential signals. The user might still add different signal names.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model BusUsage "Demonstrates the usage of a signal bus"
  extends Modelica.Icons.Example;
public 
  Modelica.Blocks.Sources.IntegerStep integerStep(
    height=1,
    offset=2,
    startTime=0.5);
  Modelica.Blocks.Sources.BooleanStep booleanStep(startTime=0.5);
  Modelica.Blocks.Sources.Sine sine;
  Modelica.Blocks.Examples.BusUsage_Utilities.Part part;
  Modelica.Blocks.Math.Gain gain;
protected 
  Modelica.Blocks.Examples.BusUsage_Utilities.Interfaces.ControlBus controlBus;
equation 
  connect(booleanStep.y, controlBus.booleanSignal);
  connect(integerStep.y, controlBus.integerSignal);
  connect(part.subControlBus, controlBus.subControlBus);
  connect(sine.y, controlBus.test);
  connect(controlBus.test, gain.u);
end BusUsage;

Buildings.Examples.VAVReheat.Controls.Examples.OperationModes Buildings.Examples.VAVReheat.Controls.Examples.OperationModes

Test model for operation modes

Buildings.Examples.VAVReheat.Controls.Examples.OperationModes

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Connectors

TypeNameDescription
ControlBuscontrolBus 

Modelica definition

model OperationModes "Test model for operation modes"
    extends Modelica.Icons.Example;
  import ModelicaVAV = Buildings.Examples.VAVReheat;
  ModelicaVAV.Controls.ModeSelector operationModes;
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo;
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixTem(T=273.15);
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor cap(C=20000);
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor con(G=1);
  Modelica.Blocks.Logical.Switch switch1;
  Modelica.Blocks.Sources.Constant on(k=200);
  Modelica.Blocks.Sources.Constant off(k=0);
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor;
  Modelica.Blocks.Sources.RealExpression TRooSetHea(y=if mode.y == ModelicaVAV.Controls.OperationModes.occupied then 
              293.15 else 287.15);
  Modelica.Blocks.Sources.Constant TCoiHea(k=283.15) 
    "Temperature after heating coil";
  ModelicaVAV.Controls.ControlBus controlBus;
  Modelica.Blocks.Routing.IntegerPassThrough mode "Outputs the control mode";
  Modelica.Blocks.Sources.BooleanExpression modSel(y=mode.y == ModelicaVAV.Controls.OperationModes.unoccupiedNightSetBack
         or mode.y == ModelicaVAV.Controls.OperationModes.unoccupiedWarmUp);
  Modelica.Blocks.Sources.Constant TOut(k=283.15) "Outside temperature";
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temperatureSensor1;
  Modelica.Blocks.Sources.BooleanExpression modSel1(y=mode.y == ModelicaVAV.Controls.OperationModes.occupied);
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaFlo1;
  Buildings.Controls.Continuous.LimPID PID;
  Modelica.Blocks.Logical.Switch switch2;
  Modelica.Blocks.Math.Gain gain(k=200);
  Buildings.Controls.SetPoints.OccupancySchedule occSch "Occupancy schedule";
equation 
  connect(fixTem.port, con.port_a);
  connect(preHeaFlo.port, cap.port);
  connect(con.port_b, cap.port);
  connect(switch1.y, preHeaFlo.Q_flow);
  connect(on.y, switch1.u1);
  connect(off.y, switch1.u3);
  connect(cap.port, temperatureSensor.port);
  connect(controlBus, operationModes.cb);
  connect(temperatureSensor.T, controlBus.TRooMin);
  connect(TCoiHea.y, controlBus.TCoiHeaOut);
  connect(controlBus.controlMode, mode.u);
  connect(modSel.y, switch1.u2);
  connect(TOut.y, controlBus.TOut);
  connect(cap.port, temperatureSensor1.port);
  connect(temperatureSensor1.T, controlBus.TRooAve);
  connect(TRooSetHea.y, PID.u_s);
  connect(temperatureSensor.T, PID.u_m);
  connect(modSel1.y, switch2.u2);
  connect(off.y, switch2.u3);
  connect(preHeaFlo1.port, cap.port);
  connect(PID.y, switch2.u1);
  connect(gain.y, preHeaFlo1.Q_flow);
  connect(switch2.y, gain.u);
  connect(occSch.tNexOcc, controlBus.dTNexOcc);
  connect(TRooSetHea.y, controlBus.TRooSetHea);
  connect(occSch.occupied, controlBus.occupied);
end OperationModes;

Automatically generated Wed Feb 22 15:29:47 2012.