Closed edwin716 closed 4 years ago
Did you call genServiceTime() multiple times inside this class, or at multiple events?
On a side note, I think you need to change the output such that it is "done serving by server 1" instead of "done serving by 1".
Did you call genServiceTime() multiple times inside this class, or at multiple events?
I used it another time in my DoneEvent to update the next available time for the server. Could that be the issue?
On a side note, I think you need to change the output such that it is "done serving by server 1" instead of "done serving by 1".
Oh ok thanks!
Hi, I think the next available time for the server would be the same as the start time of the DoneEvent?
Yup, I think you should only call genServiceTime() only in one class, and only once.
Currently, the service time for your 3rd server is 1.359 - 1.205 = 0.154. This is exactly the difference between the actual service time for the 5th sever (4.031 - 3.877 = 0.154) (see image above). This is probably because you called genServiceTime() about twice the number of times needed.
If I am not mistaken, you will need to update your code slightly to prevent the case of having to call genServiceTime() more than once for each server.
Hi, I think the next available time for the server would be the same as the start time of the DoneEvent?
Yeah I just realized it thanks!
Yup, I think you should only call genServiceTime() only in one class, and only once.
Currently, the service time for your 3rd server is 1.359 - 1.205 = 0.154. This is exactly the difference between the actual service time for the 5th sever (4.031 - 3.877 = 0.154) (see image above). This is probably because you called genServiceTime() about twice the number of times needed.
If I am not mistaken, you will need to update your code slightly to prevent the case of having to call genServiceTime() more than once for each server.
I have changed my code such that genServiceTime() is only called in the ServeEvent constructor now as shown in my initial post but I'm still facing the same issue. Could you elaborate abit more about the last line?
Can i see ur updated code? And also u need to make sure u only call servicetime when it is being served and no where else even for done event. For your done event u need to remove that service time cos other wise u will be calling it twice and thats the reason why they hinted to use lazy
Can i see ur updated code? And also u need to make sure u only call servicetime when it is being served and no where else even for done event. For your done event u need to remove that service time cos other wise u will be calling it twice and thats the reason why they hinted to use lazy
Ok I managed to solve the issue already. It's because I called the execute method twice for my simulate method in the EventSimulator, which is possibly why the genServiceMethod() was called twice. Thanks for the inputs everyone appreciate it!
Hi I'm currently facing an issue whereby the timings for my DoneEvent is wrong. From what I see, it seems that the service time generated is wrong but I'm not sure why this is the case. Would appreciate any inputs thanks!
Screenshots (if any):
Insert Images here if necessary