question

Sam avatar image
0 Likes"
Sam asked Jason Lightfoot edited

How to get parameters between Object and Object?

For example I draw PhotoEye on my conveyor1 and a box is covered PE1 then I want to send my box to other conveyor lines by getting a parameter and replacing agv's port number. I dont how to do it.

FlexSim 22.0.2
photoeyeparam
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Andrew O avatar image Andrew O ♦ commented ·

Hi @Sam, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Jason Lightfoot edited

This is quite a broad question, as there are many different possible solutions to situations like this.

In the attached model I added a pointer label to the queue that refers to the Photo Eye. In the Send to Port option the queue checks the current status of the Photo Eye. If it is not "blocked", the item is send to port 1, otherwise to port 2.

ObjectRefExample.fsm

Instead of the pointer label, you could use a centerport connection between the two objects to get a reference to each other.

Or you could use a global variable that gets set by the Photo Eye and read by the queue.

You could also use the "Model.find()" command to get a reference to an object in the model , though if you access it often, it's usually better to store it somewhere instead of having to search for the object each time.

There's probably even more ways but which is "best" always depends on the given situation (which object accesses which other object and how often) as well as personal preference.


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

A pointer label has advantages over centerports in that the centerport connection number can change if you then add and remove other connections. The centerport reference by number also doesn't make it obvious what is the intent of an expression, whereas a well named pointer label makes it clear which relation you are trying to reference. This improves code/expression understanding and maintenance.


The pointer label also has advantage over find() in that it will still work if you decide to rename the object.

Lastly - note that if you copy/paste groups of objects that refer to each other the pointer references correctly update to the new group of objects. (centerports also do this)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.