Get Runtime error and can not find the solution

14 views
Skip to first unread message

Sebastian Scheidegger

unread,
Nov 30, 2022, 12:20:56 PM11/30/22
to Jaamsim Users Discussion Group
I found the program on GitHub a month ago and I am very excited about it. Thanks to all who are working on it! So, I am a newbie and still trying a lot how to realize certain things.
Now I come across a runtime error in a simulation and can not find the solution, so I turn with my question to the forum and ask for help.

I assign a priority to each entity as an expresion. In the upper model the queue is processed according to FIFO, in the lower model the queue is processed according to priority. For this I use NextEntity in the server and sort the list by priority.

'list=sort(|x,y|(x.prio < y.prio), [PRIO].QueueList); size(list) > 0 ? list(1) : null'

Everything works as planned, except that after 1,287.75 h I get the following runtime error:

Runtime error in replication 1 of scenario 1 at time 4635915,947700 s:
ServerPRIO2 keyword 'NextEntity':
Comparison method violates its general contract!


I can't find the problem and I don't know how to possibly get this programmed on a different (better) way. I think I'm not the first one who wants a different order than FIFO, maybe someone can post his solution or help me with my error.

Thanks a lot!
Sebastian

Error Entity Priority.cfg

Harry King

unread,
Nov 30, 2022, 2:15:55 PM11/30/22
to Jaamsim Users Discussion Group
Sebastian,

This appears to be a bug in the 'sort' function that we will investigate further. However, there is a better way to build your model. Instead of using the 'NextEntity' input for the Servers, you can set the Queue to automatically sort the queued entities in the desired order by setting its 'Priority' input to this.obj.prio. The attached model includes these changes.

Harry

Error Entity Priority - HK.cfg

Sebastian S.

unread,
Dec 1, 2022, 9:09:34 AM12/1/22
to Jaamsim Users Discussion Group
Hello Harry,

Thank you for the quick reply. For the priority I can use the priority field in the queue. However, this is only a part of my simulation, I have further simulated some other steering models, for example, where I sort by the shortest or longest processing time. Since the queue priority only allows integer values I had solved this using "NextEntity" and "Sort". But now I just multiply the processing time by 100.000 and get an integer value which I can use as priority.

this.obj.ist_ah/1[h]*100000

abs((17-(this.obj.ist_ah/1[h])))*100000

Should there also be a better solution for this I would be happy to hear from you again. Otherwise many thanks for your support. Everything works fine now!
Best regards Sebastian

Reply all
Reply to author
Forward
0 new messages