VXi VT1529A/B 用户手册

下载
页码 529
Creating and Running Algorithms   203
To set up the algorithms for this example:
1. Define the global variable <cold_setpoint>.
ALG:DEF 'GLOBALS','static float cold_setpoint;'
2. Define the following algorithm language code as ALG1, the ratio 
station algorithm.
static float hot_flow, cold_hot_ratio;
static float cold_temp = 55, hot_temp = 180, product_temp = 120;
hot_flow = I108;
/* get flow rate of cold supply */
/* following line calculates cold to hot ratio from supply and product temps */
cold_hot_ratio = (hot_temp - product_temp) / (cold_temp - product_temp);
cold_setpoint = hot_flow * cold_hot_ratio;  /* output flow setpoint for ALG2 */
3. Modify a PIDA algorithm so its setpoint variable is the global 
variable cold_setpoint, its input channel is I109 and its output channel 
is O116 and Define as ALG2, the cold supply flow controller.
/*  Modified PIDA Algorithm; comments stripped out, setpoint from global,
    inchan = I109, outchan = O116
*/
     /* the setpoint is not declared so it will be global */
  
    static float P_factor = 1;
 
    static float I_factor = 0;
    static float D_factor = 0;
    static float I_out;
    static float Error;
    static float Error_old;
FT
flow transmitter
ALG2
Flow Controller
ALG1
Ratio Station
flow transmitter
FC
 55
°
Cold Supply
GLOBAL
cold_setpoint
I108
O116
I109
180
°
Hot Supply
120
°
Product
Figure 6-4. Inter-algorithm Communication with Globals
FT
RS