diff --git a/Dynamic/PlantSimulator/PlantSimulator.cs b/Dynamic/PlantSimulator/PlantSimulator.cs
index 43f3bb4..2bea48c 100644
--- a/Dynamic/PlantSimulator/PlantSimulator.cs
+++ b/Dynamic/PlantSimulator/PlantSimulator.cs
@@ -740,7 +740,9 @@ public bool Simulate(TimeSeriesDataSet inputData, out TimeSeriesDataSet simData)
// initalize the new time-series to be created in simData.
var init = new PlantSimulatorInitalizer(this);
- var didInit = init.ToSteadyStateAndEstimateDisturbances(ref inputData, ref simData, compLoopDict);
+ var inputDataMinimal = new TimeSeriesDataSet(inputData);
+
+ var didInit = init.ToSteadyStateAndEstimateDisturbances(ref inputDataMinimal, ref simData, compLoopDict);
if (!didInit)
{
Shared.GetParserObj().AddError("PlantSimulator failed to initalize.");
@@ -759,7 +761,7 @@ public bool Simulate(TimeSeriesDataSet inputData, out TimeSeriesDataSet simData)
"\" has null inputIDs.");
return false;
}
- double[] inputVals = GetValuesFromEitherDataset(inputIDs, timeIdx, simData, inputData);
+ double[] inputVals = GetValuesFromEitherDataset(inputIDs, timeIdx, simData, inputDataMinimal);
string outputID = model.GetOutputID();
if (outputID == null)
@@ -769,17 +771,17 @@ public bool Simulate(TimeSeriesDataSet inputData, out TimeSeriesDataSet simData)
return false;
}
double[] outputVals =
- GetValuesFromEitherDataset(new string[] { outputID }, timeIdx, simData, inputData);
+ GetValuesFromEitherDataset(new string[] { outputID }, timeIdx, simData, inputDataMinimal);
if (outputVals != null)
{
model.WarmStart(inputVals, outputVals[0]);
}
}
- var idxToIgnore = inputData.GetIndicesToIgnore();
+ var idxToIgnore = inputDataMinimal.GetIndicesToIgnore();
int lastGoodTimeIndex = 0;
// if start of dataset is bad, then parse forward until first good time index..
- while (idxToIgnore.Contains(lastGoodTimeIndex) && lastGoodTimeIndex < inputData.GetLength())
+ while (idxToIgnore.Contains(lastGoodTimeIndex) && lastGoodTimeIndex < inputDataMinimal.GetLength())
{
lastGoodTimeIndex++;
}
@@ -799,7 +801,7 @@ public bool Simulate(TimeSeriesDataSet inputData, out TimeSeriesDataSet simData)
{
inputDataLookBackIdx = 1;//if set to zero, model fails(requires changing model order).
}
- double[] inputVals = GetValuesFromEitherDataset(inputIDs, lastGoodTimeIndex - inputDataLookBackIdx, simData, inputData);
+ double[] inputVals = GetValuesFromEitherDataset(inputIDs, lastGoodTimeIndex - inputDataLookBackIdx, simData, inputDataMinimal);
if (inputVals == null)
{
Shared.GetParserObj().AddError("PlantSimulator.Simulate() failed. Model \"" + model.GetID() +
@@ -826,8 +828,8 @@ public bool Simulate(TimeSeriesDataSet inputData, out TimeSeriesDataSet simData)
}
}
}
- simData.SetTimeStamps(inputData.GetTimeStamps().ToList());
- PlantFitScore = FitScoreCalculator.GetPlantWideSimulated(this, inputData, simData);
+ simData.SetTimeStamps(inputDataMinimal.GetTimeStamps().ToList());
+ PlantFitScore = FitScoreCalculator.GetPlantWideSimulated(this, inputData, simData);
return true;
}
diff --git a/TimeSeriesAnalysis.Tests/Tests/DisturbanceEstimatorTests.cs b/TimeSeriesAnalysis.Tests/Tests/DisturbanceEstimatorTests.cs
index 553cbce..561897e 100644
--- a/TimeSeriesAnalysis.Tests/Tests/DisturbanceEstimatorTests.cs
+++ b/TimeSeriesAnalysis.Tests/Tests/DisturbanceEstimatorTests.cs
@@ -112,11 +112,11 @@ public void PlantSimulator_StepDisturbance_EstimatesOk(double stepAmplitude)
[TestCase(4,-1)]
public void PlantSimulator_StepDisturbanceANDSetPointStep_EstimatesOk(double disturbanceStepAmplitude,double setpointAmplitude)
{
- // Shared.EnablePlots();
+ // Shared.EnablePlots();
var trueDisturbance = TimeSeriesCreator.Step(100, N, 0, disturbanceStepAmplitude);
var setpoint = TimeSeriesCreator.Step(50, N, 50, 50+setpointAmplitude);
DisturbanceTestUsingPlantSimulator(new UnitModel(dynamicModelParameters, "PlantSim_d"), trueDisturbance, true, setpoint);
- // Shared.DisablePlots();
+ //Shared.DisablePlots();
}
diff --git a/TimeSeriesAnalysis.csproj b/TimeSeriesAnalysis.csproj
index 3270909..5dbff76 100644
--- a/TimeSeriesAnalysis.csproj
+++ b/TimeSeriesAnalysis.csproj
@@ -14,7 +14,7 @@
False
https://github.com/equinor/TimeSeriesAnalysis.git
readme.md
- 1.3.37
+ 1.3.38
Equinor
Equinor
true