The system has two states, heating and cooling, as shown in the figure below. In the heating state, the temperature of the room is increased linearly,
dx/dt = 1
where x
is temperature.
In the cooling state, the temperature is dropped linearly, i.e.
dx/dt = -1
The control rule is that if the temperature reaches 0.2 degree, then switch
the controller to the cooling state; if the temperature decreases to 0 degree
then switch the controller to the heating state.
We use this example to illustrate the accuracy of detecting events, and the
ability to simulate hybrid systems in Ptolemy II. In particular, the
time at which the temperature thresholds are detected is precise,
irrespective of the underlying simulation sample rate.
The simulator will iterate if necessary, and backtrack if necessary,
to accurately determine the time at which events occur.