Cancel
Showing results for 
Search instead for 
Did you mean: 

the difference of "OnExit" control between "@.move(l1,1)"and "@.move(l11)?

Valued Contributor
Valued Contributor

Hello,everyone

 

When i create a model, there several ways to moving  parts to a   line from a machine .I have  a problem:As is shown in the following picture with marks.

1.I wanna use the statement"@.move(L1,2)" .when the successor (L1) is full,  the current object (m1) will block, namely ,it cannot move the  the parts to line again. sometimes this way is very convinent and i wanna apply it.

 

2.While I use the statement"@.move(L1), it runs Ok.

 

3.What's more ,when i link the machine  to the line,it also runs OK.

 

This phenomenon looks interesting and meaningful.

How to deal with the statement"@.move(line,1)" to make the machine run smoothly?

 

I post a small model to describe the problem above, so that you can understand what i mean.

捕获.JPG

 

 

Looking forward to your directions!

Any help is great appreciated!

4 REPLIES

Re: the difference of "OnExit" control between "@.move(l1,1)"and "@.move(l1

Gears Phenom Gears Phenom
Gears Phenom

Hello,

 

When provided with a value like that it will try to move the MU in question to that location within the length oriented object, so in this case to 2m along L1 (from the picture), and if it does not do so then it will not move the part at all.

 

The Move function returns a boolean value, true if it did move the part and false otherwise, using this it is possible to keep attempting to move the part if needed or send it somewhere else all together, for example the code below should hold the part until there is space for it to be added (written from memory so might be slightly wrong)

 

while not @.move(L1, 2)
    wait 0.5
end

This will try to move the part, if it fails to do so then it will wait 0.5 seconds and try again, if at any point it moves the part then it will stop waiting.

 

Hope this helps,

JamesM

 

Re: the difference of "OnExit" control between "@.move(l1,1)"and "@.move(l1

Valued Contributor
Valued Contributor

Hi,JamesM

 

According to your directions,Now it runs smoothly!

 

Have a great time!

Re: the difference of "OnExit" control between "@.move(l1,1)"and "@.move(l1

Gears Phenom Gears Phenom
Gears Phenom

Hello, 

 

Checking your other new thread ( https://community.plm.automation.siemens.com/t5/Plant-Simulation-Forum/How-to-deal-with-the-onexitco... ) you have used a repeat until and not a while.

 

In this case you got to be careful, repeat until will run the code at least once before checking the condition, so in this case you would add a constant 0.5 second delay on parts exiting. Instead using the while loop it will check the condition first meaning if the part can move first time then you have not added any time delay into your system.

 

JamesM

Re: the difference of "OnExit" control between "@.move(l1,1)"and "@.move(l1

Valued Contributor
Valued Contributor

Hi,James_M

 

Thanks for your further direction.I'm used to use the "repeat ... until" to work it out. I'll be careful before I use it. If there is any error I will consider to adopt the"While loop".

 

Have a good time!