Cancel
Showing results for 
Search instead for 
Did you mean: 

How to write if statement based on machine's state code?

Valued Contributor
Valued Contributor

Hi:

 

I tried to write an if statement based on the machine's state code. SingleProc1 feeds to SingleProc2. Line2 is a buffer parallel to SingleProc2.

 

If SingleProc2 is failed or blocked

  SingleProc1 move part to line2                                          -- Line2 is a buffer parallel to SingleProc2

elseIf

 SingleProc2 is not failed or blocked, but if there are parts on Line2      -- to keep part sequence

SingleProc1 move part to Line2

else

 move to SingleProc2  -- if no parts on Line2, the part on SingleProc1 will take a short cut to move to SingleProc2

end

 

So how to use state code for SingleProc1?

 

Thanks

Steve

 

2 REPLIES

Re: How to write if statement based on machine's state code?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

you should take a look into the tutorial...

 

--If SingleProc2 is failed or blocked
if singleProc2.failed or singleProc2.resBlocked then
  --SingleProc1 move part to line2                                          -- Line2 is a buffer parallel to SingleProc2
  SingleProc1.cont.move(line2)

--elseIf  SingleProc2 is not failed or blocked, but if there are parts on Line2     
 -- to keep part sequence
elseIf  SingleProc2.failed= false and  SingleProc2.resBlocked=false and Line2.occupied then  
--SingleProc1 move part to Line2
SingleProc1.cont.move(Line2)
else

 --move to SingleProc2  -- if no parts on Line2, the part on SingleProc1 will take a short cut to move to SingleProc2
  SingleProc1.cont.move(SingleProc2)

end
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: How to write if statement based on machine's state code?

Valued Contributor
Valued Contributor

Thank you. It works.