question

Dj Moens avatar image
1 Like"
Dj Moens asked Phil BoBo commented

Error in random stream replications

Hi,

We had a strange bug sent to us by one of our clients. In the end there seems to be a bug in initializing the random streams based on replication number. It is also present in FlexSim 20.0.

You can test yourselves: create a model and set in the advanced tab of the experimenter to replicate stream x, with x>1. See attached model with a similar example.

Type a random function in the output console: for instance uniform(1,10). Save the model, close FlexSim and open the model. Press reset and execute the console. Mark the result. If you press reset again you will get a different value.

It seems that the very first time you have opened the model, the random streams are taken from replication 1 and not the set value in the advanced tab of the experimenter.

Rgds

DJTest_1.fsm

FlexSim 20.2.0
flexsim 20.2.0repeat random streams
test-1.fsm (38.2 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.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

I can't replicate this issue when using uniform(1,10). Seems just fine.

test_streams.fsm

Perhaps the issue is that you are using stream 120 in your example model, and FlexSim only resets streams 0-99 by default. See Anthony's comment in this old thread: https://archive.flexsim.com/threads/thread208.html.

See also https://docs.flexsim.com/en/20.2/Reference/CodingInFlexSim/CommandReference/Commands.html#randinit

If you want to reset streams above 100, then you need to call randinit() on reset for the highest stream number you want to initialize, or use the stream attribute (asserted by the getstream() command) in order to specify a stream value > 100 for FlexSim to automatically initialize.

(Edit: on further investigation, it seems to be having the issue you are seeing even if you have an object with the stream attribute using the stream you are testing. This seems like a bug; the work-around is pressing Reset twice the first time after opening your model. I'll add a case to the dev list. Test_1_PB1.fsm test_streams_2.fsm)

0 Likes 0 ·
test-streams.fsm (23.8 KiB)
test-1-pb1.fsm (39.5 KiB)
test-streams-2.fsm (39.8 KiB)

1 Answer

·
Dj Moens avatar image
1 Like"
Dj Moens answered Phil BoBo commented

Hi,

The problem origininated because the user was using default setting in process flow: exponential(0, 10, getstream(activity))

getstream(activity) will start at 101 if I am not mistaken.

DJ


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

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

I've found the bug and fixed it for the next bugfix release. Thanks for bringing this to our attention.

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.