Forum Replies Created
-
AuthorPosts
-
Fatma
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
Fatma
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;}
-
AuthorPosts