beautypg.com

Sensaphone SCADA 3000 Users manual User Manual

Page 206

background image

16-20

SCADA 3000 User’s Manual

float all_off;

int first;

/* 0 = empty, 1 = lead on, 2 = lag on */

main()

{

if (first == 0)

{

lead = 0; /* preset channel 0 as lead */

lag = 1; /* preset channel 1 as lag */

lead_on = 12;

lag_on = 15;

all_off = 6;

state = 0;

first = 1;

}

if (state == 0)

{

if (read_uaf(input,0,0) > lead_on)

{

write_uaf(output,0,lead,on);

state = 1;

}

}

if (state == 1)

{

if (read_uaf(input,0,0) > lag_on)

{

write_uaf(output,0,lag,on);

state = 2;

}

if (read_uaf(input,0,0) < all_off)

{

write_uaf(output,0,lead,off);

state = 0;

if (lead == 0)

{

lead = 1;

lag = 0;

}

else

{

lead = 0;

lag = 1;

}

}

}

if (state == 2)

{

if (read_uaf(input,0,0) < all_off)

{

write_uaf(output,0,lead,off);

write_uaf(output,0,lag,off);

state = 0;

if (lead == 0)

{