imagine that we have 3 inputs from keyboard: temperature,humidity and the amount of ammoniac gas that insert from the operator and also we measure the temperature,humidity and the amount of ammonic gas from sensors.
,for example we have 5 fans,2 heaters and 3 cooler
variables: temp1,humid1 and gas1 that insert form keyboard with operator
temp2,humid2 and gas2 are the variables the measures from the sensors.
we use fan1,fan3 and fann5 for adjust temperature, fan2 and fan 4 for humidity.
algorithm:
if temp2 > (temp1+2) then put fan1 in high revolution
fan2 in high revolution
fan3 in high revolution
heather 1 and 2 OFF
cooler 1,2 and 3 OFF
if temp2 > (temp1+5) then put fan1,3 and 5 in high revolution
heather 1 and 2 OFF
cooler 1,2 and 3 ON
if temp2 < (temp1-2) then put fan3 OFF
fan 1 and 5 in low revolution
heather 1 and 2 OFF
cooller 1,2 and 3 OFF
if temp2 < (temp1-5) then put fan3 OFF
fan 1 and 5 in low revolution
heather 1 and 2 ON
cooler 1,2 and 3 OFF
if (temp1-2) < temp2 < (temp1+2) then put fan 1 and 5 in low revolution
fan3 in high revolution
heather 1 and 2 OFF
cooler 1,2 and 3 OFF
if humid2 > (humid1+2) then put fan2 and 4 in high revolution
if humid2 < (humid1-2) ten put fan2 and 4 OFF
if (humid1-2) < humid2 < (humid1+2) then put fan 2 and 4 in low revolution
if gas2 > (gas1+40) then ALARM
fans 1,2,3,4 and 5 in high revolution
if temp2 > (temp1+10) then ALARM
if temp2 < (temp1-10) then ALARM
if humid2 > (humid1+10) then ALARM