How to get the output value of a source

How to get the output value of a source

jiayi_l
Not applicable
645 Views
4 Replies
Message 1 of 5

How to get the output value of a source

jiayi_l
Not applicable

[ FlexSim 19.0.0 ]

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

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

565109852
Contributor
Contributor

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.

0 Likes
Message 3 of 5

supportPHJ4A
Collaborator
Collaborator

@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
Message 4 of 5

jiayi_l
Not applicable

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

0 Likes
Message 5 of 5

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

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.