question

Lisa Barcak avatar image
0 Likes"
Lisa Barcak asked jing.c edited

How can I display an Operator's Average Processing Time in Hours/Week?

On the Dashboard, is there a way to display an Operator's Average Processing Time in Hours/Week? I know I can see the Percentage of Time an Operator is Processing, or the Total Number of Hours the Operator was Processing throughout the entire simulation time. But it would be more helpful to see it in average hours/week. Thank you!

FlexSim 16.2.2
statechartaverage operator time processing per weekstate per interval
5 |100000

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

Logan Gold avatar image
2 Likes"
Logan Gold answered

I don't think there is an easy way to modify the values that are displayed in any of the default state charts in the Dashboard. However, you can manually retrieve the values that those charts are using in their calculations by using the getstat() command. You can also use this command in a Custom Chart from the Dashboard's library. I have included a sample model as an example (dashboard-customhoursutilizedperweek-example.fsm).

To set up a Custom Chart, you first add objects in the Associations tab just like you would add objects in any other State chart. Then, you define the data that will be displayed in the Data tab.

If you'd like to learn more about how Series and Categories are used in a Custom Chard, you can read more about them in the User Manual, under Charting and Reporting > The Dashboard > Concepts > Custom Chart. But since you only want to display one piece of information for each Operator, I have both set to 1 in the example model. The important part is the Data Point Value field, where I use this custom code:

double stat = getstat(current, "State", STAT_TIME_AT_VALUE, 0, STATE_UTILIZE)/3600;
double currentWeek = getmodelunit(CURRENT_DAY)/7;


if (currentWeek == 0)
	return 0;


return stat / currentWeek;

It is possible to condense this into fewer lines and possibly even one line, but I went ahead and separate it out for easier reading.

The gist of how I am using the getstate() command is it will retrieve the amount of time an object has been in a specified state. The current variable is a reference to the object(s) selected in the Associations tab of the chart. The "State" string means we want to look at the object's states when retrieving information (there are other possibilities that are outlined in the User Manual). The STAT_TIME_AT_VALUE means we want to get the current number for the specified state (again, there are other possible values that can be put here defined in the User Manual). The 0 is the state profile we want to look at (0 is the default state profile, but you can create custom profiles and reference them instead). And the STATE_UTILIZE is the state we want to get information from. I also divide by 3600 to give us that number in hours since my model is running in seconds.

If you would like to include more than just the utilize state, you'll need to use the getstate() command multiple times and add all the different states together to get the needed total. And if you are using different time units in your model, you'll want to change the 3600 accordingly to get that total in terms of hours.

The getmodelunit() command in the next line down can return a number of things. In this case, using the CURRENT_DAY macro means it will return the amount of time the model has been running in terms of days. So if you run the model for 43,200 seconds, this code will return 0.5. Running it to 50,000 will return about 13.88, running it to 86,400 will return a 1.0, and so forth. I also divide this number by 7 so we get the amount of time the model has run in terms of weeks.

Finally I make sure the currentWeek variable is not 0, because I am about to divide by that variable and if it is a 0, an error will be thrown. If it is a 0, I simply return a 0. Otherwise, I divide the two numbers and return that value.


5 |100000

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

jing.c avatar image
3 Likes"
jing.c answered jing.c edited

@Lisa Barcak

Inspired by @Logan Gold's model, I tried to add an user event and a globaltable to do it.

I use the user event for recording the total operator's processing time in GT"processtime" once each week. Then I extracts data from the GT in "Data Point Value" of Custom Chart for showing processing time each week. For more detail you can see the model.

customhoursutilizedperweek-chjv162.fsm

The old answer:

It sounds like you can use the Collect Time in General of Dashboard.

You can make different dashboards to collect the data in different time for weeks.

Maybe it is still a little cumbersome, but it works~


· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

@jing.chen this sounds even better than any other suggestion. If you change the comment to an answer, the users can place like votes to this easier.

1 Like 1 ·
jing.c avatar image jing.c Joerg Vogel commented ·

^_^Thanks for your advice.

0 Likes 0 ·
Lisa Barcak avatar image Lisa Barcak jing.c commented ·

The issue with this is that it only collects the data for 1 week, right? And I would need a separate dashboard to collect the data for each week and then need to calculate the average hours processing per week myself by totaling them all up and dividing by the number of weeks? I'm running each simulation for a few years, so this would be more tedious than what I've been doing to calculate this (see below in my other reply this morning). Thank you for the help.

0 Likes 0 ·
Show more comments
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered

Right before you want to show the states of objects, you call the command

updatestates () 

As it described in the manual it is the function that is called at stop of the model, which does what it is called for. If you store the value of the state of the previous time interval of interest in a label you compute the change to the actual time interval after the call and show this in the dashboard.

You can use this with tracked variables, too. In the code or after the code you update the states you write the state manually to the tracked variable. Then you accumulate all changes of the tracked variables to states different to the processing or similar state and build the difference to it. If there isn't a change the only value in the tracked variable is the last update time stamp.

5 |100000

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

Sam Stubbs avatar image
0 Likes"
Sam Stubbs answered Lisa Barcak commented

Something that specific you're going to have to set up the logic for yourself. The only way I can think of to record something specific like that would be to use a tracked variable. You could create a Process flow to keep track of state changes. (An event triggered source which triggers on the On State Change trigger for the operator.) Have some custom code to check if the state it was changed to was the utilized state, then wait until the operator changes state again and record the time difference from start to end, and cumulatively store that Utilized time into a variable or label or something. Then finally you'd have some custom user event that triggers once a week and "collects" that data and stores in in the tracked variable, which is designed to look at the averages. That would record the average utilized time from week to week.

· 3
5 |100000

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

Lisa Barcak avatar image Lisa Barcak commented ·

There is a way though on the dashboard state chart to show the total hours each operator spend processing during the simulation (instead of as a utilization percentage), so it must be a variable that is already tracked. I just want to divide that by the number of weeks the simulation has run, which I assume is also a tracked variable, and display it on the dashboard so I can easily see the average hours/week each operator was processing. It seems like there would be am easy way to do that. Thanks!

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Lisa Barcak commented ·

Properties of the Dashboard Chart > General Tab> activate option: Show Totals Instead Of Percentages.

0 Likes 0 ·
Lisa Barcak avatar image Lisa Barcak Joerg Vogel commented ·

Thanks, I did already have that in my model and have manually been doing the calculation to divide that by simulation run time in a Spreadsheet. Now I'm just trying to figure out how to have the Dashboard convert the total hours processing to average hours processing per week so it's displayed there instead of the need to do the calculation in a Spreadsheet. Thanks for the help.

0 Likes 0 ·