Hello,
Below a snippet of some code. Everything works fine until the redirect function is excecuted. Any ideas?
Thanks in advance!
Hello,
Below a snippet of some code. Everything works fine until the redirect function is excecuted. Any ideas?
Thanks in advance!
Hi @Roeland S, was steven.hamoen's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.
@Roeland S If I look at the error message it point to an index out of range. So looking at your code I would suspect the token.DuwKonvooi[i+1]. With the snippet I can't say what i is and if it is out of bounds. You could place a breakpoint and look at it's value.
The other thing is that you use a "2" in the redirect statement. This most likely should work, but I would suggest you use the official constants/macros that are defined for it. Firstly you know absolutely sure that it does work and secondly your code is better understandable if if you revisit after a while. Options are:
REDIRECT_AND_WAIT - if not redirected before arrival, the agv will wait at the destination until redirected
REDIRECT_AS_FINAL - the destination becomes the new final destination for the agv
REDIRECT_AND_CONTINUE_ON_ARRIVAL - the agv will continue to the final destination after arriving at the intermediate destination
REDIRECT_AND_CONTINUE_ON_PRE_ARRIVAL - the agv will continue to the final destination after pre-arriving at the intermediate destination (it will not decelerate to a stop)
Steven,
I had better posted the entire function in the code snippet. As you can see below, i is always smaller than the length of the array such that the i+1 returns a valid object (control point). If i debug this code, it runs fine until the redirect function. I originally wrote the enumerate "REDIRECT_AS_FINAL" but changed it as a test because the manual indicates the second argument should be an integer.
I really don't understand why this redirect statement throws an exception. Hence, i really hope you could give me any advice...
@Roeland S It is very difficult to debug without the model (as you can understand) but from your earlier posts I understood that you can't post it. So we have to keep guessing. First thing ofcourse you checked that newDest is valid and an existing object and that it is connected to the AGV network?
Also that agv is a valid agv.
By the way is the code after the redirect ever executed. So have you placed a print statement directly after the redirect statement?
Because the token.DuwKonvooi[i++] can run out of boundsDuring debugging (F10), i've noticed that the code after the redirect statement is never executed. I've added the print function, which confirms it.
Indeed, I cannot share the model, but is it possible to have a short call about it? I then can give the the controls to access the model.
@anthony.johnson We have looked at it with an online session. It looks like the redirect throws this error. (the redirect in the code we looked at is REDIRECT_AS_FINAL and not 2 as above) It is redirecting the AGV to the next CP it encounters and that is also already claimed by this AGV. We have tried to create a simple model to reproduce, but that worked fine. Would this remark together with the exception, give you an idea what could be wrong? Or should Roeland post the model in a privat question?
The "invalid index" exception is thrown when using treenode.subnodes. The question is, whose code is using treenode.subnodes? From the exception screenshot, I can only see MODEL:/Tools/ProcessFlow/to. If that path is the correct path to the code that's executing, then it's our code throwing the exception. Otherwise, you can try stepping into the redirect function to see if there is any user code being called as part of the redirect. Other than that I'd have to see the model. You can post a private question, tag me on it, and I will take a look at it.
13 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved