question

Helen Z avatar image
0 Likes"
Helen Z Suspended asked Helen Z Suspended commented

How to sum the same label value in an object dynamicly?

I added a label at the processor,as we know,the label would change when the simulation run.

Now,I need to sum the value of this label.

How to sum the same label value in an object dynamicly?

How can I solve this problem?

Thank you in advance!

FlexSim 18.0.10
label 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.

1 Answer

·
Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Helen Z Suspended commented
@Helen Z

If you turn the label into a tracked variable you will automatically log all changes and with the properties count and average you can get the sum.

· 7
5 |100000

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

Helen Z avatar image Helen Z commented ·

@steven.hamoen

Thank you for your reply.

I am new to this software,so I don't know how to use the tracked variable.

Is there another way to solve "sum"problem or how could I master the key point of "tracked variable"?

Looking forward your reply...

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Helen Z commented ·

@Helen Z

I'm not sure what you are writing on the label. You say: "as we know" But a normal label doesn't change unless you write to it. If you write to it you can also write to a 2nd label and on that second label have the sum. So for instance:

current.myLabel = 20;
current.mySumLabel = current.mySumLabel + 20;

Using the tracked variabel is easy with setting but getting the data out is somewhat more complicated so I will not go into that solution.

0 Likes 0 ·
Helen Z avatar image Helen Z commented ·

@steven.hamoen I am sorry that I did't express it well.

In fact,I add three labels at the processor to get the information of the Label value.Such as LabelC=“LableA*LabelB”.

The value of the label would change as the model run.Now I need to sum up all the Label C.And I don't have idea of this.Could you please give me some advice?

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Helen Z commented ·

@Helen Z

I have just haven given you a solution by having an extra label where you write the cumulative sum. Why is that not good enough or not working?

0 Likes 0 ·
Helen Z avatar image Helen Z commented ·

En,I would try it if could sum all the value of "LabelC "in Flexsim,thank you again .

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Helen Z commented ·

@Helen Z

If you write label C why can't you at the same time also write to label D which is then the sum of the current value of label D + the new value of label C.

Please post a small model that shows your problem because I don't understand it.

0 Likes 0 ·
Helen Z avatar image Helen Z Steven Hamoen commented ·

@steven.hamoen Thank you very much,I have tried your way.I added Label D .It is helpful.

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.