Could someone take a look at my code and give me some feedback?

I'm fairly new at PLC programming and I wrote this code to program a bottle filler. The code does technically work, but the bottle loader can only send 6 bottles at a time. I would like the loader to be able to send as many bottles as possible to keep the filler running as efficiently as possible.


  • ADC_PLC_ENG (AutomationDirect)

    Is there a physical / design limitation that the filler can only accept 6 bottles at a time?

    Other than the sensor counting 6 bottles the rest of the code it timers. If there is a physical design reason you can only do 6, then adjusting timers for efficiency would be the only option to increase throughput. Although you might be able to add sensors to detect when filling is complete and the exit gate is clear, etc... and not use timers.

    With the information provided it is hard to know what your options are.

    Expand Post
  • Todd Dice (Customer)

    How many stations are on the filler? Images of the filler itself is helpful. I can see you're limiting the count with counter CT1. Your setpoint could be a variable DS5.

    • Marcos_VIRUN_ENG (Customer)

      So what I have done is repurposed a manual pinch filler to run automatically. The filler works by dispensing product through six small hoses that have nozzles at the end. The hoses are pinched closed by two pneumatic cylinders that are controlled by a solenoid. When the hoses are unpinched, product is allowed to flow through the hoses, out the nozzles and into the bottles. The code I uploaded earlier shows that I currently have the count in sensor count to six in order to trigger the closing of the entry gate (also a pneumatic cylinder). After a small delay, the hoses are unpinched for a user-defined amount of time, filling the bottles. Once the time has been reached, the hoses are pinched again, stopping the filling process. After another small delay, the exit gate opens, releasing the bottled to be capped, labled, etc. The exit gate closes, the entry gate reopens and the process begins again. My main issue is that if the bottle loader sends more than six bottles at a time, the counter resets or something and triggers the entry gate to close too early and the filler to start filling too soon.

       

      https://drive.google.com/file/d/1RtsAAjwJuObYmha6dO1c4BM1ardkMuY-/view?usp=sharing

       

      The link above takes you to a video of the filler

      Expand Post
      • Todd Dice (Customer)

        Can the bottles be back to back, even when filling? Meaning, can the stack of bottles not being filled be touching bottle #6? If so, Then you'd need a photoeye at position 1, one at 6, a cylinder to stop the bottles, and a cylinder to lock out bottles 7 and above. The bottles would block both eyes to start the filling process. Once complete, cylinder at bottle seven would "lock out" the stack of bottles, the cylinder holding bottle 1 would open releasing the filled bottles, and once photoeye at position 1 no longer "sees" bottles passing, closes the stop at position 1. Then, the "lock out" cylinder would release the stack to refill positions 1 thru 6. The action would repeat as long as there are bottles.

        Expand Post
  • ADC_PLC_ENG (AutomationDirect)

    Is it possible to reposition the counting photoeye to sense the location of the 6th bottle? Then you could count and/or use a timer to say the PE is blocked for "x" amount of time to indicate the range is full and close the entry gate and start the process. Then when releasing the entry gate bottle counting would not start until the first bottle upstream of the entry gate passed.

    Is it possible the PE is counting more than once per bottle? Each transition of the pe would count. If it flickered on/off /on with a single bottle the count would be off causing an issue.

    Expand Post
    • Todd Dice (Customer)

      +1 especially if the bottles ARE NOT opaque.

    • Marcos_VIRUN_ENG (Customer)

      I'm working with a limited amount of space so I wanted to see if I could leave the photoeye about two bottles downstream of bottle position number 6. However, if moving the photoeye to read at position 6 would make it easier, I will try to position it there and change to code to a timer instead of a counter.