Hi Bering C, thanks for chiming in. I'll answer your questions below:
Bering C Sparky said:
What software are you using?
ISaGRAF by ICLinks (smaller PLC mfr out of Roseville, CA near Sacramento). Specifically it's what they call a function block diagram, it's a mix of ladder logic and functions.
Can you explain your program to me a bit more?
I've been working on converting some FIX 7.0 SCADA scripts to ladder logic, and the challenge is that the old FIX scripts allowed things like IF/ELSE, WAITFOR, DELAY, GOTO and etc that are not supported by IEC 61131, so the challenge has been to convert procedural script code to ladder logic. In this instance, the idea is that when the pump is commanded to run, it's sent a 90second long "start" pulse, and when it's commanded to stop, it's sent a 90sec long "stop" pulse. I'm just trying to make my new PLC work with the existing system, so I'm just trying to work with what was already there.
I cant wrap my head around how your logic lines up.
I've gotten things figured out thanks to L_D but for the sake of anyone else reading, I'll go ahead and see if I can explain it.
Is the Pump_Run_Command a maintained or momentary switch?
It's momentary, meant to be held on for 90 seconds when activated.
Does ] [ mean Examine if Closed (XIC like in A.B) or does it mean the circuit if the circuit is open?
In this program, || means normally open contacts, and |/| means normally closed.
Are the Second set of instructions going to the OR Blocks ment to be a seal-in?
No, it's simply logic saying that if the pump run command is called (TRUE), and the pump isn't already running, then send the start command, and if the pump run command goes back to FALSE, send the pump stop command. The 90 seconds is there so that it has time to propagate to the remote well site, as this code is running across radio links.
It would seem to me that the Pump_Run_Command that is placed between the OR Block and the Timer is either redundant or will impead your logic from working.
Indeed, it is redundant. It does actually work when I program and test it, but there's a significantly simpler version that I realized thanks to L_D; the trick is that with a combination of NO and NC contacts, what looks like an OR should actually be an AND.
Also if I am dead wrong about all of that and the logic does funtion, then what inhibits you from pushing the Pump_Run_Command button while the Pump_Stop_Command timer is still timing and making both outputs true?
Great question, and good insight. This in theory could (and does happen) when testing. However, what should be noted is that the Pump_Run_Command is a local bit, and the Pump_Is_Running is a remote bit fed back from the well pump site; thus, locally, the Command bit is going to be the bit that turns the pump on and off, but the Running bit won't change until the pump is running, which has significant time delay due to ramp up/ramp down and radio links. So while it could in theory happen, it won't in the field...and if it did, there's programming elsewhere that would call an alarm in the event of pump failure.
Were you able to simulate and run this logic to see that it does work?
Yes, but it is redundant as discussed earlier and like you noticed, both bits can be true if one is testing with local switches.
Sorry for all the questions and I am truly not trying to be critical. I have not seen this software before and I am just looking at this a bit crosseyed I guess.
No need for apologies at all, I totally see your line of reasoning here and I wanted to take the time and explain it out for you and anyone else who might stumble across it.
I have waited and watched a lot of very smart people look at this and say nothing before I wrote this so I am pretty sure it will turn out that I am the one that is wrong.
Actually you had some very good insights and asked some great questions, thanks for chiming in!
Please if you have time explain how this works for me so I understand it.
Gladly, and I hope it made sense. Here's the original code that I'm replicating for reference:
Code:
00 NUL
01 SETLIM 0.0000
02 IF PUMP_COMMAND > PUMP_RUNNING GOTO 6
03 IF PUMP_COMMAND < PUMP_RUNNING GOTO 6
04 DELAY 5
05 GOTO 1
06 IF PUMP_COMMAND = 1.00 GOTO 11
07 SETOUT PUMP_STOP 1.00
08 DELAY 90
09 SETOUT PUMP_STOP 0.00
10 GOTO 1
11 SETOUT PUMP_START 1.00
12 DELAY 90
13 SETOUT PUMP_START 0.00
14 GOTO 1
and here's the simplified version: