Channels Communication and Reset

Forum Home Forums Understanding the Software Using Formulas Channels Communication and Reset

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #11635
    Fatma
    Participant

    Hello 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/qCqhU6Z

    Thanks in advance

    #11636
    manjey73
    Participant

    It 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?

    #11644
    Mikhail
    Moderator

    Hello,

    So, any help about how to do that without the Automatic module?

    Please specify the algorithm as a text.

    #11660
    Fatma
    Participant

    Hello. 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 side

    double 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;

    }

    • This reply was modified 1 year, 4 months ago by Fatma.
    • This reply was modified 1 year, 4 months ago by Fatma.
    #11664
    Mikhail
    Moderator

    Hello,

    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.

    #11675
    Fatma
    Participant

    I 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

    #11681
    Mikhail
    Moderator

    The 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;

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