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

  •  sensor_read:REAL;


  •  set_point_in_pRh:REAL;


  • alarm_delay:TIME:=T#2S;


  • alarm_dead_zone:REAL:=5;


  • max_pRh:REAL:=100;


  • max_pRh_in_volts:REAL:=10;


  • min_pRh:REAL:=0;


  • min_pRh_in_volts:REAL:=0;


  • alarm_high:BOOL;


  • alarm_low:BOOL;

       

  • pRh_read:REAL;

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

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

With the two states for too high moisture level, and too low moisture level, as shown below,


  • No labels