Consume the time of a list

Kauan
Not applicable
1 View
10 Replies
Message 1 of 11

Consume the time of a list

Kauan
Not applicable

[ FlexSim 21.2.4 ]

Hello !

I would like to take the time from my column called difference and transform my operating time of my robot. It is possible ? and yes, how to continue a line flow?

65960-1679312557558.png

0 Likes
Accepted solutions (1)
2 Views
10 Replies
Replies (10)
Message 2 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
That's not enough information for an answer - please explain more about the process and data; upload your model; explain what the difference column should be used for (transform how?); include a snapshot that actually includes the difference.
0 Likes
Message 3 of 11

yumi_n2
Not applicable

Hi kauan, i think you can use the calculated table to put the difference time of your columns.
1680027184760.png
Probably you can use subset or partitions to filter by day and time.
The Calculated Table (flexsim.com)

0 Likes
Message 4 of 11

Kauan
Not applicable

Hello @Yumi Nishijima

So I already have the difference value in my table but I was wondering how can I use the difference column values for my robot and the other would be how to filter my InputTimestamp by seconds or date. I saw that you put the Calculated Table option, how can I consume this calculated table and how to filter the seconds or date I want.

0 Likes
Message 5 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

When you import your data use standard SQL to filter the range of values.

Once the data is in a FlexSim table you can use (via a Table query) ARRAY_AGG(difference) to create an array of values which you put on the processing object/robot (as a label) when the model starts and then you can just put in the time field:

current.differences.shift()
0 Likes
Message 6 of 11

Kauan
Not applicable

Hello @Jason Lightfoot

I managed to filter the data, but I didn't understand how I can use this in my robot's time. Can you show me an example of this ?

1680117924570.png

1. Table("GlobalTable1")[duniform(1, Table("GlobalTable1").numRows)][7]

I tried to do it that way, but when it reaches 32 cycles it ends up crashing.

0 Likes
Message 7 of 11

jason_lightfootVL7B4
Autodesk
Autodesk

That looks more like you're wanting to sample the process time rather than replicate the process time sequence you had in data. For that you can use the Empirical Distribution.

To get the data in there from your global table use something like this:

Table.query("SELECT difference as Data FROM GlobalTable1").cloneTo(Model.find("Tools/EmpiricalDistributions/EmpiricalDistribution1>variables/data"));
0 Likes
Message 8 of 11

Kauan
Not applicable

Sorry for my English, but actually I want to replicate the process time and not a sample, but I don't know how I can do that. I'm trying with your code above, I'm getting an error.

1680173292751.png

1680173343733.png

0 Likes
Message 9 of 11

jason_lightfootVL7B4
Autodesk
Autodesk

If you don't want to sample a historical process time them then you don't need to put any data in an Empirical distrubition.

If you do want to do that then you need to create the Empirical Distribution in the Toolbox in order for the code you show to work.

As I said above, one method would be to create an array using

SELECT ARRAY_AGG(difference) FROM GlobalTable1 ORDER BY InputTimestamp

and then assign that array to a label (eg. 'ptimes') on the processing object. Don't forget a table query returns a table so the array will be in row 1, column 1 of the table.

Then you can consume that array using

current.ptimes.shift()

in the processing time expression.

0 Likes
Message 10 of 11

Kauan
Not applicable

I'm trying but I'm still getting error in my code. @Jason Lightfoot Can you give me an example so I can understand how it's done?

1680191724022.png

1680191763861.png

1680191798756.png

0 Likes
Message 11 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
Object o=Model.find("MyObject");
o.ptimes=Table.query("
SELECT ARRAY_AGG(difference) FROM GlobalTable1 ORDER BY InputTimestamp
")[1][1].as(Array).clone();

If you can't get that to work then post your model and point us to the relevant object.

0 Likes

Type a product name