question

Amy M3 avatar image
1 Like"
Amy M3 asked Amy M3 commented

How to type an expression in calculated table field?

I'm having trouble with one column in a calculated table - slurry tph. I'm trying to divide a total (total slurry tons) by the model run time (hours column). It's not accepting Model.time/hours(1). It also won't let me divide my total by my hours column. If i hardcode a number in, it works (but only accurate at end of model).

FlexSim 21.1.0
calculated tableflexsim 21.1.0
calc-tbl.jpg (39.6 KiB)
stats-coll.jpg (36.1 KiB)
stats-coll.jpg (36.1 KiB)
· 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.

Amy M3 avatar image Amy M3 commented ·

Still need help on this one.

0 Likes 0 ·
Eric M avatar image
0 Likes"
Eric M answered Amy M3 commented

Hi @Amy M3, I think I've found a solution. I added a column to your stats collector called "TimeH" which measures the time in hours. I then use that in the Slurry Overall Totals calculated table with a "aggregated operation on two columns" dividing the slurry tons by the TimeH (see metric 6). I'm not sure why it wasn't liking the original code, but hopefully this will be a solution for you.

slurry-ohio-305 (2).fsm



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

Amy M3 avatar image Amy M3 commented ·

Thanks @Eric M, would you be able to save it in flexsim 21.03? I can't upgrade right now and can't open it.

0 Likes 0 ·
Eric M avatar image Eric M Amy M3 commented ·

Sure thing! I apologize I thought I had checked the version.

slurry-ohio-305-EM.fsm

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Amy M3 commented ·

There are some informations you can give, which would help to get models in the right version.

0 Likes 0 ·
Amy M3 avatar image Amy M3 commented ·

Thank you!! That's working. @Jörg Vogel I'll make sure to type the right version next time.

0 Likes 0 ·
Benjamin W2 avatar image
1 Like"
Benjamin W2 answered Amy M3 commented

Hi @Amy M3,

I think you are using the "Operation on column and value" option. Instead, do the "Custom expression" and wrap your flexscript in curly braces:

FlexscriptinSQL.fsm


1620682223301.png (53.3 KiB)
flexscriptinsql.fsm (86.3 KiB)
· 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.

Amy M3 avatar image Amy M3 commented ·

I tried the custom code, but it's still not calculating - see metric 5.Slurry_Ohio_305.fsm

0 Likes 0 ·