question

shaon S avatar image
0 Likes"
shaon S asked Kavika F commented

Some functions cannot return normal values when Python is called

Hello, as you can see in this video, when I call Python, some functions do not return values properly. Would you please help me see what the problem is, and I would appreciate it.

Relevant attachments have been uploaded(PythonFunction)

FlexSim 22.2.1
pythonusercommand
pythonfunction.mp4 (9.4 MiB)
· 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.

1 Answer

Kavika F avatar image
0 Likes"
Kavika F answered Kavika F commented

Hey @shaon S, I think I found the problem. When using "range" in a for loop, the value passed in must be an int. num1 is a double, and so when trying to calculate range, it was working incorrectly. I tried casting num1 to an int in the range function and my FlexSim function works fine now.

1663619064350.png

1663619097054.png

(I was messing around with some values for testing, so I'm appending a random value and then the value num1 that many times. It should work fine with our code)


1663619064350.png (2.6 KiB)
1663619097054.png (11.1 KiB)
· 2
5 |100000

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