Forum Home › Forums › Understanding the Software › Auto Control Module : Multichannel Trigger between specific time
- This topic has 28 replies, 3 voices, and was last updated 2 weeks, 4 days ago by
rapidscadaaks.
-
AuthorPosts
-
August 4, 2025 at 10:37 am #16784
Mikhail
ModeratorHi,
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.
August 4, 2025 at 10:38 am #16785Mikhail
ModeratorAlternatively, use Auto Control Module and a time trigger.
August 4, 2025 at 10:58 am #16786rapidscadaaks
ParticipantHi Mikhail
Is it possible to use time trigger in ACM to write 0 or 1 to a channel ?
August 4, 2025 at 11:01 am #16787Mikhail
ModeratorHi,
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?August 4, 2025 at 11:27 am #16788rapidscadaaks
ParticipantHi 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-
This reply was modified 3 weeks ago by
rapidscadaaks.
August 4, 2025 at 4:55 pm #16790manjey73
ParticipantThe time has a Minutes parameter, so you can check for >=0 && <=30 in the script.
and in addition to checking the required hour.August 5, 2025 at 11:45 am #16791Mikhail
ModeratorHi,
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.
August 6, 2025 at 1:03 am #16793rapidscadaaks
ParticipantHi 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
August 6, 2025 at 8:32 am #16794manjey73
Participantreturn (Timestamp.Minute >= 0 && Timestamp.Minute < 6) && (……)
August 6, 2025 at 2:27 pm #16795Mikhail
ModeratorHi,
So the result would be something likepublic 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.
August 7, 2025 at 1:43 am #16796rapidscadaaks
ParticipantHi
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
August 7, 2025 at 1:29 pm #16797Mikhail
ModeratorHi,
In Rapid SCADA 6 the script functions must be public. Otherwise the calculation engine cannot see them.August 7, 2025 at 1:31 pm #16799Mikhail
ModeratorOther explanation is that I’ve written too many code in JavaScript recently, so I messed up C# and JavaScript 🙂
August 8, 2025 at 12:56 am #16800rapidscadaaks
ParticipantThanks Mikhai
-
This reply was modified 3 weeks ago by
-
AuthorPosts
- You must be logged in to reply to this topic.