Forum Home › Forums › Understanding the Software › Using Formulas › Channels Communication and Reset
- This topic has 6 replies, 3 voices, and was last updated 6 months, 2 weeks ago by
Mikhail.
-
AuthorPosts
-
November 22, 2022 at 1:14 am #11635
Fatma
ParticipantHello Everyone,
I coded formulas to control On-Off periods, and it worked well at the GUI, but the Hardware didn’t affect. I used the automatic control module to copy data between the input and output channel, and it worked correctly. So, any help about how to do that without the Automatic module?
There is another problem: After choosing the hour that should the system be ON and for how many seconds from the GUI, The command of choosing hours and seconds reset automatically after little time. SO, how to keep chosen values?
Input Channels: https://imgur.com/49ddY5l
Output Channels: https://imgur.com/4HUa7zb
GUI: https://imgur.com/ZnGE9Tz
Commands Values: https://imgur.com/8XoFc05
Module Config: https://imgur.com/qCqhU6ZThanks in advance
November 22, 2022 at 8:24 am #11636manjey73
ParticipantIt is impossible without the module in automatic mode without the participation of the operator. The module is designed for this
On the second question, it is not entirely clear what is being reset?
November 22, 2022 at 1:51 pm #11644Mikhail
ModeratorHello,
So, any help about how to do that without the Automatic module?
Please specify the algorithm as a text.
November 23, 2022 at 8:56 am #11660Fatma
ParticipantHello. Thanks for your answers
manjey73: The channels’ values that hold hours and seconds
mikhail: This is the final function which simply check if the current time is inside the specified period or not, then returns 1 or 0 to an input channel that have the signal of the hardware location connected to OpenPLC program on the other sidedouble TargetMin;
double On_Period(double hour, double minutes, double ONminutes, double ONseconds)
{
TargetMin = minutes+ONminutes;
if(DateTime.Now.Hour == hour && DateTime.Now.Minute >= minutes){
if(DateTime.Now.Minute <= TargetMin)
return 1;
else if(DateTime.Now.Second <= ONseconds)
return 1;
}
return 0;}
November 23, 2022 at 11:40 am #11664Mikhail
ModeratorHello,
If you function works, you can use Automatic Control Module to send commands when channel comes to 0 or 1. You should create a trigger “on channel data” and add commands.
November 23, 2022 at 11:57 am #11675Fatma
ParticipantI did that and it works good, but I want to do that without the module but I can’t
Also the channels that I take the hour and minute from it, it reset to 0 after few seconds. So, if I choose to open the system at 03:08 for 1 minute the channels will reset to 00:00 and according to the channel type (calculated discrete) the values of hour and minutes will overwritten to 00 & 00
November 24, 2022 at 9:07 am #11681Mikhail
ModeratorThe the module is required to send commands automatically according to the specified conditions.
I recommend to get the current time once:
DateTime curTime = DateTime.UtcNow;
-
AuthorPosts
- You must be logged in to reply to this topic.