In order to simulate the function block for the temperature sensor, a global variable list is created. It contained the following variables,

  •  sensor_read:REAL;


  •  set_point_in_c:REAL;


  • alarm_delay:TIME:=T#2S;


  • alarm_dead_zone:REAL:=1;


  • max_temp:REAL:=200;


  • max_temp_in_volts:REAL:=10;


  • min_temp:REAL:=-30;


  • min_temp_in_volts:REAL:=0;


  • alarm_high:BOOL;


  • alarm_low:BOOL;


  • temp_read_in_c:REAL;

A temperature function block was created in the program, which looked like the following,

Then the visualizer for the simulator was created and looked like this,

With the two states for too high temperature and too low temparture shown below,

  • No labels