model is freezing - using script to create conveyors system

model is freezing - using script to create conveyors system

gguedia5QZFN
Contributor Contributor
355 Views
8 Replies
Message 1 of 9

model is freezing - using script to create conveyors system

gguedia5QZFN
Contributor
Contributor

[ FlexSim 23.2.1 ]

Hello,

I am using a script to create my conveyor system. my script is very simple. in the beginning I create 48 conveyors. the first image below shows you how I create these conveyors. then I have few for loops where I create additional conveyors. the second image show an example of one of the for loop. I started having issue when I added a third for loop in the script. what happens is, when I run the script, it looks like the model is taking forever and nothing is happening. and I have to close the model to stop it. if I run the script in a debug mode with many debugging points, I won't have the issue and I will get the results that I expected.

1734061467270.png

1734061588178.png


0 Likes
356 Views
8 Replies
Replies (8)
Message 2 of 9

joerg_vogel_HsH
Mentor
Mentor
@Gilles, it looks like a runtime problem. There are functions, that you are calling that needs to be completed before another step of code begins or same function is allowed to be called again. I would recursively call my code by messages again and use in my code a switch structure to return in a next block of code. Messages have an ability start a new execution of a processor cycle.
0 Likes
Message 3 of 9

gguedia5QZFN
Contributor
Contributor

@Joerg Vogel , thank you!

I understand your solution but I can't figure out how to implement it in a script. I am using script (see image below) to write my code. so I don't see how to use message and switch in that script.

1734107121349.png

Could you send me an example of script which implements your solution?

0 Likes
Message 4 of 9

joerg_vogel_HsH
Mentor
Mentor

@Gilles please print to an output console c.

print(c);

if it is path to your script then try if you can call your script recursively. But be aware of an indefinite loop you may create.

@Gilles additional solution: Please put your script into an object trigger like on Message and On Reset Event and test it if you can get it to work by recursive calls in switch to case structure. This would tell you that my suspicion would be right. Then developers can suggest methods to get a similar approach for a loadable script code for a script window.

0 Likes
Message 5 of 9

logan_gold
Community Manager
Community Manager

Hi @Gilles ,

It's hard to know how to help without looking at your model. To receive a more accurate solution, please post your model or a sample model that demonstrates your question.

If your model contains sensitive information, you could first toggle your post as private using the "make private" option under your question's "gear" menu. Private questions are visible only to site moderators. You can also contact your local FlexSim distributor for phone or email help.

Message 6 of 9

Jeanette_Fullmer
Community Manager
Community Manager

Hi @Gilles ,

We haven't heard back from you. Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes
Message 7 of 9

gguedia5QZFN
Contributor
Contributor

I still have the same issue when I move the code in "on reset". Please note that I created another ticket where I am sharing the script with more details in a private mode 3 weeks ago ("

model stops working and is frozen

").

0 Likes
Message 8 of 9

gguedia5QZFN
Contributor
Contributor

Hi @Jeanette F ,

the issue is not resolved. 3 weeks ago I created a similar ticket in private mode where I am sharing the script and have not yet received any update.

refer to "

model stops working and is frozen

"

0 Likes
Message 9 of 9

logan_gold
Community Manager
Community Manager

I just wanted to note that we are helping with this model in a separate private question, but we have found an intermittent issue when using the Object.SetProperty() method when trying to set the EndLocation property of a Conveyor. We don't know the cause of the issue yet, but we're still digging into it.

0 Likes