Buffer

OK however, if the parcels are already x mm apart why would you need all those sensors, in real life ythey would not be, you cannot stop a parcel on a conveyor at a sensor if the conveyor keeps going. practically the parcels would come in all sorts of distances apart, sometimes large gaps, the only way to line them up on a conveyor would be fit pneumatic stops that hold the parcel in place, in other words when conveuor is empty all stops are out
the system is started & when a parcel hits sensor 5 the stop comes up hodling it in position (or can be up at the start)
in the meantime another parcel is on it's way does not matter the distance but when parcel 1 is on sensor 5 the stop on sensor 4 position comes up ready for the next parcel, when this parcel is detected by the sensor position 4 stop comes up & so on until all 5 boxes are held on the 5 stops, the infeed feeding (either another conveyor or a person will not transfer any more onto conveyor 1, when all parcels are on the conveyor & stopped then all 5 stops are retracted to enable the parcels to continue onto next conveyor.
 
Yes the procedure you mentioned is right for that the code I had written but in a different way using all sensors but I can use one also. Can you tell me where to modify the code?
 
FYI it helps to put code in CODE blocks (click </> button above):
Code:
F_Trig_Buff_1_0(CLK := _IO2Sim.I_Buff_1_0_Sens_Occupied);
Buff_1_0_Falling_Edge := F_Trig_Buff_1_0.Q;

R_Trig_Buff_1_0(CLK := _IO2Sim.I_Buff_1_0_Sens_Occupied);
Buff_1_0_Rising_Edge := R_Trig_Buff_1_0.Q;

F_Trig_Buff_1_1(CLK := _IO2Sim.I_Buff_1_1_Sens_Occupied);
Buff_1_1_Falling_Edge := F_Trig_Buff_1_1.Q;

R_Trig_Buff_1_1(CLK := _IO2Sim.I_Buff_1_1_Sens_Occupied);
Buff_1_1_Rising_Edge := R_Trig_Buff_1_1.Q;

F_Trig_Buff_1_2(CLK := _IO2Sim.I_Buff_1_2_Sens_Occupied);
Buff_1_2_Falling_Edge := F_Trig_Buff_1_2.Q;

R_Trig_Buff_1_2(CLK := _IO2Sim.I_Buff_1_2_Sens_Occupied);
Buff_1_2_Rising_Edge := R_Trig_Buff_1_2.Q;

F_Trig_Buff_1_3(CLK := _IO2Sim.I_Buff_1_3_Sens_Occupied);
Buff_1_3_Falling_Edge := F_Trig_Buff_1_3.Q;

R_Trig_Buff_1_3(CLK := _IO2Sim.I_Buff_1_3_Sens_Occupied);
Buff_1_3_Rising_Edge := R_Trig_Buff_1_3.Q;

F_Trig_Buff_1_4(CLK := _IO2Sim.I_Buff_1_4_Sens_Occupied);
Buff_1_4_Falling_Edge := F_Trig_Buff_1_4.Q;

R_Trig_Buff_1_4(CLK := _IO2Sim.I_Buff_1_4_Sens_Occupied);
Buff_1_4_Rising_Edge := R_Trig_Buff_1_4.Q;

F_Trig_Conv_2_End(CLK := _IO2Sim.I_Conv_2_SensEnd_Occupied);
Conv_2_End_Falling_Edge := F_Trig_Conv_2_End.Q;

R_Trig_Conv_2_End(CLK := _IO2Sim.I_Conv_2_SensEnd_Occupied);
Conv_2_End_Rising_Edge := R_Trig_Conv_2_End.Q;

Buff_1_0_RTR := NOT _IO2Sim.I_Buff_1_0_Sens_Occupied;
Buff_1_1_RTR := NOT _IO2Sim.I_Buff_1_1_Sens_Occupied;
Buff_1_2_RTR := NOT _IO2Sim.I_Buff_1_2_Sens_Occupied;
Buff_1_3_RTR := NOT _IO2Sim.I_Buff_1_3_Sens_Occupied;
Buff_1_4_RTR := NOT _IO2Sim.I_Buff_1_4_Sens_Occupied;

Buff_1_0_Motor_Running := Buff_1_0_RTR;
Buff_1_1_Motor_Running := Buff_1_1_RTR;
Buff_1_2_Motor_Running := Buff_1_2_RTR;
Buff_1_3_Motor_Running := Buff_1_3_RTR;
Buff_1_4_Motor_Running := Buff_1_4_RTR;

FB_ItemDetection_Inst(
    I_Buff_1_0_Rising_Edge := Buff_1_0_Rising_Edge,
    I_Buff_1_1_Rising_Edge := Buff_1_1_Rising_Edge,
    I_Buff_1_2_Rising_Edge := Buff_1_2_Rising_Edge,
    I_Buff_1_3_Rising_Edge := Buff_1_3_Rising_Edge,
    I_Buff_1_4_Rising_Edge := Buff_1_4_Rising_Edge,
    I_Conv_2_End_Falling_Edge := Conv_2_End_Falling_Edge );

ItemCount   := FB_ItemDetection_Inst.ItemCount;
BufferFull  := FB_ItemDetection_Inst.BufferFull;
BufferEmpty := FB_ItemDetection_Inst.BufferEmpty;

FB_ModeSelector_Inst (
               I_ItemCount := ItemCount,
               I_BufferFull := I_BufferFull,
               I_SinkClear := I_SinkClear,
               BufferingToFullElapsed := BufferingToFullElapsed,
               O_Mode => SystemMode,
               O_Conv0Speed => Conv0Speed,
               O_BuffSpeed => BuffSpeed,
               O_Conv2Speed => Conv2Speed,
               O_StopConv0 => O_StopConv0 );
            

IF SystemMode = 'Buffering' THEN
    BufferFillTimer(IN := TRUE, PT := T#1S);
 
    IF BufferFillTimer.Q THEN
        IF ItemCount < BufferCapacity THEN
            ItemCount := ItemCount + 1;
            Conv0_Enable := TRUE;
        END_IF
        BufferFillTimer(IN := FALSE);
    END_IF
 
    IF ItemCount >= BufferCapacity THEN
        SystemMode := 'Buffer Full';
        Conv0_Enable := FALSE;
    END_IF
ELSE
    BufferFillTimer(IN := FALSE);
    Conv0_Enable := FALSE; 
END_IF

Conv_0 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Conv_0_SensStart_Occupied,
           I_DownstreamRTR := Buff_1_0.O_ThisConveyorRTR,
           I_ConveyorIsRunning := _IO2Sim.I_Conv_0_MotorIsRunning,
           I_Speed := Conv0Speed,
           O_MotorRun => _IO2Sim.O_Conv_0_Run,
           O_ThisConveyorRTR => Conv_0_RTR );
       
        
Buff_1_0 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Buff_1_0_Sens_Occupied,
           I_DownstreamRTR := Buff_1_1.O_ThisConveyorRTR,
           I_ConveyorIsRunning := _IO2Sim.I_Buff_1_0_MotorIsRunning,
           I_Speed := BuffSpeed,
           O_MotorRun => _IO2Sim.O_Buff_1_0_Run,
            O_ThisConveyorRTR => Buff_1_0_RTR );
        
Buff_1_1 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Buff_1_1_Sens_Occupied,
           I_DownstreamRTR := Buff_1_2.O_ThisConveyorRTR,
           I_ConveyorIsRunning := _IO2Sim.I_Buff_1_1_MotorIsRunning,
           I_Speed := BuffSpeed,
           O_MotorRun => _IO2Sim.O_Buff_1_1_Run,
           O_ThisConveyorRTR => Buff_1_1_RTR);
        
Buff_1_2 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Buff_1_2_Sens_Occupied,
           I_DownstreamRTR := Buff_1_3.O_ThisConveyorRTR,
           I_ConveyorIsRunning := _IO2Sim.I_Buff_1_2_MotorIsRunning,
           I_Speed := BuffSpeed,
           O_MotorRun => _IO2Sim.O_Buff_1_2_Run,
           O_ThisConveyorRTR => Buff_1_2_RTR);
        
Buff_1_3 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Buff_1_3_Sens_Occupied,
           I_DownstreamRTR := Buff_1_4.O_ThisConveyorRTR,
           I_ConveyorIsRunning := _IO2Sim.I_Buff_1_3_MotorIsRunning,
           I_Speed := BuffSpeed,
           O_MotorRun => _IO2Sim.O_Buff_1_3_Run,
           O_ThisConveyorRTR => Buff_1_3_RTR);

Buff_1_4 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Buff_1_4_Sens_Occupied,
           I_DownstreamRTR := Conv_2.O_ThisConveyorRTR,
           I_ConveyorIsRunning := _IO2Sim.I_Buff_1_4_MotorIsRunning,
           I_Speed := BuffSpeed,
           O_MotorRun => _IO2Sim.O_Buff_1_4_Run,
           O_ThisConveyorRTR => Buff_1_4_RTR);
       
        
Conv_2 (
           I_Enable := Enable,
           I_SensOccupied := _IO2Sim.I_Conv_2_SensStart_Occupied,
           I_DownstreamRTR := TRUE,
           I_ConveyorIsRunning := _IO2Sim.I_Conv_2_MotorIsRunning,
           I_Speed := Conv2Speed,
           O_MotorRun => _IO2Sim.O_Conv_2_Run,
           O_ThisConveyorRTR => Conv_2_RTR );

Is this right way because I tried using this code and run, the parcels are stopped at buff0,buff2,buff4 and not in buff1,buff3
 
Last edited:
Picture of the conveyor
what does that picture mean?

what are the black objects on the near side of the conveyor rail?

what are the yellow lines extending from the black object and across the conveyor?

what are the red lines extending from the black object to the box on the conveyor?
 
In post #16 you agreed that what I wrote is correct, however you did not mention before any stops, perhaps explain those questions that drbitboy mentioned above
 
The picture is from realvirtualio/demoautomationgame software for simulation
Yellow Line: separator between conveyor zones.
Red Line indicates a stopping or sorting point where actions like scanning or diverting occur.
Black: the surface of the conveyor belt itself.

Actually I tried all with different stop so I was confused that's why
 
The picture is from realvirtualio/demoautomationgame software for simulation
Yellow Line: separator between conveyor zones.
Red Line indicates a stopping or sorting point where actions like scanning or diverting occur.
Black: the surface of the conveyor belt itself.

Actually I tried all with different stop so I was confused that's why
Are those yellow lines physical separators or bars, that can hold an item back while the conveyor moves? or are they proximity sensors?
 
you still have not answered some questions but here is what I think is needed, without some form of actuated stops on a single conveyor it is impossible to get 5 parcels on it except if the parcels were exactly the same distance when fed onto it & probably would not happen in real life due to many factors including different sizes or at least would have to be fed on the previous conveyor or loading system with exact spacing.
So assume there are some sort of stops at each sensor then this is what I would do, again would not do it in ST as really is not made for bool logic however, could be done in ST but certainly easier to code & debug in ladder.
There is no need for Stop 1 as soon as the conveyor has the 5 parcels they are released if conveyor 2 is free.
When the parcels are in place all stops drop to release all parcels, when all 5 stations are clear allows next set of parcels only a simple thing & may require a little more work as soon as the last parcel leaves sensor 5 it would enable more to be added but probably not a problem.
1741775143136.png
 
Sorry for the late response as I have to try and finish writing the code and submit it by today evening (within 5 hrs) in ST programming as an exercise
 
Thanks for the above solution. As I am a beginner I coded the program on my knowledge but it's not working, is there any way can someone help me code this program in Structured text (TwinCAT),

Function
The buffer segment shall buffer up parcels beginning at the last segment (Seg_4) until it is full (when a parcel is placed on Seg_0). From this point, Conv_0 shall also stop when a parcel hits its last photo eye because Seg_0 is not RTR. The five boxes should be transported quickly via the next conveyor into the sink. Only when the last conveyor is cleared and free of parcels, the first conveyor is allowed to transport new parcels into the buffer.
So it‘s three different modes:
1. Buffering up. Parcels were transported into the buffer.
2. Buffer is full.
3 . Transport to sink.

Code:
 VAR_GLOBAL
    //IO variables to Conv_0
    I_Conv_0_SensEnd_Occupied AT %I*: BOOL;
    I_Conv_0_SensStart_Occupied AT %I*: BOOL;
    I_Conv_0_MotorIsRunning AT %I*: BOOL;
    O_Conv_0_Run AT %Q*: BOOL;
    O_Conv_0_Acc AT %Q*: REAL := 3.0;
    O_Conv_0_Speed AT %Q*: REAL := 0.0;
 
    //Buffer segments
        //IO variables to Buff_1_0
        I_Buff_1_0_Sens_Occupied AT %I*: BOOL;
        I_Buff_1_0_MotorIsRunning AT %I*: BOOL;
        O_Buff_1_0_Run AT %Q*: BOOL;
        O_Buff_1_0_Acc AT %Q*: REAL := 3.0;
        O_Buff_1_0_Speed AT %Q*: REAL := 0.0;
     
        //IO variables to Buff_1_1
        I_Buff_1_1_Sens_Occupied AT %I*: BOOL;
        I_Buff_1_1_MotorIsRunning AT %I*: BOOL;
        O_Buff_1_1_Run AT %Q*: BOOL;
        O_Buff_1_1_Acc AT %Q*: REAL := 3.0;
        O_Buff_1_1_Speed AT %Q*: REAL := 0.0;
     
        //IO variables to Buff_1_2
        I_Buff_1_2_Sens_Occupied AT %I*: BOOL;
        I_Buff_1_2_MotorIsRunning AT %I*: BOOL;
        O_Buff_1_2_Run AT %Q*: BOOL;
        O_Buff_1_2_Acc AT %Q*: REAL := 3.0;
        O_Buff_1_2_Speed AT %Q*: REAL := 0.0;
     
        //IO variables to Buff_1_3
        I_Buff_1_3_Sens_Occupied AT %I*: BOOL;
        I_Buff_1_3_MotorIsRunning AT %I*: BOOL;
        O_Buff_1_3_Run AT %Q*: BOOL;
        O_Buff_1_3_Acc AT %Q*: REAL := 3.0;
        O_Buff_1_3_Speed AT %Q*: REAL := 0.0;
     
        //IO variables to Buff_1_4
        I_Buff_1_4_Sens_Occupied AT %I*: BOOL;
        I_Buff_1_4_MotorIsRunning AT %I*: BOOL;
        O_Buff_1_4_Run AT %Q*: BOOL;
        O_Buff_1_4_Acc AT %Q*: REAL := 3.0;
        O_Buff_1_4_Speed AT %Q*: REAL := 0.0;
    //End of buffer segment
 
    //IO variables to Conv_2
    I_Conv_2_SensEnd_Occupied AT %I*: BOOL;
    I_Conv_2_SensStart_Occupied AT %I*: BOOL;
    I_Conv_2_MotorIsRunning AT %I*: BOOL;
    O_Conv_2_Run AT %Q*: BOOL;
    O_Conv_2_Acc AT %Q*: REAL := 3.0;
    O_Conv_2_Speed AT %Q*: REAL := 0.0;


END_VAR

Speeds
This time it is not enough to set a motor to run. In the interface, the default value for the motor's speed is 0.0, while the acceleration is 3.0. We don‘t use the ACC value, so leave it untouched.
But use two different speeds depending on what mode the system is. Use a low speed of 700 [mm/s] to buffer the parcels up and let them be transported to the sink with 2000 [mm/s].
Parcel detection
We don‘t use time-based functions in this project. So you have to implement an item detection on the last conveyor. Use the start sensor to register items to the conveyor and the sensor at the end to deregister them.


Thanks in advance................................................
 
sorry, but I still do not understand the process, and that code has only variable declarations, no operational statements. so there is nothing to "not work."

what does it mean at each proximity sensor when the input value is 1?

what does it mean at each proximity sensor when the input value is 0?

can a single parcel ever trigger two or more proximity sensors at the same time?

do the parcels ever slide/move relative to the conveyor, or do all parcels on the conveyor move at 700mm/s or 2000mm/s?

how will you know when the buffer conveyor is full?

what is the sink? is it on the same conveyor as the buffer? does the sink start immediately after the last proximity sensor? if the sink does not start immediately after the last proximity sensor on the buffer, how will the system know when five parcels have been transferred out of the buffer and onto the sink?

what happens if there are more than five parcels between the parcel at the last proximity sensor and the first proximity sensor?

what happens if the are less than five parcels between the parcel at the last proximity sensor and the first proximity sensor?
 
If I understand correctly packages move through a total of 7 conveyors and ends at a sink.

In the order of transportation:
  • Conveyor 0
  • Buffer 0
  • Buffer 1
  • Buffer 2
  • Buffer 3
  • Buffer 4
  • Conveyor 2
  • Sink (end station)
This is not complicated. IMHO the problem should be solved in it's entirety on paper - before writing a single line of code.

The program is the implementation of a solution. It's not the solution.

Also don't write the entire program and then try to debug it to find the problem.
  1. Write one piece / section
  2. Test that section so you know it works the way you want
  3. Test it together with the rest of the program
  4. Move to the next one.
Do it like that so you can have many small problems that are easy to fix - instead of one big mess that will take forever to untangle.
 
Thank you for the response


sorry, but I still do not understand the process, and that code has only variable declarations, no operational statements. so there is nothing to "not work."

what does it mean at each proximity sensor when the input value is 1? the sensor has detected the presence of a parcel and is "active" because a parcel is within its detection range.

what does it mean at each proximity sensor when the input value is 0? No parcel is detected and The sensor is "inactive" because there is no parcel within its detection range.

can a single parcel ever trigger two or more proximity sensors at the same time? Maybe during running

do the parcels ever slide/move relative to the conveyor, or do all parcels on the conveyor move at 700mm/s or 2000mm/s? here are 4 modes to be considered 1, buffering 2, bufferfull, 3, transport to sink 4, idle/empty. The procedure will have Conv0, buffer (seg0,seg1,seg2,seg3,seg4) and Conv2. The buffer (700mm/s) has 5 points where the parcels has to stay at the sensor of each buffer seg. Once the buffer is full it has transported to sink in 2000m/s.

how will you know when the buffer conveyor is full? the buffer has five segments of conveyor so I have to fill the buffer with five parcels.

What is the sink? Is it on the same conveyor as the buffer? Does the sink start immediately after the last proximity sensor? If not, how will the system know when five parcels have been transferred out of the buffer and onto the sink? The sink is the destination where parcels are transferred out of the buffer conveyor. There are 4 modes to be considered 1, buffering 2, bufferfull, 3, transport to sink 4, idle/empty. The procedure will have Conv0, buffer (seg0,seg1,seg2,seg3,seg4) and Conv2. The buffer (700mm/s) has 5 points where the parcels has to stay at the sensor of each buffer seg. Once the buffer is full it has transported to sink in 2000m/s. During transporting through Conv2, the Conv0 has to stop running. Once the transportation to sink is finished, Conv0has to run and fill the buffer with 5 parcels again

what happens if there are more than five parcels between the parcel at the last proximity sensor and the first proximity sensor? As per my exercise, it has only 5 parcels in the buffer sensor have to transport to the sink.

what happens if the are less than five parcels between the parcel at the last proximity sensor and the first proximity sensor? I have attached a photo for the conveyor image which I have been working.
The red big box shape is sink.
_WhatsApp Image 2025-03-13 at 12.37.13 AM.jpeg
 
If I understand correctly packages move through a total of 7 conveyors and ends at a sink.

In the order of transportation:
  • Conveyor 0
  • Buffer 0
  • Buffer 1
  • Buffer 2
  • Buffer 3
  • Buffer 4
  • Conveyor 2
  • Sink (end station)
This is not complicated. IMHO the problem should be solved in it's entirety on paper - before writing a single line of code.

The program is the implementation of a solution. It's not the solution.

Also don't write the entire program and then try to debug it to find the problem.
  1. Write one piece / section
  2. Test that section so you know it works the way you want
  3. Test it together with the rest of the program
  4. Move to the next one.
Do it like that so you can have many small problems that are easy to fix - instead of one big mess that will take forever to untangle.
Sure i will try
 

Similar Topics

The SF LED on an S7-300 CPU is illuminated and the diagnostics buffer has several events with Event ID: 16# 3942. The following description is...
Replies
7
Views
662
Hi All, can anyone help me with clearing data from the input that has given by the Scanner. (Clear Buffer) I tried COP and MOV instruction to...
Replies
16
Views
1,054
Hi, is there a way to change the time and date in the plc so they appear right in the diagnostic buffer. Also am I right in thinking the error is...
Replies
1
Views
264
I've been developing a tester using a Micro850 in Connected Components Workbench and part of that tester requires me to scan a barcode every test...
Replies
17
Views
3,332
Does anyone have any recommendations on UPS or buffer modules that can handle power flickers? We don't need a system that can back up for an...
Replies
1
Views
1,123
Back
Top Bottom