Showing results for 
Search instead for 
Do you mean 
Reply

Priority Based Methcalls

I have to two different methods that are called on the same day in the simulation, both of them call themselves after some time has passed. The first one calls itself every day that is determined by seconds and the other calls on a certain day that is determined by a date variable.

 

Is there a good way to make the first method be called first, they are called back to back currently but it's very important to me that the first method goes through execution first. I have thought about using a wait until but I wasn't sure if that's the only or the best way to do this?

 

Thank you very much for your time.

2 REPLIES

Re: Priority Based Methcalls

[ Edited ]

Hi Folshore,

 

You can write "ref(second method name).methcall(datatime)" in the first method. From this way, we can make sure the first method excute firstly and then the second method will be excuted in the future(datetime).

 

Best regards!

 

Tao Yifei

Betreff: Priority Based Methcalls

Hi Folshore,

If I understand it correctly, your problem is that the 2 methods are actually executed at the exact same simulation time and you want to ensure/control which one gets called first.

One method is called daily (something like self.methcall(86400), I guess) and the other method is called only once on a specified date (probably from an init-method by a methcall, too?). If that is the setting, I would simply not call the 2nd method from init with a "long" methcall, but rather compare the current date with the specified date of your variable everytime the first method is executed --> if they match, the 1st method will execute the 2nd method at the end and thus they are executed in the required order.

Regards,
Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!