question

Mohamed Eldakroury avatar image
0 Likes"
Mohamed Eldakroury asked Mohamed Eldakroury commented

Process times by lookup table and a parameter

ProcessTimeLookup.fsmI am trying to vary the cycle time of a processor based on number of operators using a global table lookup table. The goal is to achieve faster processing times when I set up my parameter to a higher value. Here is how I did it.

- I named my table rows similar to the processor names and I use current.name to find the table row.

- I am using a parameter (NumOperators) that controls the number of operators. I use that parameter to lookup the column number. If the parameter is equals to 2, I want to go get the cycle times from column 2, and so on.

- I want to use triangular distribution for the cycle times, so I changed the table data type to Flexscript and I pasted the code from another dummy processor that uses a triangular distribution (I am no expert in Flexscript, so probably this is not the best practice here since I'm getting errors.

I am getting "FlexScript exception: Property "dataType" accessed on invalid node. at <no path>" Error

There is probably a better way to do what I want to do. This is not the main model. My model is much larger and have 30+ processors and I am trying to find a good practice to lookup the table for every processor without have to manually change the cycle time data for every processor.

Please let me know if I'm on the right path or if there's a smarter/easier way to do that.

FlexSim 23.2.2
global table
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

·
Regan Blackett avatar image
0 Likes"
Regan Blackett answered Mohamed Eldakroury commented

@Mohamed Eldakroury the errors you are seeing relate to the code in your table being lifted from an object event. There is some extra stuff in there that assumes the code is executing from an object that doesn't apply in a table cell. Specifically reference to the Object variables 'current' and 'item' and how those references are created via code are not valid.

When using a distribution in an object's properties, the menu options also include a call to 'getstream(current)' as the final parameter of the distribution. This sets the random number stream used by the distribution to be set by the object. This also doesn't apply to a table cell, and should be replaced with a unique number for the Wiring and Inspection machines. In your table cells you just need the call to the triangular expression like this:

triangular(5, 15, 10, 1)
· 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.

Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

@Regan Blackett That works! It's actually more straight forward than what I thought, thank you.

As a follow up to this question, before I decide to put the triangular distribution function in the global table, I tried putting the min, max and mode in the table and call them in the triangular distribution function in the processor but that didn't work.

I was referring to the row number using current.name, which works, but was stuck at how to call the columns using my parameter (NumOperators).

If my parameter =1 , I want to use the first 3 columns of the table for the min, max and mode

If my parameter =2, I want to use the 4th, 5th and 6th columns and so on.


tablelookup3.jpg

I tried to name the columns in a unique way such that if I do mathematical operations on the parameter, I can get the column name, and call it as a string. but apparently when I do it this way, It tries to find a column index equals to the result of the mathematical operations and can't find it.
tablelookup1.jpg

If I put the whole expression in between quotations, it thinks it's one big string and doesn't do the mathematical operation.


tablelookup2.jpg

I think I understand why both ways didn't work, but can you please let me know how to call the column name given my parameter value in a way that works?

0 Likes 0 ·
tablelookup3.jpg (32.1 KiB)
tablelookup2.jpg (60.4 KiB)
Felix Möhlmann avatar image Felix Möhlmann Mohamed Eldakroury commented ·
To refer to the columns by their header, convert the numerical result into a string with

"string.fromNum()".

But if the columns follow a regular pattern, you could also refer to them through their index with 'Model.parameters.NumOperators*3 - N', where N is 2, 1 or 0.

1 Like 1 ·
Mohamed Eldakroury avatar image Mohamed Eldakroury commented ·

Thank you!

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.