Help me make this program more efficient. Issues with detecting sensors for...

Brandon_K

Member
Join Date
Mar 2016
Location
Pittsburgh, PA
Posts
150
This program is part of a "Saw" type of device we designed. The program consists of a bunch of games within the device to escape from, but I'm having issues with one specific portion of the program (specifically pertaining to rungs 11 through 49 in the program).

I'll try to give some background on "The Device".

There are 6 player stations. Each station has a 6" stroke cylinder mounted above a players wrist with a fake knife blade attached to the rod. Each cylinder has 3 mag prox sensors on it, giving each cylinder 5 positions (fully retracted, position 1, position 2, position 3 and fully extended). The game is 5 minutes long. The cylinders all start in a fully retracted state. Every 90 seconds, the cylinders each extend 1.5", until the 5 minutes is up. If they have not completed the game at the end up the 5 minutes, the cylinders fully extend "cutting off" the players hand.

The original program I wrote had a pair of compare contacts to activate the solenoid valves down to the first mag prox on the cylinder body. So from 90 to 92 seconds into the game, that activated the valve to move the cylinder downward to it's first sensor. I put a NC contact in for each valve so that when it hit the first prox on the cylinder, it would stop the valve. Then from 180 to 182 seconds it would move to it's 2nd position, 270 to 272 seconds it's 3rd position and at 300 seconds it would fully extend.

I chose 2 second gaps to activate the valve to allow for differences in speed in the flow controls and to make sure there was enough time to get the cylinder to travel from point to point, since the prox on the cylinder should be stopping the PLC from activating the valve.

The problem I'm having is even with the flow controls at the slowest speed without chattering, the PLC didn't seem to be "catching" the prox input so the cylinder would sail past the sensor and continue extending to it's full stroke length. In the original program the scan time was 10ms. The detection area on these cylilnders is very small so I believe it may have been missing the input during it's scan.

Since I've been back to the hotel I've rewritten that portion of the program. Previously the contact blocks to stop the valve from continuing were simply the prox input. I've changed that so now the prox input sets a control bit (I did some testing on it using that setup before I left the site and it worked better, but still not ideal).

I've also changed the inputs to be "Immediate" which I think may have been a large portion of my problem in the first place. I've never had to program something with such quick pulses of inputs before and I've never used the "Immediate" option.

At this point what I'm looking for is to have you guys look at it and tell me what you would have done different. The way I have it now may work (I'll know in the morning when I get back to the site), but I'm still far from proficient in ladder, so I want to see how the pro's would have gone about it.

Just looking at the program overall (specifically, the cylinder control portion), it seems very long. With all of the X > set control bits, it's even longer now. It just doesn't seem efficient to me. As a direct example, I have 5 control bits for each physical valve output. I feel like there has to be a better, more efficient, less code way to go about it than I've chosen.

I would love any input you guys have. I always try to put enough info in the rung comments and address nicknames. Program is attached (change the extension from .zip back to .ckp). It's an AD Click. I've attached some pics of the game in various stages of it's build as well, to give a better idea of what it does.

1473297588534.jpg 20160908_044507.jpg 20160908_021639.jpg 20160908_025047.jpg
 

Attachments

  • The_Device_Rev1.03plctalk.zip
    61.4 KB · Views: 12
Last edited:
This seems like a mechanical design issue rather than something you can fix with programming. In my experience, getting position control from a directional valve and discrete switches isn't reliable. With pneumatics I have never got it to work. With a known hydraulic flow then you can limp your way thru it but response time of the system will still cause things to drift past your switches.

Things like immediate commands will just remove your Plc scan time from the system response. But you still have your physical cylinders and power source (hydraulic or pneumatic) to deal with.
 
Use some solid state relays to OR your 18 inputs down to 6 inputs and use input interrupts. You only have 8 input interrupts on the click, as per link

Also, are you using mechanical relay mag switches, or solid state mag switches? Solid state mag switches are faster, and i find more reliable.

I assume you are metering the air coming out of the cylinder not the air going in?
 
If it is missing the on off transition of the limit switches try latching a bit from the switch. That way if it has turned off already it will still stop it
 

Similar Topics

Hi all, I’m new to programming and want to write a simple routine. Push start button, turns on sensor. 2 second delay before anymore logic read...
Replies
1
Views
289
Hi! I need help converting an old MicroLogix 1100 project to Micro 820. Project Details I have an old MicroLogix 1100 program that has been in...
Replies
0
Views
454
Hello friends. I need to write a program. This is exactly what is asked of me: When Sensor 1 and Sensor 2 give output, it will allow Robot to...
Replies
3
Views
930
I will be designing an automated hydrostatic system. The system on paper works like this, a plc like the click will get information from an hmi...
Replies
227
Views
42,482
Hello everyone, I am migrating a program from STL to SCL via S7-1200 portal, I would like you to help me by converting these lines of code...
Replies
4
Views
1,607
Back
Top Bottom