question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Jordan Johnson commented

How do I get the % of limit for a Zone partition calculation?

Hi,

I guess I should send this to @jordan.johnson

I want to get the % of the limit for a Zone partition calculation. In the attached model I get it for the partition content as I know the maximum limit for the partitions, but I do not know how to get it for the calculation instead.

How do I access the current value of the "Result" calculation?

See the attached model where I have the code that prints the stats into the output console.

zonepartitionstatstest.fsm

Thank you!

Kind regards,

Axel

FlexSim 18.2.3
zone partitioncalculation
· 1
5 |100000

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

Axel Kohonen avatar image Axel Kohonen commented ·

Hi @jordan.johnson

Any change you would have time to answer this? Or someone else that knows?

Thank you!

Axel

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered Jordan Johnson commented

There is not a way to get that value directly. See this answer to the same question about subsets:

https://answers.flexsim.com/questions/61427/plotting-the-zone-statistic-for-a-subset-of-limit.html

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

Axel Kohonen avatar image Axel Kohonen commented ·

Hi @jordan.johnson

I seem to have been unclear in my description. I have done as in the post you linked to get the percentage by having the limit in a global table. Also, my model was incorrect as I had placed the Partition Constraint limit on the number of tokens, when it was supposed to be using the "Result" calculation. The fixed model is attached.

zonepartitionstatstest2.fsm

The problem is that I do not know how to get the partition calculation value (the total value), but only the partition content. Currently I use the code below to get the partition content, but that seems to be the number of tokens in the partition which I do not want.

double value = getstat(zone, "PartitionContent", STAT_CURRENT, instance, partitionID);

I want to get the value of the "Result" calculation so that I can divide this with the limit to get the percentage. So can I replace "PartitionContent" with something else to get the value?

The partition calculation values seem to be in the Zone variables tree under "partitionCalculations/Result/instances", but getting them from here does not seem very easy although probably not a problem to get. Although the instance values to not exist at the time of model reset.

Thank you.

Kind regards,
Axel

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Axel Kohonen commented ·

Ah, that makes sense now. I think this is the code you need:

double value = getstat(zone, "PartitionCalculationTotal", STAT_CURRENT, instance, partitionID, "Result");

Partition Calculation statistics are per partition, per calculation. You can get the input, total, output, and perToken value of the partition calculation.

1 Like 1 ·
Axel Kohonen avatar image Axel Kohonen Jordan Johnson ♦♦ commented ·

Hi @jordan.johnson

Great! That works! A few more question

1. Is there a list somewhere of the parameters that one can give to getstat?

2. Or are the ones you listed, i.e. input, total, output and perToken the ones that exist?

3. And are they are given as "PartitionCalculationInput", "PartitionCalculationOutput" and "PartitionCalculationPerToken"?

The list in the getstat command documentation does not contain these. In case I would need to get something else than the total at some stage.

Thank you!

Axel

0 Likes 0 ·
Show more comments

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.