MuttsNutts Posted June 8, 2007 Report Posted June 8, 2007 (edited) Hiyo again. I have put together pages and pages of a long list of valves used in my application with the various bits (Enable, Open output, closed limit, alarm, interlocked and so forth) represented by small squares and circles of various colours. Essentially, it is a simulator application. (We are not using a regular simulator because this project is just to change the SCADA from Wizcon to InTouch - I have the PLC code, but it's not that we are testing, just the SCADA system) So, everything works well except for some scripting which is causing my comms (Fins Gateway) to drag its heels. I have 20 valves on each page and a crude representation is shown below Enab...... I/L..........Alm........Cls s/w..........Sim......Output [ ] ------- [ ]---------[ ]--------- ( )------------[ ]------- ( ) The idea is that I click on the "Enab" box and this bit in the PLC drives the valve (assuming there is no alarm and interlock) such that the Output comes on and is shown above by the circle turning green. Anyhows, I needed to simulate the closed limit switch going to zero approx 2 seconds after setting the Enab bit and the similarly the closed limit switch going high 2 seconds after the Enab bit is reset. The "Sim" button is used to override this logic such that if Sim==true, I can click on the Closed limit switch and toggle it on or off. The solution I came up with is to use a script on the window these 20 valves are shown. Window Script OnShow() sets various bits to zero so we always start off from a safe place, but the scrips WhileShowing () every 2000 milliseconds seems to cause me a problem. Rather than using a script timer for each valve (there are hundreds), I knew that we'd be checking one at a time so I can energise the valve, wait for the customer to be happy that the animation (on another InTouch app) is satisfactory, and then move on to the next one. So, I used the "every 2000 milliseconds" option to perform what I wanted to do. Here is the script for each valve (without meaningless tags): IF Sim ==0 THEN IF Enab == 1 THEN ClosedLimitSwitch = 0; ELSE ClosedLimitSwitch = 1; ENDIF; ENDIF; The idea being that if I'm forcing the limit switch by toggling it this code will be bypassed and the limit switch will remain in the state I've chosen. But if I'm not forcing the limit switch, this code does indeed work, but the comms runs like a pig. Discrete bits appear in the PLC quickly that I toggle on (because they're not scrips dependant) such as the Enab bit, or even the Closed limit switch bit when I'm bypassing this code. But when I'm allowing the window script to set the state of the limit switch, FinsGateway runs like a pig. Interestingly, if I cut my 20 blocks of code down to just one to eliminate processor timing issues and Fins still flickers between "Complete" and "Pending". It's a simple bit of code, what gives?????? (Aaaarrrrrrgh! spelling and indents required edits!) Edited June 8, 2007 by MuttsNutts
Firetubes Posted June 9, 2007 Report Posted June 9, 2007 Depending on PLC's, you may not be able to write to your real inputs. I'm guessing the PLC is overwriting the limit switch status with the real status it's reading from the IO module or something similiar. With some PLC, you can disable modules/slots and that allows HMI's like Intouch to write to them. You should try writing the simulation logic inside the PLC.
MuttsNutts Posted June 12, 2007 Author Report Posted June 12, 2007 Hiyo, I have disabled any code that gathers I/O from Profibus and other areas such that input address 30.02 (it's an Omron PLC) can be poked and prodded quite happily from InTouch without the PLC interfering with it. This aspect is fine, it's just that nested IF - THEN statements inside a window script running every 2000 milliseconds (WhileShowing()) run like Carl Lewis through a bed of quick setting cement. I have to agree that using InTouch for a simulator is a pants idea, but I'm still none the wiser as to the scripting issue. Perhaps I need a wise old owl. (I'll even bribe with berries or whatever owls eat)
Firetubes Posted June 12, 2007 Report Posted June 12, 2007 Sounds like an IO server issue. I've done similiar with AB and Modicon with no problem. Try putting your script in a condition/on change script. If it still doesn't work, I would suspect that you are writting too fast to your IO server. If this is the problem you can chech the status of you limit switch before writing to it so that you don't continuously write to the tags.
MuttsNutts Posted June 18, 2007 Author Report Posted June 18, 2007 Thanks, if I get a chance I'll try that as I'm surprised a small script should cause so much of an issue. <shrugs>
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now