2

in my model I have 9 different service blocks and each service can produce 9 different features. Each combination has a different delay time and standard deviation. For example feature 3 need 5 minutes in service block 8 with a deviation of 0.05, but only needs 3 minutes with a deviation of 0.1 in service block 4.

How can I permanently track the last 5 needed times of each combination and calculate the average (like a moving average)? I want to use the average to let the products decide which service block to choose for the respective feature according to the shortes time comparing the past times of all of the machines for the respective feature. The product agents already have a parameter for the time entering the service and one calculating the processing time by subtracting the entering time from the time leaving the service block.

Thank you for your support!

Marie
  • 35
  • 3

1 Answers1

1

I am not sure if I understand what you are asking, but this may be an answer:

to track the last 5 needed times you can use a dataset from the analysis palette, limiting the number of samples to 5...

dataset

you will update the dataset using dataset.add(yourTimeVariable); so you can leave the vertical axis value of the dataset empty.

I assume you would need 1 dataset per feature

Then you can calculate your moving average doing:

dataset.getYMean();

If you need 81 datasets, then you can create a collection as an ArrayList with element type DataSet And on Main properties, in On Startup you can add the following code and it will have the same effect.

for(int i=0;i<81;i++){
    collection.add(new DataSet( 5, new DataUpdater_xjal() {
        double _lastUpdateX = Double.NaN;
        @Override
        public void update( DataSet _d ) {
          if ( time() == _lastUpdateX ) { return; }
          _d.add( time(), 0 );
          _lastUpdateX = time();
        }
        @Override
        public double getDataXValue() {
          return time();
        }
      } )
  );
}

you will only need to remember what corresponds to what serviceblock and feature and then you can just do

collection.get(4).getYMean();

and to add a new value to the dataset:

collection.get(2).add(yourTimeVariable);
Felipe
  • 8,311
  • 2
  • 15
  • 31
  • That means I need in sum 9*9 = 81 datasets? I hoped I could avoid that.. – Marie Nov 19 '18 at 18:25
  • Oh I thought you would only need 9, in that case the answer is quite different, I will write an answer for that – Felipe Nov 19 '18 at 18:33
  • I edited the question. This gives you a way of doing it, but in fact there is a better one using classes, in which case you can assign a feature and a serviceBlock too... I may do that later – Felipe Nov 19 '18 at 18:40
  • And how do I add a time to a dataset using the collection as ArrayList? – Marie Nov 19 '18 at 18:43