Sign in to follow this  
Followers 0
Guest SysApp

Beginners Question

4 posts in this topic

I am new to programming PLCs and have a basic question to get me started. I am used to programming LabView or Visual Basic but I am having a hard time getting my mind into Ladder Logic gear. I am programming a SLC 5/3. I am controlling several air cylinders and I am not sure of the best or correct way to go about it. The valves are dual solenoid so I have an output to extend and an output to retract. There are hall effect sensors on each end. I need to turn on the extend output until the fully extended switch closes. I then need to turn on the retract output until the fully retracted switch closes. I am not sure of the best way to do this since each rung is read several times before the first operation is complete. I was able to accomplish it by turning bits on and off to force program flow, but I think this can get messy if I do this throughout the program. I have several cylinders that I have to operate in sequence. For example I have to extend cyl A then extend cyl B then turn on a vacuum pump then retract cyl B then retract cyl A then etc... How do I order the steps? Thanks in advance for any advice, examples, or links. SysApp

Share this post


Link to post
Share on other sites
We go for phases: a)To its valves plows dual solenoid. Then, is remains in the finalizes position that was bolt. It is good avoid heating of the valves, a wrist of energy is sufficient (>0.1-0.3s) b) Confirmation of displacement. (time out) It is constragedor, therefore is necessary that expect that happen. Therefore it use a watch dog timer, and create a logic in parallel of monitoration. With purpose of detect you fail and do not freeze the machine. It depends on the application, use a narrow or long time of the clock. The efficiency (speed) and security, system operate in automatic or are semi-automatic defined the time. If it will go a machine integrated in a line of output (automatic in serie), where the pieces enter in row, the time to detect a fails (collision, I knead) is small; I advise do a routine of calibration/you had where on the cylinders and memory the "time of course" adding a constant one defined the time of the "watch dog preset". C) Sequence of commands. Continuation from the sequence after confirm that turn on the key before of the stampede of the watch-dog.De I agree on with the task it to be performed, doing not forget of that itself the cylinder C1 arrived to the end and shot C2 that is advancing, while C1 returns, if the return of C1 fail, should see the condition of continue to sequence without collisions. Writing the program: A)To himself the system does not involve speed in processing, not cíclico, or be resolves the operations in the same cycle of scan, the best trick is set the time of SCAN PLC, in the special register (100ms). Like this it will be able to use for valves the reel of output pulsate. B) the most greatest stretch, and essecial will have that use a watch for each cylinder, or two itself the peculiar speed of advancement return. If do not it monitor the comands, can have a frezee logic. C) agreement with sequence desired, interlok the commands, with the condition of not to have shot it fails of team out (watch dog). After defined the logic of operation, overhaul and insert you lock them of the predicted conditions of you fail. I expect that clear, I did an opinion I open, for better understand you and to the readers. It arrange, the specific answers. Macgyver_BR

Share this post


Link to post
Share on other sites
Because of the lack of high level constructs, ladder logic will tend to get 'messy' no matter what you do if you are used to Visual Basic. However, most of the base level concepts of good programming hold. A method I have used with some success in sequencial applications like this is a state machine. Given your background I suspect you are familiar with the concept. You have to babysit the state variable a bit more in ladder and the output conditions need to be explicitly driven, but again the concept holds. In ladder it also helps to separate the state driver logic from the output driver logic for readability. You can use as many states as you like. Use an integer as the state variable. If you want to guarantee that a state is set for at least one scan regardless of the true/false status of other state transitions, structure the state driver from the bottom up in the program (put the low states at the end and work backwards). There is no equivalent to 'break' in this plc. You could also use multiple jumps to a common label as a way to skip the rest of the state driver logic. You will want to have a reset/initial state. From there, the next state is defined as being in the previous state AND having the transition conditions true. In your example, from state zero you will have some trigger condition to start the cycle. So the logic would be: IF ( (STATE = 0) AND (Start_Condition) ) STATE = 1 This would continue on to encompass as many states as you want. If you increase the state value by a power of 2 (0, 1, 2, 4, 8, ...) you can reference the individual bits in the state variable for use in the output driver logic. For example, a bit reference of N7:0/1 is a perfectly valid bit reference. So the big step, as in any program, is to map out your path before you start. Make sure you account for as many possibilities as you can up front. Then have at 'er. As a side note, if you stay away from direct assignment outputs (OTE) and use latch instructions (OTL and OTU ) or integer variables you can put together a program very similar in structure to a BASIC or C program. OTL will set a bit when the preceeding logic is true. However, when the logic goes false the bit stays set. It is reset by an OTU instruction acting on the same bit address. IF THEN is simply replaced with leading rung input conditions. Just remember that memory in a plc is not sutomatically re-initialized on power-up or program restart. So if you use the state machine or latched ideas you need to explicitly set data locations to the desired values at start. If you have any direct questions either post them here or send me an email at kamenges@juno.com Good luck, Keith

Share this post


Link to post
Share on other sites
Have you downloaded any of the sample Allen Bradley PLC code in the downloads section? Does that clear anything up or do you still have questions?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0