question

Brandon Tondreault avatar image
0 Likes"
Brandon Tondreault asked Jeff Nordgren commented

Change in downtime over a period of time

Is there a possible way to change timetables or the downtime of a processor after a certain period of time in the simulation?

Example: from Feb to March reference TimeTable1, then from April to May reference TimeTable2 and etc..

If there is a way, how difficult and time consuming would it be?

FlexSim 18.0.2
timetablechange over time
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Jeff Nordgren avatar image
1 Like"
Jeff Nordgren answered Jeff Nordgren commented

@Brandon Tondreault

This is probably what I would do if it were my model. I would create each TimeTable (1 through X) and include the objects (Processors, task executers, etc.) required for that TimeTable. Then in the upper right hand corner of the Time Table Parameters Window is a check box called "Enabled". If you un-check that box, that Time Table will never execute. So, until you turn them on/off, the Time Tables will not execute any code.

Here is the code that you can use to turn on/off any of the Time Tables:

treenode TT1 = model().find("Tools/TimeTables/TimeTable1>variables/enabled"); // Pointer to TT TT1.value = 0; // 0 = Turn off the Time Table 1 = Turn on the Time Table

This way, anywhere in your code, at any time, you could turn off one TT and turn on another one. Maybe you could try this in your model and see how it will work for you.

Thanks.

· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Brandon Tondreault avatar image Brandon Tondreault commented ·
@Jeff Nordgren

Not sure if I understand your code above. Where would I put this code? Also, where would TimeTableX come in and time variable "Y" hours.

Thanks,

Brandon

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren Brandon Tondreault commented ·
@Brandon Tondreault

As far as the code goes, you would put that in your model in a Trigger or some other type of code entry field that would make sense, when you want to turn a Time Table on or off. I'm not sure where that is for you because I don't have your model or how your model works to know where that place would be, exactly. But I'm guessing it would be at a point that you are finished with a Time Table or want to stop one Time Table and begin another one, which seems to be what you are trying to accomplish.

treenode TT1 = model().find("Tools/TimeTables/TimeTable1>variables/enabled"); // Pointer to TT

TT1.value = 0; // 0 = Turn off the Time Table 1 = Turn on the Time Table

The first line of code gets a reference to the Time Table object called "TimeTable1". It could be any name, of course, but in this example, it is TimeTable1. The second line of code uses that reference to the Time Table to change the value of that node (the "enabled" node in the time table's tree), 0 to turn it off and 1 to turn it on. I hope that makes more sense?

I'll admit that I don't know what your last sentence "Also, where would TimeTableX come in and time variable "Y" hours." means. I'm guessing that TimeTableX is just a name of a time table (probably not too descriptive) that you have in your model that you may want to turn on or off. As for the "time variable 'Y hours'", I haven't got a clue what you are referring to. If you could explain in more detail, that would help a lot.

Thanks.

"

0 Likes 0 ·
Brandon Tondreault avatar image Brandon Tondreault commented ·

@Jeff Nordgren

I mean after "Y" hours, I want to switch the timetables. Example: Going from TimeTable1 to TimeTable2 at time 100 hours, and then TimeTable3 at time 200 hours...etc.

Sounds like it would be an IF statement with the code you sent me? Changing the values from 1 to 0 and 0 to 1 based on the time of the model.

Does that make sense now?

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren Brandon Tondreault commented ·
@Brandon Tondreault

Yes, that makes more sense to me now, thank you for explaining.

Attached is a sample model that should do what you are describing. First off, the model will not actually work as set up. That is because time tables are changing every 100 seconds. The chances that a time table will be "active" when the scheduled "up" time in the the time table is also active, is slim, at best. But it is after all only a sample model.

I setup four time tables, TimeTable1 through TimeTable4. Each has a different operational time that the others. Then I created four User Events. This is where the time tables will be turned on and off. The first one, at time 0, will turn off all the time tables except for the first one. It will repeat every 400 time units. It's pretty much the same for the next three except that it will turn on/off different time tables.

Even though this sample model will not work the way it is set up, it should give you a good idea on how to possibly set it up for your own situation. If you have any questions, please let us know.

Thanks.

timetable-sample-jn1.fsm

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.