question

Jiayi L avatar image
0 Likes"
Jiayi L asked Joerg Vogel answered

How to get the output value of a source

I have a source connected with 4 queues. The way to send to port is First available. I want to get the output value of the source for each item and reuse it for the label Place.

This is what I've written in Assign Labels :

int output = Model.find("Source1").as(Object).stats.output.value;
Object Place = Model.find("Source1").as(Object).centerObjects[output];
return Place;

But it shows an error : Array index out of bounds

Can someone helps me to correct it or is there another way to do it?

Thanks

FlexSim 19.0.0
flexsim 19.0.0assign labelscostum code
· 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.

Jiayi L avatar image Jiayi L commented ·

I mean I want to get output ports number for each item

0 Likes 0 ·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered

There is an OnExit trigger of the source. You can use the Data Property “Set Label”

  • Object is item
  • Name is Place
  • Value is port

port is a source code declared variable evaluating the output port the item went out.

5 |100000

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

Bo.W avatar image
0 Likes"
Bo.W answered CSN commented

Of course, if you output to more than 4, you don't have so much output ports or center ports.

Newers are advised to contact local suppliers for more basic help @CSN ,Or you can refer to the user manual case.

· 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.

CSN avatar image CSN commented ·

@Jiayi L The latest version v2021.1 is recommended. In order to solve your problem better and faster, you can contact our local China partner (BJCSN), We will provide you with professional FlexSim technical Q&A. contact information: [email protected]; QQ:1093796825

0 Likes 0 ·