Stop Item on onmessage trigger

Stop Item on onmessage trigger

mohamed_slama
Not applicable
4 Views
5 Replies
Message 1 of 6

Stop Item on onmessage trigger

mohamed_slama
Not applicable

Hi,

In my simulation I want that if the photoeye 2 is blocked, it should send a message to photo eye 1. Then the photo eye1 should stop the item at the photoeye 1 position when it receives the message. Please can you help to resolve this problem ?

un-deux.fsm

,

0 Likes
Accepted solutions (1)
5 Views
5 Replies
Replies (5)
Message 2 of 6

SCHamoen
Advisor
Advisor

@Mohamed Slama Because the photocell or decision points do not have an onmessage trigger you should solve this differently. If you put a label on PE1 and set that label in PE2 to for instance 1, you can use the option Stop Item with the condition that the label should be 1

@Mohamed Slama @Sam Stubbs Sorry I totally overlooked the On Message trigger at the bottom!! But the concept still stands 😉

Message 3 of 6

sam_stubbsYXX86
Community Manager
Community Manager
Accepted solution

I see that you had your Photoeye 2 send a message to Photoeye 1 on the OnBlock trigger. I merely added a first parameter (a "1") to the message.

So the next step was to create a snippet of code in the OnMessage trigger of Photo Eye 1. The code is simply one line that sets a label (called "stopitem") to current (Photoeye 1) with the value of that message parameter we added (1).

setlabel(current,"stopitem",msgparam(1));

Finally, we add a trigger to the OnBlock trigger of Photoeye 1, that checks if it has a "stopitem" label with a value of 1 (true) on itself, if so, then stop the item.

Here is you example with those changes I made.

5922-un-deux-1.fsm

Message 4 of 6

mohamed_slama
Not applicable

stoppeur.fsm

@Sam Stubbs

First, I would like to thank you for your answer. That was very helpful.

Now I make some changes to the model to make the PE1 let the items resume when the PE2 is clear unfortunately it doesn't work. I did with the same way to block the items but it doesn't work.

Here is my modified model, can you please help me to resolve this problem.

Thank you very much.

0 Likes
Message 5 of 6

sam_stubbsYXX86
Community Manager
Community Manager

This looks like a separate issue than the first question. Do you mind posting it as a separate question? Sometimes when follow up questions are nested in old threads, the question gets lost. It's helpful for us if each new question has its own post.

0 Likes
Message 6 of 6

mohamed_slama
Not applicable

@Sam Stubbs

Sorry, but I thought that I could write this question here because it's a continuation of the previous question.

Should I write it in a new post to get an answer ?

Thank you 🙂

0 Likes