https://s30.postimg.org/9etq90vmp/RStrig_Reset.png
Base formulas
————————————————
ResetCnl
————————————————
double ResetCnl(double val, int InCnl)
{
bool q = val > 0;
if (q)
{
q = !q;
CnlValSet(InCnl, 0);
}
return Convert.ToDouble(q);
}
————————————————-
RStrig
————————————————-
double RStrig (double set, double res)
{
bool s = set > 0;
bool r = res > 0;
bool q = r ? q = false : Val(CnlNum) > 0 || s;
return Convert.ToDouble(q) ;
}
—————————————————
Ton
—————————————————
int[] TonNum = new int[1];
long[] TonST = new long[1];
bool[] TonFlag = new bool[1];
public double Ton(double TonIn, long TonPT)
{
long ET = 0L;
bool q = Val(CnlNum) > 0;
bool ton_in = TonIn > 0;
int res = Array.IndexOf(TonNum, CnlNum);
if (res == -1)
{
res = TonNum.Length;
Array.Resize(ref TonNum, res+1);
Array.Resize(ref TonST, res+1);
Array.Resize(ref TonFlag, res+1);
TonNum[res] = CnlNum;
}
if (!ton_in)
{
q = false;
TonFlag[res] = false;
TonST[res] = 0L;
}
else
{
if (!TonFlag[res])
{
TonFlag[res] = true;
TonST[res] = Ticks();
}
else
{
if (!q) ET = Ticks() – TonST[res];
}
if (ET >= TonPT) q = true;
}
return Convert.ToDouble(q);
}
———————————————————
I use formulas and module of automatic control to re-send the command
May still need to make the formula entry a bit to the desired value, if necessary.
Sorry for my English, is machine translation