if variable change value every minute so 1 , otherwise 0

Forum Home Forums Uncategorized Issues if variable change value every minute so 1 , otherwise 0

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2360
    josef.novotny
    Participant

    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

    #2361
    Mikhail
    Moderator

    Hi 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.

    #2362
    josef.novotny
    Participant

    Hi Mikhail,
    How much would it cost to purchase a development of the funkcions ?

    Josef

    #2365
    manjey73
    Participant

    I 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

    #2373
    Mikhail
    Moderator

    Hi Josef,

    How much would it cost to purchase a development of the funkcions ?

    I sent you an offer by email.

    #10195
    arunagiri
    Participant

    Hi Mikhail,

    Where and how to create functions.
    Request you to guide on creating the functions

    Many Thanks in advance

    #10196
    Mikhail
    Moderator
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.