Terry Woods
Member
- Join Date
- Apr 2002
- Posts
- 3,170
So... the Pirates (my Keepers, don't cha know) urged me to consider this challenge... even if only as an intellectual exercise.
(This turned out to be pretty long, longer than I expected. If you have ADS, you might change the channel right now.)
I considered the basic actions/reactions.
In general...
Start-Up:
If the Valve is NOT moving and the CLOSE_PB is pressed, begin Closing the Valve.
-OR-
If the Valve is NOT moving and the OPEN_PB is pressed, begin Opening the Valve.
Then...
Stop:
If the Valve IS Closing and the OPEN_PB is pressed, stop Closing the Valve.
-OR-
If the Valve IS Opening and the CLOSE_PB is pressed, stop Opening the Valve.
At that point, regardless of which way the Valve WAS going, it is back in the Start-Up situation.
So, I plotted-out a K-Map.
Everything seemed to be going along well until I ran into the following case...
Assume the Valve is Closing. If I then press the OPEN_PB to Stop Closing the Valve, the Valve does indeed Stop Closing.
HOWEVER...
Since the Valve is no longer Opening or Closing, having the OPEN_PB pressed (which was done for the purpose of STOPPING the Valve) is sufficient to cause the Valve to begin OPENING immediately! That certainly is not the intent.
The same effect occurs when pressing the CLOSE_PB to Stop Opening the Valve. That is, the Valve immediately begins to CLOSE! Again, not what was intended!
So... What is it that we are really looking for...???
A little head-scratching, an MGD or two (or three) and the fog started to lift. In order to START in either direction, what we need is to "see" one button or the other Come-On WHILE the Valve is neither Closing nor Opening. If a button Comes-On in that circumstance, that is, the Valve is neither Opening, nor is it Closing, then the function related to the particular button is activated.
If the Valve is Closing, then pressing the OPEN_PB Stops the Closing, but does NOT begin Opening because the button is not seen to come-on while the valve is stopped.
So.... how the hell do you get this into a K-Map???
Many look at K-Maps as State-Maps ONLY. They look at it only as a tool for minimizing code. This is a mistake... especially when they are used for PLC Programming.
PLC's are "Conditional Sequencers". If you use a K-Map to plan out a program, that K-Map, when used with a PLC Program, can be plotted as a sequencer. That is, the K-Map doesn't have to be seen and used as a state-machine only.
The following is the K-Map I came up with. The explanation follows the map.
(INSERT MAP)
IN GENERAL, decisions are made according to the states of the Inputs. The Inputs are shown along the left side and across the top.
The various combination conditions of the OPEN_PB and CLOSE_PB are shown along the left side of the map.
Across the top, you see the STATUS. The STATUS is the State of the Outputs. (I'm gonna speak in terms of the PLC Outputs ONLY because this is an intellectual exercise. The right way to do it is to read the Open/Close AUX Contacts on the motor.)
Continued in Part 2
(This turned out to be pretty long, longer than I expected. If you have ADS, you might change the channel right now.)
I considered the basic actions/reactions.
In general...
Start-Up:
If the Valve is NOT moving and the CLOSE_PB is pressed, begin Closing the Valve.
-OR-
If the Valve is NOT moving and the OPEN_PB is pressed, begin Opening the Valve.
Then...
Stop:
If the Valve IS Closing and the OPEN_PB is pressed, stop Closing the Valve.
-OR-
If the Valve IS Opening and the CLOSE_PB is pressed, stop Opening the Valve.
At that point, regardless of which way the Valve WAS going, it is back in the Start-Up situation.
So, I plotted-out a K-Map.
Everything seemed to be going along well until I ran into the following case...
Assume the Valve is Closing. If I then press the OPEN_PB to Stop Closing the Valve, the Valve does indeed Stop Closing.
HOWEVER...
Since the Valve is no longer Opening or Closing, having the OPEN_PB pressed (which was done for the purpose of STOPPING the Valve) is sufficient to cause the Valve to begin OPENING immediately! That certainly is not the intent.
The same effect occurs when pressing the CLOSE_PB to Stop Opening the Valve. That is, the Valve immediately begins to CLOSE! Again, not what was intended!
So... What is it that we are really looking for...???
A little head-scratching, an MGD or two (or three) and the fog started to lift. In order to START in either direction, what we need is to "see" one button or the other Come-On WHILE the Valve is neither Closing nor Opening. If a button Comes-On in that circumstance, that is, the Valve is neither Opening, nor is it Closing, then the function related to the particular button is activated.
If the Valve is Closing, then pressing the OPEN_PB Stops the Closing, but does NOT begin Opening because the button is not seen to come-on while the valve is stopped.
So.... how the hell do you get this into a K-Map???
Many look at K-Maps as State-Maps ONLY. They look at it only as a tool for minimizing code. This is a mistake... especially when they are used for PLC Programming.
PLC's are "Conditional Sequencers". If you use a K-Map to plan out a program, that K-Map, when used with a PLC Program, can be plotted as a sequencer. That is, the K-Map doesn't have to be seen and used as a state-machine only.
The following is the K-Map I came up with. The explanation follows the map.
(INSERT MAP)
IN GENERAL, decisions are made according to the states of the Inputs. The Inputs are shown along the left side and across the top.
The various combination conditions of the OPEN_PB and CLOSE_PB are shown along the left side of the map.
Across the top, you see the STATUS. The STATUS is the State of the Outputs. (I'm gonna speak in terms of the PLC Outputs ONLY because this is an intellectual exercise. The right way to do it is to read the Open/Close AUX Contacts on the motor.)
Continued in Part 2