bool32.rising trigger
bool32 gate
bool32 gate
int ntrig;
int tmp;
double R1;
double R2;
double XN;
double XN1;
double YN;
double YN1;
double XCR1;
double XCR2;
int x;
int y;
double rem;
int n;
ntrig = 0;
tmp = 0;
R1 = 3.990;
R2 = 3.984;
XN = 0.400;
XN1 = 0.800;
YN = 0.500;
YN1 = 0.720;
XCR1 = 0.496;
XCR2 = 0.477;
n = 1;
if ((inlet_trig > 0) && !ntrig) {
ntrig = 1;
if ((XN < XCR1) && (XN1 >= XCR1))
x = 0;
if ((XN >= XCR1) && (XN1 < XCR1))
x = 1;
if ((YN < XCR2) && (YN1 >= XCR2))
y = 0;
if ((YN >= XCR2) && (YN1 < XCR2))
y = 1;
rem = n % 2;
if (rem == 1.00) {
if ((x == 0) && (y == 0))
tmp = 0;
if ((x == 1) && (y == 1))
tmp = 0;
if ((x == 0) && (y == 1))
tmp = 1;
if ((x == 1) && (y == 0))
tmp = 1;
}
XN = XN1;
XN1 = R1 * XN * (1.000 - XN);
YN = YN1;
YN1 = R2 * YN * (1.000 - YN);
n = n + 1;
} else if (!(inlet_trig > 0))
ntrig = 0;
outlet_gate = tmp;
disp_gate = tmp;