Tom van Es Posted June 20, 2019 Share Posted June 20, 2019 Hello and thanks for reading, I'm building a model that should replicate how vessels are handled within a port area. Within this area, there are multiple Terminals (servers) and ships (entities) that have to visit any number of terminals. Their processing times at each server vary. With their sequences predefined, I have managed to model this accurately, based on a first come first serve or another dispatching rule. I'd like to implement a dynamic sequence. 1) How can I model a certain degree of freedom in their sequences - e.g. a vessel is free to choose between sequence XABZ or XBAZ, depending on the queue size at A or B at the time of leaving X? However, in reality, these vessels enter the system, draft a sequence that is suitable for their loading plan, and then try to reserve serving times at the various terminals. I have tried wrapping my head around ways to model this, but can't seem to think of a way how. I could create a large amount of state variables for each server, that denotes whether or not a certain slot has been reserved, but that is not suitable for running long simulations. I read on this forum post that I could perhaps use a storage element, and store the reservations in there. How would I go about saving reservation-related information? Should I store that on the barge entity or in the terminal's reservation storage? How should I go about modelling timeslots in itself? 2) How can I model 'future' reservations of entities at the various servers? Finally, if this functions properly, and entities can request reservations at the various servers, I would like to have the servers compare all the requests at a certain cutoff time, and for all the doubly requested slots have it allocate the reservation based on the entities' characteristics. 3) Would I have to store the reservation data on both the entity and the server side for them to both make calculations with them, or is it enough to have them all on the server side, and denote whether they have been accepted with e.g. a boolean property? My apologies for the long post. Do not hesitate to ask for more information. Kind regards, Tom Link to comment Share on other sites More sharing options...
Tom van Es Posted June 24, 2019 Author Share Posted June 24, 2019 (edited) Hi, Perhaps my first question was a bit too complex. Maybe someone has experience with a much more limited part of my issue; timeslots. Has anyone modelled timeslots before? I'm thinking of creating a list of timeslots when i initialize my run, based on the "Run.EndingTime" and my model property: "TimeSlotLength". However, is there some built-in function I can use to recreate something similar to the following pseudocode? For i in 1 to (Run.EndingTime / TimeSlotLength): list(i) = i*TimeSlotLength; Perhaps there is a much easier way to create these timeslots? Kind regards, Tom Edited June 24, 2019 by Tom van Es Posted too early. Link to comment Share on other sites More sharing options...
jzhou Posted June 25, 2019 Share Posted June 25, 2019 maybe you can use a vector for the list, as attached. Model Vector_JZ.spfx 1 Link to comment Share on other sites More sharing options...
gocken Posted June 25, 2019 Share Posted June 25, 2019 You can predetermine the length of a timeslot then the number of timeslots. By multiplying length of the timeslot with the number of timeslots you can calculate the total simulation time. At the beginning of each timeslot you can trigger a process by using a timer element for performing any task within that timeslot. Note that, you should set the iterval lenth of the timer element to the legth of each timeslot. 1 Link to comment Share on other sites More sharing options...
Tom van Es Posted June 25, 2019 Author Share Posted June 25, 2019 Hi Jeff and Gocken, Thanks for both of your replies. @Jeff, Thanks. This has helped me a bit. I hadn't used a vector yet, and your example has helped me along. Thanks for that. I'll try converting it into a matrix, so I can save more information on each row. @Gocken, I did exactly as you suggested, but it is always good to get some confirmation that you're on the right track . I'll update this thread when I (inevitably..) run into new issues. Kind regards, Tom Link to comment Share on other sites More sharing options...
gocken Posted June 25, 2019 Share Posted June 25, 2019 your welcome, in order to know in exactly which timeslot you are in you should use math.ceiling(run.timenow/timeslotlength) expression. Link to comment Share on other sites More sharing options...
Tom van Es Posted June 26, 2019 Author Share Posted June 26, 2019 (edited) Hi, I have a global model state that reacts on that same timer and increments the current timeslot, that should work too, I assume? I feel that I've modelled the timeslots accurately. However, I've now run into my next hurdle: in order for the entities to make an intelligent choice on what time slots to request, first, I must be able to know what servers to visit at all. Currently, this is defined by a set of sequence tables. I have not found a way to store the sequence of destination nodes (or objects) in a (set of) states. Does anyone know how to access the sequence up front, in states or properties or lists? I'd like to store the sequence 'on' the entity, and not in the upper level model, where it has been defined. Kind regards, Tom Edited June 26, 2019 by Tom van Es Link to comment Share on other sites More sharing options...
gocken Posted June 27, 2019 Share Posted June 27, 2019 You can define "NodeInstanceProperty"s or a "NodeListProperty" on modelentity. If you define "NodeInstanceProperty"s on modelentity you should assign entity's sequence seperately in upper level model by assining particular sequences to each "NodeInstanceProperty". If you define a "NodeListProperty" on model entity you should assign the a list of sequences (which is previously known and exist in upper level model) to this "NodeListProperty". It seems you should define "NodeInstanceProperty"s and select appropriate servers dynamically and assign them to each "NodeInstanceProperty". Link to comment Share on other sites More sharing options...
Recommended Posts