My question is based on the snippet of code below. Is this the correct way of calling mutilpe subprograms. In speaking with a colleuge it was suggested that this method calls all of the subprograms at the sametime. Which can cause them to run out of sequence.
Instead of write the code over and over again for each condition. I created subprograms that i can call in certian conditions. The goal is to call the subprogram in sequence base on the condition. Is this the best method to achieve that? If not any ideas or suggestion would be grateful.
Loop
Pick Tray Routine
If Tray_Presnt≟ False and Tray_Nest≟ False and i_var_Stck_Cnt≥15
Wait: 0.5
Call Pick_Tray <<<<<< Call this one first run through this sequence first
Call Stack_Box <<<<<< Then call this program and run it’s sequence.
ElseIf Tray_Presnt≟ False and Tray_Nest≟ True and i_var_Stck_Cnt≥15
Call Pick_Tray
Call Stack_Box
ElseIf Tray_Presnt≟ False and Tray_Nest≟ False
‘Position_Select≔1’
Call Start_Up
Call Pick_Tray
Call Empty_Seq
Call Stack_VM
ElseIf Start_Up_Loop≥1 and Position_Select≥2 and Tray_Presnt≟ False
Call Pick_Tray
Call Empty_Seq
Call Stack_VM
ElseIf Start_Up_Loop≥1 and Position_Select≥2 and Tray_Nest≟ True
Call Pick_Tray
Call Empty_Seq
Call Stack_VM
ElseIf Start_Up_Loop≥1 and Position_Select≥1 and Tray_Nest≟ True
Call Pick_Tray
Call Empty_Seq
Call Stack_VM
ElseIf i_var_Stck_Cnt≥15 and VM_Full≟ True or Tray_Presnt≟ False and Tray_Nest≟ False and i_var_Stck_Cnt≥15
Call Pick_Tray
Call Stack_Box
Thank You.
Looks fine to me, and is exactly how I would recommend using subprograms. Cut down on the amount of copy/pasted code.
Eric,
Thank you for your quick responds and feedback. I figured this would be ideal for what we are trying to accomplish. I just wanted to confirm my colleague concern about potentially having a call run out of sequence.