Temperature controller of a pig shed

Simulink model

The system under control is a pig shed equipped with a fan and a heater to regulate the air temperature. Air temperature in the shed is subjected to random variations due to the variation of external temperature and the variation of the number of pigs that produce heat. The objective of the controller is to counter these variations such that the temperature remains within a given comfort zone. To do so, the controller can activate the heater to increase the temperature, and the fan to bring external air and therefore cool the shed. Then the temperature T of the shed is given by the following differential equation:
Latex formula

where Latex formula is the external temperature, Latex formula is the air flow created by a minimal flow  Latex formula, and an additional flow Latex formula when the fan is activated, Latex formula is the heat produced by the heater, when activated, and Latex formula is the heat produced by the pigs. This equation is modeled by the following Simulink subsystem:

equa_diff

Simulink model of the differential equation controlling the temperature

The number of pigs is determined every 500 time units according to a Poisson law with Latex formula. The external temperature is modulated by two sinusoidal between Latex formula and Latex formula, with periods 628 t.u and 62.8 t.u.

pig_curve

Example of distribution for the number of pigs

ext_temp_2000

Variation of the external temperature over a 2000 t.u. period

The controller that we study applies a bang-bang strategy that is specified by four threshold:

  • When the temperature goes above Latex formula, the fan is turned on.
  • When the temperature returns below Latex formula, the fan is turned off.
  • When the temperature goes below Latex formula, the heater is turned on.
  • When the temperature returns above Latex formula, the heater is turned off.

This controller is implemented by the following Stateflow automata:

Temperature controller

Temperature controller

The fan and the heater are subjected to random failures when they are in used. Exponential distributions control the occurrence time of a failure. After a failure a reparation process allows to restart the fan or the heater, but it also takes a random time, exponentially distributed. These failures are modelled by two Stateflow automata:

failure_crop

Failure generators for the fan and the heater

In this automaton, Latex formula is a random number between 0 and 1, and Latex formula is the duration of use of the fan or heater. The timings Latex formula and Latex formula corresponds respectively to the time of next failure, and the repaire time, each chosen according to an exponantial distribution with parameter Latex formula and Latex formula, respectively.

Verification

The controller objective is to maintain the temperature within a comfort zone specified by a minimum and a maximun temperature (resp. Latex formula and Latex formula). In this section we consider the following values for the controller thresholds: Latex formula, Latex formulaLatex formula and Latex formula.We apply statistical model-checking to evaluate the efficiency of the controller both in the presence and absence of failures.

The first BLTL property that we monitor checks that the system is not in discomfort for an excessive period of time. This is expressed by the following property:

Latex formula
where Latex formula is the simulation time, Latex formula is the accepted discomfort time, and Latex formula is a predicate that is true when the temperature of the system is outside the comfort zone.
A second BLTL property checks that each period of discomfort is followed by a period without discomfort:
Latex formula
Here Latex formula and Latex formula are as previously, while Latex formula is the expected time at which the system returns to normal situation and Latex formula is the duration of the period without discomfort.

We use PlasmaLab statistical model-checker to estimate the probability to satisfy these properties for different values of the timing constraints. Each property is evaluated over a period of time Latex formula with 100 simulations. Latex formula is evaluated for several values of Latex formula and Latex formula is evaluated with Latex formula and Latex formula and several values of Latex formula.

Without failure With failures
Latex formula Latex formula
Latex formula
Latex formula
0.87
0.99
1.0
0.01
0.23
0.78
Latex formula Latex formula
Latex formula
0.95
0.9
0.57
0.08

Optimisation

We want to optimise the performances of the system such that it minimizes the discomfort and the energy cost spent in heating and cooling. To achieve this we can manipulates the 4 temperature thresholds of the controller. Each threshold is therefore assigned to a range of values. The product of these values gives a set of initial conditions to analyse the system. PlasmaLab can evaluate the values of the cost and the discomfort for each of these values. We can then select the best values of the parameters  according to the pareto curve:

results

Comments are closed.