Auto Control Module : Multichannel Trigger between specific time

Forum Home Forums Understanding the Software Auto Control Module : Multichannel Trigger between specific time

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • #16784
    Mikhail
    Moderator

    Hi,
    I suggest some optimization:

    1. The above script creates an array on every call. It’s better to initialize the array only once.

    2. Use the TimeOfDay property instead of creating new DateTime manually, and compare time spans.

    #16785
    Mikhail
    Moderator

    Alternatively, use Auto Control Module and a time trigger.

    #16786
    rapidscadaaks
    Participant

    Hi Mikhail

    Is it possible to use time trigger in ACM to write 0 or 1 to a channel ?

    #16787
    Mikhail
    Moderator

    Hi,
    Yes, it’s possible. Please describe the entire task, so I could suggest the better way. What do you plan to do with 0 and 1?

    #16788
    rapidscadaaks
    Participant

    Hi Mikhail

    There are certain multichannel triggers already configured in ACM. I want these multichannel triggers to be active at certain times during the day, say at 0800, 1000, …. 2130 for a period of 30 minutes each time. I cannot use time trigger directly since combining time trigger with multichannel trigger is not feasible.
    I therefore considered creating a channel which gets updated to 1 at the required times and 0 at other times.
    If feasible, I would like to create a time trigger to write 1 in a created channel at required times and another time trigger to write 0 to the same channel 30 minutes after the “1” time. This channel would be added to the multichannel triggers and therefore would get triggered only if the value of the channel is 1.
    Please guide
    Thanks

    #16790
    manjey73
    Participant

    The time has a Minutes parameter, so you can check for >=0 && <=30 in the script.
    and in addition to checking the required hour.

    #16791
    Mikhail
    Moderator

    Hi,
    Try the function below (not tested):

    function double TimeToGetHigh()
    {
      int hour = Timestamp.Hour; // the Timestamp is a built-in property
      return Timestamp.Minute == 0 && (hour == 8 || hour == 12 || hour == 18 || hour == 22)
        ? 1
        : 0;
    }
    

    Note that UTC hour is used.
    The channel input formula: TimeToGetHigh()
    Channel type is calculated.

    • This reply was modified 2 weeks, 6 days ago by Mikhail.
    #16793
    rapidscadaaks
    Participant

    Hi Mikhai
    Many thanks. Just need a small tweak so that value 1 remains as 1 for a duration of 5 minutes each time. I think

    ==0 will need change

    Thank you once again

    #16794
    manjey73
    Participant

    return (Timestamp.Minute >= 0 && Timestamp.Minute < 6) && (……)

    #16795
    Mikhail
    Moderator

    Hi,
    So the result would be something like

    public double TimeToGetHigh()
    {
      int hour = Timestamp.Hour; // the Timestamp is a built-in property
      return (Timestamp.Minute >= 0 && Timestamp.Minute < 6) && (hour == 8 || hour == 12 || hour == 18 || hour == 22)
        ? 1
        : 0;
    }
    
    • This reply was modified 2 weeks, 4 days ago by Mikhail.
    #16796
    rapidscadaaks
    Participant

    Hi

    Thank you. Just one last question on this topic :
    Rapidscada stopped working with I added the above script. When I replaced “function” with “public”, Rapidscada started working. Please explain.

    Thanks

    #16797
    Mikhail
    Moderator

    Hi,
    In Rapid SCADA 6 the script functions must be public. Otherwise the calculation engine cannot see them.

    #16799
    Mikhail
    Moderator

    Other explanation is that I’ve written too many code in JavaScript recently, so I messed up C# and JavaScript 🙂

    #16800
    rapidscadaaks
    Participant

    Thanks Mikhai

Viewing 14 posts - 16 through 29 (of 29 total)
  • You must be logged in to reply to this topic.