FunctionInput fi = new FunctionInput("DECODING SIMULATION INPUT", f, Units.UNK);
environment.addNode(fi);
environment.addProjection(fi.getOrigin(FunctionInput.ORIGIN_NAME), termination);
probe.reset();
environment.run(0, transientTime);
TimeSeries result = probe.getData();
environment.removeProjection(termination);
environment.removeNode(fi.getName());
values[i] = new float[result.getDimension()];
int samples = (int) Math.ceil( result.getValues().length / 10d ); //use only last ~10% of run in the average to avoid transient
for (int j = 0; j < result.getDimension(); j++) {
values[i][j] = 0;
for (int k = result.getValues().length - samples; k < result.getValues().length; k++) {
values[i][j] += result.getValues()[j][k];
}
values[i][j] = values[i][j] / samples;
}
}
LinearApproximator approximator = myApproximatorFactory.getApproximator(evalPoints, values);
DecodedOrigin result = new DecodedOrigin(this, name, getNodes(), nodeOrigin, functions, approximator);
result.setMode(getMode());
myDecodedOrigins.put(name, result);
fireVisibleChangeEvent();
return result;
}