Buffer

There are 4 modes to consider:
1. buffering
2. buffer full,
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 must 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 the sink is finished, Conv0has to run and fill the buffer with 5 parcels again. Please respond. Thanks in advance.
 
Hm... First of all, you state segments, that implies there may be gaps between parcels, how do they stop assuming it is one conveyor, if not then why use sensors on all "SEGMENTS" just have a sensor to count the parcels, are the parcels all the same size ?.
If not & each segment does not have a stop so they all run how do you stop on each sensor, perhaps a diagram & how the parcels are expected to stay on each segment
 
Yes that's a start, how do the packages stay in position unless the conveyor is split into seperate drives the only ways a single length conveyor would work is if the packages are already spaced or there are some operated stops at each segment
 
OK so I think I know what you mean however, what exactly do you wish to know, how to write the code, what is your experience
What PLC are you using i.e. make & model.
Is this some student project the more information, show what you have done i.e. pdf of your code or some screen shots.
 
I wrote a code but the parcels are not running. I am using TwinCAT. I am a beginner and a learner. I/O
{attribute 'qualified_only'}
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;
O_ThisConveyorRTR: BOOL;
END_VAR
 
FUNCTION_BLOCK FB_ItemDetection
IF I_Buff_1_0_Rising_Edge OR I_Buff_1_1_Rising_Edge OR I_Buff_1_2_Rising_Edge OR I_Buff_1_3_Rising_Edge OR I_Buff_1_4_Rising_Edge THEN
IF ItemCount < 5 THEN
ItemCount := ItemCount + 1;
END_IF
END_IF;

IF I_Conv_2_End_Falling_Edge THEN
IF ItemCount > 0 THEN
ItemCount := ItemCount - 1;
END_IF
END_IF;

O_ItemCount := ItemCount;
BufferFull := (ItemCount = 5);
BufferEmpty := (ItemCount = 0);

FUNCTION_BLOCK FB_ModeSelector

IF I_ItemCount = 0 THEN
O_Mode := 'Idle/Empty';
O_Conv0Speed := 0.0;
O_BuffSpeed := 0.0;
O_Conv2Speed := 0.0;
O_StopConv0 := FALSE;

ELSIF I_BufferFull AND I_SinkClear THEN
O_Mode := 'Transporting to Sink';
O_Conv0Speed := 0.0;
O_BuffSpeed := 700.0;
O_Conv2Speed := 2000.0;
O_StopConv0 := TRUE;

ELSIF I_BufferFull AND NOT I_SinkClear THEN
O_Mode := 'Buffer Full';
O_Conv0Speed := 0.0;
O_BuffSpeed := 0.0;
O_Conv2Speed := 0.0;
O_StopConv0 := TRUE;

ELSIF I_ItemCount > 0 AND NOT I_BufferFull THEN
O_Mode := 'Buffering';
O_Conv0Speed := 700.0;
O_BuffSpeed := 700.0;
O_Conv2Speed := 0.0;
O_StopConv0 := FALSE;

ELSE
O_Mode := 'Idle/Empty';
O_Conv0Speed := 0.0;
O_BuffSpeed := 0.0;
O_Conv2Speed := 0.0;
O_StopConv0 := FALSE;
END_IF

FUNCTION_BLOCK FB_Conveyor

O_MotorRun := I_Enable AND I_DownstreamRTR;
O_ThisConveyorRTR := NOT I_SensOccupied;
 
FUNCTION_BLOCK FB_ItemDetection
...
Do you know what the scan cycle of your PLC is?

Do you understand how frequently that code is being run?

Do you know how to detect a rising edge of a proximity sensor input signal, and whether that signal need to be debounced?

Can you narrate a description of how some small portion of this process should run? E.g. what inputs it the PLC will observe for changes, what outputs the PLC will control, and what values of those inputs, and in what sequence, will cause the PLC to change the output values?
 
I think you will have a major problem with your item count to stsrt with, it appears you are oneshot on all sensors as every parcel will pass the first sensor that will count upto 5, the next one will count another 4 & so on down the line I do not see the point in using all 5 sensors as as you described it the parcels will be the same distance apart, also the distance of the gap between the parcels will have to match the distance between all the sensors.
I would simply say that when all sensors are covered then you have five parcels you do not need to count them or just use the first sensor to count when it reaches 5 then assume the conveyor has 5 & they should be in position (you could do a check at that point to see if all 5 are sensing). then send them to conveyor 2 if that one is deemed ready to take the 5 parcels.
It is pretty simple
Conveyor 1 free run conveyor
On First PE count on rising edge
When Count >= 5
Set conveyor 1 occupied (stop conveyor 1)
If conveyor 2 free
Run both conveyors
If conveyor 1 sensors clear for x seconds stop conveyor 1
ready for next 5 parcels.
 
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
 
How can that be if the parcels are the same distance appart, it seems that you have got it wrong how can the parcels stop at 0,2,4 but not the odd ones
Are you simulating this on the simulator, in that case you are not actually seeing parcels but just the bits set as if a parcel is there that is actually impossible as the conveyor is one piece therefore I think you have totally the wrong idea, I would suggest you try doing something different like a pick & place a simple one with a horizontal & vertical movement with sensors for the position.
For example start position is vertical cylinder up, horizontal is back gripper open.
On a start, if there is a part in a nest under the start position send the cylinder down, grip the part, send it back up, then send it forward, then down, to the place nest & open the gripper, then do the reverse
So you have 3 pneumatic cylinders with sensors for the positions (2 for each of the movement cylinders) no need for the gripper as assume when closed it has picked it up.
Simple to test either in a simulator or real PLC you don't need the real Inputs use internal bits , create a seperate block of code to simulate the sensors
For example when the vertical cylinder drives down in the simulation code just have the cylinder output onto a timer & when timer up Set the sensor bit for cylinder down at the same time reset the cylinder up sensor bit. this way you learn the basics of using code & being able to simulate using plc temporary cade rather than trying to flick switches at the right time.
 

Similar Topics

Hi everyone, Hoping to get some insight from the veterans here. I primarily work on the low-voltage/security integration side, but we've been...
12
Replies
1,408
Views
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...
7
Replies
2,426
Views
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...
16
Replies
2,333
Views
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...
1
Replies
679
Views
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...
17
Replies
4,921
Views
Top