Forum Home › Forums › Uncategorized Issues › if variable change value every minute so 1 , otherwise 0
Tagged: machine image cycle counter
- This topic has 6 replies, 4 voices, and was last updated 2 years ago by Mikhail.
-
AuthorPosts
-
July 15, 2017 at 10:24 am #2360josef.novotnyParticipant
Hi all, we implemented Rapid Scada, we monitoring some machines via MODBUS TCP/IP.
We reading values “cycle counter”, temperature etc., thats all OK.
But we want to visualize it machines as Pictures in view scheme.
Example…
Machine image is green if “cycle counter” change value during two minutes.
Machine image is red if there is no change “cycle counter” after two minutes.How to do it ???
Bye, Josef
July 15, 2017 at 12:56 pm #2361MikhailModeratorHi Josef,
You need to create appropriate functions in Formulas table, create input channels of calculated type which use these functions and then define the input channels for an dynamic picture components of the scheme.
Creating functions required programming skills. You can purchase the development of the functions or do it by yourself and ask me general questions about it.
July 15, 2017 at 1:34 pm #2362josef.novotnyParticipantHi Mikhail,
How much would it cost to purchase a development of the funkcions ?Josef
July 16, 2017 at 10:51 am #2365manjey73ParticipantI have used several formulas to control the state of the PC when reading parameter UpTime via SNMP Protocol.
Need formula Ticks, Ton, NotEquals our database formulas.
The challenge in the formula of the channel NotEquals(Val(602),120000), where Val(602) controlled signal, the time in milliseconds
_______________________________________________
Ticks (Returns the time in milliseconds required for the operation of the timer Ton)
_______________________________________________
public static long Ticks()
{
DateTime now = DateTime.Now;
long time = now.Ticks/10000;
return time;
}
________________________________________________Ton (Timer with delay)
________________________________________________
int[] TonNum = new int[1];
long[] TonST = new long[1];
bool[] TonFlag = new bool[1];
public double Ton(double TonIn, double TonPT)
{
long ET = 0L;
long ton_pt = Convert.ToInt64(TonPT);
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 >= ton_pt) q = true;
}
return Convert.ToDouble(q);
}
______________________________________________________________NotEquals (If the value has not changed within the specified time in milliseconds, then the channel returns 1 if the time is changed, the timer resets)
______________________________________________________________
int[] NotEqualsNum = new int[1];
bool[] valEquals = new bool[1];
double[] valUpTime = new double[1];
public double NotEquals(double UpTime, double PT)
{
bool eq = false;
bool q = Val(CnlNum) > 0;int res = Array.IndexOf(NotEqualsNum, CnlNum);
if (res == -1)
{
res = NotEqualsNum.Length;
Array.Resize(ref NotEqualsNum, res+1);
Array.Resize(ref valEquals, res+1);
Array.Resize(ref valUpTime, res+1);
NotEqualsNum[res] = CnlNum;
valUpTime[res] = UpTime;
valEquals[res] = q;
}
eq = (UpTime – valUpTime[res]) > 0 ;
valUpTime[res] = UpTime;
double tonIn = Convert.ToDouble(!eq);
valEquals[res] = Convert.ToBoolean(Ton(tonIn, PT));
return Convert.ToDouble(valEquals[res]);
}
_________________________________________________________________________2 minutes = 120000 milliseconds
July 17, 2017 at 6:28 am #2373MikhailModeratorHi Josef,
How much would it cost to purchase a development of the funkcions ?
I sent you an offer by email.
April 19, 2022 at 9:22 am #10195arunagiriParticipantHi Mikhail,
Where and how to create functions.
Request you to guide on creating the functionsMany Thanks in advance
April 19, 2022 at 10:55 am #10196MikhailModeratorHi,
-
AuthorPosts
- You must be logged in to reply to this topic.