This part of the system model changes the implementation of the control in Buildings.Examples.Tutorial.Boiler.System6 to use a state machine to switch the pumps and the boiler on and off. State machines provide an alternate way to implement discrete event, reactive and hybrid systems. The state machine that is implemented in this model is shown in the figure below.


In the figure above, the ovals depict states, and the arrows are transitions between the states. The transitions fire when the conditions are true.


This model was built as follows:

  1. First, we copied the model Buildings.Examples.Tutorial.Boiler.System6 and called it Buildings.Examples.Tutorial.Boiler.System7.

  2. We implemented the state machine using blocks from the library Modelica.StateGraph. How to use these blocks is explained in Modelica.StateGraph.UsersGuide.

    The figure below shows the state machine. The square icons are states, and the black bars are transitions. The initial state is indicated by the double frame. The transitions are enabled when their input signal is true. The numbers to the right of the transition indicate the delay in seconds. If a delay is present, the input needs to be true during the entire duration of the delay for a transition to fire. The active state is rendered green. Some states have a Boolean output signal that is used to switch components such as the pumps and the boiler on or off.


    In our implementation, the state allOff is the initial state, indicated by its double frame. The transition T1 is used to switch the pumps on. Once the pumpsOn state is active, there are two alternate paths. Either transition T2 may fire, which would switch the boiler on, or T4 may fire, which would return to the allOff state. Hence, the boiler can only be on when the pumps are on. From the state boilerOn, the only next step can be to transition to the state pumpsOn. Note that the transitions T3 and T4 only fire when their input is true for the entire duration of 10 seconds. Hence, the pumps and the boiler must run for at least 10 seconds before they can be switched off.

When simulating the model for 2 days, or 172800 seconds, the response shown below should be seen.

image image


MediumWMedium model


Generated at 2024-07-21T18:15:58Z by OpenModelicaOpenModelica 1.23.1 using GenerateDoc.mos