Fatma

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Channels Communication and Reset #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

    in reply to: Channels Communication and Reset #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, 5 months ago by Fatma.
    • This reply was modified 1 year, 5 months ago by Fatma.
Viewing 2 posts - 1 through 2 (of 2 total)