script help

GARRYA

Member
Join Date
Sep 2012
Location
USA
Posts
10
This is the panel script that I wrote for a GE quickpanel view
Can someone please explain to me why this script will not work, it does not give me any error it just does not toggle the bit PLC.M00059
It is supposed to toggle the bit PLC.M00059 for one minute then turn it off the script is set to run periodically every 1000 ms




IF (TIME_OF_DAY.HR = 15) AND (TIME_OF_DAY.MIN = 00) PLC.M00059 := (1)
ELSE
PLC.M00059 := (0)
ENDIF
 
according to your code the only time that PLC.M00059 is set to '1' is when TIME_OF_DAY.HR = 15 & TIME_OF_DAY.MIN = 00 and you may be missing a THEN statement. Try this:

IF (TIME_OF_DAY.HR = 15) AND (TIME_OF_DAY.MIN = 00) THEN
PLC.M00059 := (1)
ELSE
PLC.M00059 := (0)
ENDIF

but just to let you know your PLC.M00059 is set to 1 when TIME_OF_DAY.HR = 15 & TIME_OF_DAY.MIN = 00 pretty much at 3:00 regular time, so as soon as 15:00 hits it should stay on for one minute, then after that, once the time cycles back to 15hrs and 00 mins the bit will stay on for one minute and repeat the process, if thats what you want then your fine, but if you want to turn that bit on for a set amount of time then turn it off for a set amount of time then you would need to write different code.
 
Last edited:
The built-in QP View variables for hour and minute are #CurrentTime.HR and #CurrentTime.Min. Have you defined "TIME_OF_DAY.HR" and "TIME_OF_DAY.MIN"? If they are PLC variables, you may need the "PLC." prefixing them the same as you have for "PLC.M00059".
 

Similar Topics

Can someone give a clear explanation of the IOSetAccessName for an Intouch Application Script? - Thanking everyone in advance. The setup is 1 No...
Replies
0
Views
1,157
I need to hide/display a lamp by using a script. It says there is a script error but I cannot figure out where the error is. Can some one please...
Replies
7
Views
2,843
Hello I wanna do script python ( if detect color ==> Set memory bit ) WriteMemory(plc,0,1,S7WLBit,True) if 'orange': (0, 140, 255)==1 this...
Replies
5
Views
2,666
code python: import snap7 from time import sleep import struct import snap7.client as c plc = snap7.client.Client() plc.connect("192.168.0.1")...
Replies
0
Views
1,564
When I simulated the program it gives me an error code python(part of main program): if okLeft: #random.randrange(2): resultLeft = "OK"...
Replies
2
Views
1,768
Back
Top Bottom