question

chia725 avatar image
0 Likes"
chia725 asked Jason Lightfoot commented

Syntax about position

my model; small model.fsm

Hello,

When i am setting up a little model for checking every station if there is thing to pick and also load at the same time. I encountered problem concerning the description of syntax and I am not sure how can I fix the syntax. I want to describe the queue which is an output of source. Thanks for any of your suggestion!


FlexSim 18.0.10
dot syntax
small-model.fsm (48.9 KiB)
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @chia725, was Jason Lightfoot'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 comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

The decision code needs to return a port.

Your first "if there's a thing to load" returns 0 or 1 depending on the contents of an object in the model. These are not valid port numbers for the decide activity.

In the second decide you have a malformed if statement - the condition needs to be in parentheses and the equivalence operator is == not =. When you have an if clause you should provide an action clause for when it's true. Remember this logic should also return a valid port number for the decide activity (1 or 2).

· 4
5 |100000

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

chia725 avatar image chia725 commented ·

Thank you so much for your help! I try to modify the syntax but there's still the same problem. And I'm also wondering that for the decide activity, my understanding is that the syntax is token.source1.outObjects[1].subnodes.length > 0

so I can choose where the token shall go by choosing the connectors out. That I'm wondering what does not valid port numbers for the decide activity means. Thank you for any of your help!

The attach is my modified file using 2021 version: small model-21_autosave.fsm

1696335866223.png

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ chia725 commented ·
You've two activities connected to the decide - they are numbered one and two - your code needs to return 1 or 2 to tell the token where to go based on those numbers. Click on the decide activity and you will see the connectors are numbered close to the decide activity. Those numbers are the port numbers of the decide activity's output connections.
0 Likes 0 ·
chia725 avatar image chia725 Jason Lightfoot ♦ commented ·

Thank you for your advice! I try to modify both of the decide activity with custom code as following. But there's appear to be the same problem. I was wondering if there's any solution that I can try. Thank you so much!small model-21-v2.fsm

1696336851181.png

0 Likes 0 ·
Show more comments

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.