You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old May 21st, 2022, 02:07 PM   #1
Robocoaster
Member
Turkey

Robocoaster is offline
 
Join Date: May 2022
Location: istanbul
Posts: 3
Conveyor Control

Hi everyone, I'm newbie at here.I need to help.Can you share your experience to me?
The scheme is as at picture.


The robot is palletizing at conveyor 1 and then send to me palletcompletedbit. After, ı must move this pallet to conveyor 2 with plc code. Also my customer want to run conveyors manually via buttons.

My code is :

[/ladder][/code]
timer_conv2empty(in:=,pt:=t#20s);

CASE MachineMode OF
Man:
StateAuto:=0;
StateConv1:=0;
StateConv2:=0;

IF AlarmStatus THEN
StateMan:=99;
END_IF
IF StateMan=0 AND bttnMode_RTRIG.Q THEN
MachineMode:=Auto;
END_IF

CASE StateMan OF
0: (*Manual control*)
IF bttnConveyor1 THEN
IF NOT in_Sensor1 THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF
END_IF

IF bttnConveyor2 THEN
IF NOT in_Sensor2 THEN
out_Conveyor2:=TRUE;
ELSE
out_Conveyor2:=FALSE;
END_IF
END_IF

IF bttnConveyorTransfer THEN
IF NOT in_Sensor2 THEN
out_Conveyor1:=TRUE;
out_Conveyor2:=TRUE;
ELSE
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
END_IF
END_IF

IF NOT bttnConveyor1 AND NOT bttnConveyorTransfer THEN
out_Conveyor1:=FALSE;
END_IF

IF NOT bttnConveyor2 AND NOT bttnConveyorTransfer THEN
out_Conveyor2:=FALSE;
END_IF
99: (*Alarm*)
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
IF NOT AlarmStatus THEN
StateMan:=0;
END_IF
END_IF
END_CASE;
Auto:
StateMan:=0;

IF AlarmStatus THEN
StateMan:=99;
END_IF
IF (StateAuto=0 OR StateAuto=99) AND bttnMode_RTRIG.Q THEN
MachineMode:=Man;
END_IF

CASE StateAuto OF
0: (*Stop*)
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
IF in_StartButton_RTRIG.Q THEN
StateAuto:=1;
END_IF
1: (*Running*)
IF in_StopButton_RTRIG.Q THEN
StateAuto:=0;
END_IF

CASE StateConv1 OF
0: (*initial*)
out_Conveyor1:=FALSE;
IF NOT in_Sensor1 THEN
StateConv1:=1;
ELSE
StateConv1:=2;
END_IF
1: (*conveyor empty*)
IF palletcompletedbit THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF

IF out_Conveyor1 AND in_Sensor1 THEN
StateConv1:=2;
END_IF
2: (*conveyor loaded*)
IF StateConv2=1 THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF

IF NOT in_Sensor1 AND in_Sensor2 THEN
StateConv1:=1;
END_IF
END_CASE;

CASE StateConv2 OF
0: (*initial*)
out_Conveyor2:=FALSE;
IF NOT in_Sensor2 THEN
StateConv2:=1;
ELSE
StateConv2:=2;
END_IF
1: (*conveyor empty*)
IF StateConv2=2 THEN
out_Conveyor2:=TRUE;
ELSE
out_Conveyor2:=FALSE;
END_IF

IF out_Conveyor2 AND in_Sensor2 THEN
StateConv2:=2;
END_IF
2: (*conveyor loaded*)
timer_conv2empty.IN:=NOT in_Sensor2 ;
IF timer_conv2empty.Q THEN
StateConv2:=1;
END_IF
END_CASE;
99: (*Alarm*)
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
IF NOT AlarmStatus THEN
StateAuto:=0;
END_IF
END_CASE;
END_CASE;
[code]
[ladder]
What should I do if the pallet stays between the sensors?
What should I do if the sensors are triggered incorrectly?

thank you for reply

Last edited by Robocoaster; May 21st, 2022 at 02:26 PM.
  Reply With Quote
Old May 21st, 2022, 02:23 PM   #2
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 5,150
Welcome to the forum!

If you put [/ladder] after the code and [ladder] before the code, you can keep the indentation ([/code] and [code] also works but it more limited by width):


timer_conv2empty(in:=,pt:=t#20s);

CASE MachineMode OF
Man:
StateAuto:=0;
StateConv1:=0;
StateConv2:=0;

IF AlarmStatus THEN
StateMan:=99;
END_IF
IF StateMan=0 AND bttnMode_RTRIG.Q THEN
MachineMode:=Auto;
END_IF

CASE StateMan OF
0: (*Manual control*)
IF bttnConveyor1 THEN
IF NOT in_Sensor1 THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF
END_IF

IF bttnConveyor2 THEN
IF NOT in_Sensor2 THEN
out_Conveyor2:=TRUE;
ELSE
out_Conveyor2:=FALSE;
END_IF
END_IF

IF bttnConveyorTransfer THEN
IF NOT in_Sensor2 THEN
out_Conveyor1:=TRUE;
out_Conveyor2:=TRUE;
ELSE
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
END_IF
END_IF

IF NOT bttnConveyor1 AND NOT bttnConveyorTransfer THEN
out_Conveyor1:=FALSE;
END_IF

IF NOT bttnConveyor2 AND NOT bttnConveyorTransfer THEN
out_Conveyor2:=FALSE;
END_IF
99: (*Alarm*)
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
IF NOT AlarmStatus THEN
StateMan:=0;
END_IF
END_IF
END_CASE;
Auto:
StateMan:=0;

IF AlarmStatus THEN
StateMan:=99;
END_IF
IF (StateAuto=0 OR StateAuto=99) AND bttnMode_RTRIG.Q THEN
MachineMode:=Man;
END_IF

CASE StateAuto OF
0: (*Stop*)
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
IF in_StartButton_RTRIG.Q THEN
StateAuto:=1;
END_IF
1: (*Running*)
IF in_StopButton_RTRIG.Q THEN
StateAuto:=0;
END_IF

CASE StateConv1 OF
0: (*initial*)
out_Conveyor1:=FALSE;
IF NOT in_Sensor1 THEN
StateConv1:=1;
ELSE
StateConv1:=2;
END_IF
1: (*conveyor empty*)
IF palletcompletedbit THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF

IF out_Conveyor1 AND in_Sensor1 THEN
StateConv1:=2;
END_IF
2: (*conveyor loaded*)
IF StateConv2=1 THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF

IF NOT in_Sensor1 AND in_Sensor2 THEN
StateConv1:=1;
END_IF
END_CASE;

CASE StateConv2 OF
0: (*initial*)
out_Conveyor2:=FALSE;
IF NOT in_Sensor2 THEN
StateConv2:=1;
ELSE
StateConv2:=2;
END_IF
1: (*conveyor empty*)
IF StateConv2=2 THEN
out_Conveyor2:=TRUE;
ELSE
out_Conveyor2:=FALSE;
END_IF

IF out_Conveyor2 AND in_Sensor2 THEN
StateConv2:=2;
END_IF
2: (*conveyor loaded*)
timer_conv2empty.IN:=NOT in_Sensor2 ;
IF timer_conv2empty.Q THEN
StateConv2:=1;
END_IF
END_CASE;
99: (*Alarm*)
out_Conveyor1:=FALSE;
out_Conveyor2:=FALSE;
IF NOT AlarmStatus THEN
StateAuto:=0;
END_IF
END_CASE;
END_CASE;


__________________
_
Brian T. Carcich
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
iii) Measurement is hard.
iv) I solemnly swear that I am up to no good
  Reply With Quote
Old May 21st, 2022, 10:07 PM   #3
Hellsbishop34
Member
United States

Hellsbishop34 is offline
 
Join Date: May 2022
Location: PA
Posts: 13
CASE StateConv1 OF 
0: (*initial*)
out_Conveyor1:=FALSE;
IF NOT in_Sensor1 THEN
StateConv1:=1;
ELSE
StateConv1:=2;
END_IF
1: (*conveyor empty*)
IF palletcompletedbit THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF

IF out_Conveyor1 AND in_Sensor1 THEN
StateConv1:=2;
END_IF
2: (*conveyor loaded*)
IF StateConv2=1 THEN
out_Conveyor1:=TRUE;
ELSE
out_Conveyor1:=FALSE;
END_IF

IF NOT in_Sensor1 AND in_Sensor2 THEN
StateConv1:=1;
END_IF
END_CASE;

CASE StateConv2 OF
0: (*initial*)
out_Conveyor2:=FALSE;
IF NOT in_Sensor2 THEN
StateConv2:=1;
ELSE
StateConv2:=2;
END_IF
1: (*conveyor empty*)
IF StateConv2=2 THEN
out_Conveyor2:=TRUE;
ELSE
out_Conveyor2:=FALSE;
END_IF

IF out_Conveyor2 AND in_Sensor2 THEN
StateConv2:=2;
END_IF
2: (*conveyor loaded*)
timer_conv2empty.IN:=NOT in_Sensor2 ;
IF timer_conv2empty.Q THEN
StateConv2:=1;
END_IF
END_CASE;


*Disclaimer* I did not proof read the code. Quick skim.

Buffer the sensor inputs with Rising and Falling edge triggers. You can use these edges for tracking purposes and proper sequence. Conveyor is loaded on the rising edge of sensor 1. The falling edge would set a "transitioning" state. You can add a timer to this bit to alarm that sensor 2 never saw a transition. If sensor 2 shows a rising edge without a transitioning flag then you have an improper sequence. Assuming I understand your layout correctly.
  Reply With Quote
Old May 21st, 2022, 11:47 PM   #4
jstolaruk
Lifetime Supporting Member
United States

jstolaruk is offline
 
Join Date: Dec 2004
Location: Detroit, SE Michigan
Posts: 3,781
In my industry, these are commonly called zone conveyors but we try to use (2) sensors per zone, pallet_entering (which you have) and pallet_present. Makes the logic easier for Sparky.
__________________
I don't always test my code but when I do, I do it in production.
  Reply With Quote
Old May 23rd, 2022, 05:35 AM   #5
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 4,029
Personally, I would do this in ladder, it's easier the OP did not state what PLC & it seems a little complicated & messy.
Here is one that works (well as I assume what is required), the OP did not state if in manual the operator controls the conveyors ignoring certain things like the sensors or signal from palletiser etc. so assume not, have not included all things like that.
A simple alarm if for example the conveyors run for more time than expected to move pallet from conveyor 1 to conveyor 2 sensor then it assumes stuck pallet regardless of if moved off sensor 1.


PLS(Auto_Man,Auto_Sw_Rising_Pulse); (* Create a rising pulse on switching to auto *)
PLF(Auto_Man,AUto_Sw_Falling_Pulse); (* Create a falling pulse when switching to Manual*)

IF Auto_Sw_Rising_Pulse OR AUto_Sw_Falling_Pulse THEN (*Onswitching from Auto to Man or man to Auto stop the conveyors *)
SEQ:= 0;
END_IF;
IF SEQ = 0 AND Pallet_Comp_Bit AND PE01 AND NOT PE02 AND Auto_Man THEN
SEQ:= 1; (* Run Conveyor 1 to Conv 2 iin Auto*)
END_IF;

IF SEQ = 1 AND PE02 THEN (* When in Auto & pallet reaches PE02 then set SEQ back to 0 *)
SEQ:= 0;
END_IF;

IF SEQ = 0 AND PE01 AND Start_Button AND NOT PE02 AND NOT Auto_Man THEN
SEQ:= 11; (* Run conveyors in man*)
END_IF;

IF PE02 OR Stop_Button AND SEQ = 11 THEN (* Stop in Manual if reaches PE02 or Stop pressed *)
SEQ:=0;
END_IF;

CASE SEQ OF (* Run the conveyors*)
0: Conv_1_Out:= FALSE;
Conv_2_Out:= FALSE;
1: Conv_1_Out:= TRUE;
Conv_2_Out:= TRUE;
10: Conv_1_Out:= FALSE;
Conv_2_Out:= FALSE;
11: Conv_1_Out:= TRUE;
Conv_2_Out:= TRUE;
END_CASE;

(* Alarm handling*)
Alarm_Timer(IN:= (Conv_1_Out OR Conv_2_Out),PT:=T#10s); (* If conveyors run for more time than expected then set alarm*)
IF Alarm_Timer.Q THEN
SEQ:= 99;
Conv_1_Out:=FALSE;
Conv_2_Out:=FALSE;
END_IF;

IF SEQ = 99 AND Alarm_Reset THEN (*Alram reset *)
SEQ:= 0;
END_IF;



Did not add any on/off delay on the photocells, this would depend on if the natural stop of the conveyors ensured the photocells were fully covered or if the pallets would have gaps that the photocells could see.

Last edited by parky; May 23rd, 2022 at 05:47 AM.
  Reply With Quote
Old May 23rd, 2022, 06:45 AM   #6
BachPhi
Member
United States

BachPhi is offline
 
Join Date: Dec 2007
Location: Los Alamos
Posts: 564
Yes, the 'real' ladder logic will be shine in this case. I am guessing his homework requirement to be ST.
your logic is a better than the two previous two.
but it wont work because of PE01 need to be broken "IF SEQ = 0 AND Pallet_Comp_Bit AND PE01 AND NOT PE02 AND Auto_Man THEN".

I'd start the seq when receiving the complete bit. run it to PE01, then start Conv2 at that point.
__________________
================================================== ====
  • This is NOT alt.read.my.mind.
  • No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind. Savvy?
================================================== ===

Last edited by BachPhi; May 23rd, 2022 at 07:22 AM.
  Reply With Quote
Old May 23rd, 2022, 07:32 AM   #7
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 4,029
It is assumed that PE01 is made when the pallet is placed on the conveyor this works I have simulated it. It assumes that the pallet is put on the conveyor, the PE is made which tells the palletizer to do what ever it needs to do then the palletizer gives the signal to transfer it. But yes if the PE is not made & only rely on the palletizer to initiate it then it would need to be modified, I realise now that the picture of the two conveyors shows the pallets not on the PE's however, this is wrong as the conveyor 2 PE is not covered which it would have to be to stop the sequence (or rely on timers to assume pallet in middle of conveyor (very poor design if so ).when passed from conveyor 1 to 2, the OP's description is poor in regarding exactly how it should work.

Last edited by parky; May 23rd, 2022 at 07:36 AM.
  Reply With Quote
Old May 23rd, 2022, 08:17 AM   #8
L33er
Member
United States

L33er is offline
 
L33er's Avatar
 
Join Date: Feb 2021
Location: North
Posts: 168
Are you saying his picture is not clear? lol.
  Reply With Quote
Old May 23rd, 2022, 09:05 AM   #9
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 15,434
So only one pallet to be present on each conveyor ever ?
Or can one pallet start leaving conveyor 2 when the pallet on conveyor 1 has begun to leave ?
Shall the sensor at the entry of conveyor 2 also function as the exit sensor for conveyor 1 ?
Can the pallet extend from conveyor 2 onto conveyor 1 without conveyour 1 running until the sensor 1 is activated ?
Also, consider error scenarios, such as there is a pallet on conveyor 2, and when it starts to move but no signal from sensor 1 is received, there is possibly a blockage.
Similar, the signal(s) on sensor 1 or sensor 2 stays on and does not go off.
etc..
What shall be the functionality of the buttons ?

Write a detailed spec of the programs functionality, and the actual code almost writes itself.
__________________
Jesper
NOTICE:
JesperMP can be impolite, has passive-aggressive tendencies and may use sarcasm !
  Reply With Quote
Old May 23rd, 2022, 10:57 AM   #10
Robocoaster
Member
Turkey

Robocoaster is offline
 
Join Date: May 2022
Location: istanbul
Posts: 3
Thank you all answers. You have been very helpful.
  Reply With Quote
Old May 23rd, 2022, 11:04 AM   #11
Robocoaster
Member
Turkey

Robocoaster is offline
 
Join Date: May 2022
Location: istanbul
Posts: 3
Actually, every conveyor have a sensor. I dont want to lose pallet at conveyor. So, ı set persistent that conveyors state. Also, these buttons at HMI.So, I didn't use rising or falling edge.
Is this true ?
  Reply With Quote
Old May 23rd, 2022, 11:15 AM   #12
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 4,029
@Jesper: My thoughts exactly, I have done many of these & in all cases the sensor is covered when pallet in place, did many systems where the pallets came in different sizes i.e. half euro, full Euro, 1.5 Euro, 2 Euro & if I remember correctly 2.5 Euro sizes, so the last two would straddle 2 of the conveyors. These were feed conveyors to a Strapper a total of 14 & two on the outlet. The pallets were measured in a number of different configurations just before the Strapper, by length, width, if pallet had bottom runners or not (if runners then swords were used to feed the straps or straps were sent between the conveyor rollers) the strapping patterns were determined by the above i.e. could be 3 or 4 straps across, if half Euro then one strap each way, full Euro 2 straps each way so about 30 strap patterns in total.
  Reply With Quote
Old May 23rd, 2022, 01:36 PM   #13
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 4,029
Based on what I did last time here is a more concise bit of code that does the same job


PLS(Auto_Man,Auto_Sw_Rising_Pulse); (* Create a rising pulse on switching to auto *)
PLF(Auto_Man,AUto_Sw_Falling_Pulse); (* Create a falling pulse when switching to Manual*)

IF Pallet_Comp_Bit AND PE01 AND NOT PE02 AND Auto_Man THEN
Conv_1_Out:= TRUE; (* Run Conveyor 1 to Conv 2 iin Auto*)
Conv_2_Out:= TRUE;
END_IF;

IF PE01 AND Start_Button AND NOT PE02 AND NOT Auto_Man THEN
Conv_1_Out:= TRUE; (* Run Conveyor 1 to Conv 2 iin Man*)
Conv_2_Out:= TRUE;
END_IF;

IF Stop_Button AND NOT Auto_Man OR PE02 THEN (* Stop in Manual if reaches PE02 or Stop pressed *)
Conv_1_Out:= FALSE; (* Stop Conveyor 1 to Conv 2 iin Auto*)
Conv_2_Out:= FALSE;
END_IF;

(* Alarm handling*)
Alarm_Timer(IN:= (Conv_1_Out OR Conv_2_Out),PT:=T#10s); (* If conveyors run for more time than expected then set alarm*)
IF Alarm_Timer.Q THEN
Alarm_Bit:= TRUE;
Conv_1_Out:=FALSE;
Conv_2_Out:=FALSE;
END_IF;

IF Alarm_Reset THEN (*Alram reset *)
Alarm_Bit:= FALSE;
END_IF;

  Reply With Quote
Old May 23rd, 2022, 02:10 PM   #14
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 4,029
Could have done it in less lines but at my age all those brackets make my brain hurt so here is a ladder one rung, missing are the alarm for jammed pallet & the stop if switched from auto to man or back.
Just goes to show that ST is fine for calcs but for Boolean Lad is faster to code (well in my old brain) & easier to understand.
Attached Images
File Type: png Conv Lad.png (21.8 KB, 51 views)
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:41 PM.


.