Here we made a function block for three room controllers. One regulates the temperature (TemperatureRoomController), the next regulates humidity level (MoistureRoomRegulator), and the last regulates CO² level (CO2RoomRegulator). All are built the same way, so we put them on the same page. The idea was to set different PID parameters for them, so they are each a different block. If you have many temperature sensors that all should have the same regulation parameters, you don't have to put them into each block. That's why we did it this way.

Since we were missing all physical components, there is just an input that simulates a value. Here you can, for example, set a temperature to 25.6°C, and the controller uses this as if it was the actual temperature sensor. Furthermore, you can set a MIN and MAX limit for all values, and the block will give an alarm if the temperature exceeds or goes below these values. Additionally, there is, of course, a setpoint, which the controller will regulate to. The block then gives out the desired output from the controller. The principle is the same for all controllers.


INPUT - (Example TemperatureRoomController)

  • MAXTemp → REAL
  • MINTemp → REAL
  • Setpoint → REAL
  • TemperatureIN → REAL

OUTPUT- (Example TemperatureRoomController)

  • AlarmHigh → BOOL
  • AlarmLow → BOOL
  • ProcessOut → REAL
  • TemperatureOUT → REAL

Intern Variables - (Example TemperatureRoomController)

  • Kp → REAL
  • Ki → REAL 
  • Kd → REAL
  • Integral → REAL
  • PrevError → REAL
  • DeltaTime → REAL
  • PID_Output → REAL
  • Error → REAL
  • Derivative → REAL;


CODED SOLUTION 

Variable Decleration - (Example TemperatureRoomController)

CODE - (Example TemperatureRoomController)






  • No labels