question

Afonso Teberga avatar image
0 Likes"
Afonso Teberga asked Joao Victor Amaral answered

Run replicates using FlexSimPy

Hi

I'm trying to run replications of a scenario using the FlexSimPy's runToTime() method. However, I haven't found a way to run the scenario with different random streams. Therefore, all results are deterministic. Is there a way to run replications with FlexSimPy?

These are the Python commands I'm using:


import os
import FlexSimPy as fp

scriptPath = os.path.dirname(os.path.realpath(__file__))
programDir = scriptPath + "\\..\\..\\..\\..\\program\\"

# Launch FlexSim
controller = fp.launch(evaluationLicense=True, showGUI=False, programDir=programDir)

# Open model
controller.open(scriptPath + "\\MeuModelo.fsm")

# Set parameter
controller.setParameter("NumOperators", 1)

# Reset and run
controller.reset()
controller.runToTime(1440)

# Get performance measure
print(controller.getPerformanceMeasure("Output"))


Thanks!

FlexSim 22.1.4
pythonexperimentflexsimpy
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·
@Afonso Teberga ,have you linked your random streams in FlexSim global preferences to your system time?

Earlier versions of FlexSim have started with a default set of seed values. Because your script starts FlexSim and you don’t just open models more often in an already running FlexSim environment, all random seed values are the same.

1 Like 1 ·
Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Afonso Teberga commented

One possibility would be to use a Model Parameter. Set its type to Pass-Through, and point it at the node MODEL:/Tools/randomrepeatrep. If that node isn't present, you can just add it, and give it number data.

Then, in your python code, call setParameter() to set that parameter, and then reset the model.

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

Afonso Teberga avatar image Afonso Teberga commented ·

Thanks, Jordan. It worked. I also had to pass evaluationLicense=False to the launch method.

0 Likes 0 ·
Joao Victor Amaral avatar image
0 Likes"
Joao Victor Amaral answered

Hi,

I'm using the same code as Afonso, but when I pass evaluationLicense=False, it returns the error "lc_flexinit failed: 1". I'm using an Educational License, but I already tried it using an Enterprise License and got the same error.

How can I fix it?

Thanks.

5 |100000

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

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.