Skip to content

Commit

Permalink
- ClosedLoopUnitIdentifier changed to static for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
Steinar Elgsæter authored and Steinar Elgsæter committed Dec 4, 2024
1 parent 53cd1c4 commit 95e3126
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Dynamic/Identification/ClosedLoopUnitIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class ClosedLoopUnitIdentifier
/// <param name = "pidInputIdx">the index of the PID-input to the unit model</param>
///
/// <returns>The unit model, with the name of the newly created disturbance added to the additiveInputSignals</returns>
public (UnitModel, double[]) Identify(UnitDataSet dataSet, PidParameters pidParams = null, int pidInputIdx = 0)
public static (UnitModel, double[]) Identify(UnitDataSet dataSet, PidParameters pidParams = null, int pidInputIdx = 0)
{
bool wasGainGlobalSearchDone = false;
bool doTimeDelayEstOnRun1 = false;
Expand Down Expand Up @@ -344,7 +344,7 @@ public class ClosedLoopUnitIdentifier
return (identUnitModel,disturbance);
}

private Tuple<UnitModel,double> GlobalSearchLinearPidGain(UnitDataSet dataSet, PidParameters pidParams, int pidInputIdx,
private static Tuple<UnitModel,double> GlobalSearchLinearPidGain(UnitDataSet dataSet, PidParameters pidParams, int pidInputIdx,
UnitModel unitModel_run1, double pidProcessInputInitalGainEstimate, double minPidProcessGain,
double maxPidProcessGain, FittingSpecs fittingSpecs, int numberOfGlobalSearchIterations = 40)
{
Expand Down Expand Up @@ -581,7 +581,7 @@ private Tuple<UnitModel,double> GlobalSearchLinearPidGain(UnitDataSet dataSet, P
return new Tuple<UnitModel,double>(bestUnitModel, gainUnc);
}

private Tuple<UnitModel, DisturbanceIdResult> EstimateSISOdisturbanceForProcGain( UnitModel referenceMISOmodel,
private static Tuple<UnitModel, DisturbanceIdResult> EstimateSISOdisturbanceForProcGain( UnitModel referenceMISOmodel,
double pidLinProcessGain, int pidInputIdx, UnitDataSet dataSet, PidParameters pidParams)
{
var alternativeModel = new UnitModel(referenceMISOmodel.modelParameters.CreateCopy(), "SISO");
Expand Down Expand Up @@ -631,7 +631,7 @@ private Tuple<UnitModel, DisturbanceIdResult> EstimateSISOdisturbanceForProcGain
/// <param name="disturbance">disturbance vector</param>
/// <param name="name">optional name used for plotting</param>
/// <returns></returns>
public bool ClosedLoopSim(UnitDataSet unitData, UnitParameters modelParams, PidParameters pidParams,
public static bool ClosedLoopSim(UnitDataSet unitData, UnitParameters modelParams, PidParameters pidParams,
double[] disturbance,string name="")
{
if (pidParams == null)
Expand Down
3 changes: 1 addition & 2 deletions TimeSeriesAnalysis.Tests/Examples/SystemIdent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ void ClosedLoopId()
Assert.IsTrue(isOk);
var pidDataSet = processSim.GetUnitDataSetForPID(inputData.Combine(simData), pidModel1);

var modelId = new ClosedLoopUnitIdentifier();
(var identifiedModel, var estDisturbance) = modelId.Identify(pidDataSet, pidModel1.GetModelParameters());
(var identifiedModel, var estDisturbance) = ClosedLoopUnitIdentifier.Identify(pidDataSet, pidModel1.GetModelParameters());

Console.WriteLine(identifiedModel.ToString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ public void GenericMISODisturbanceTest (UnitModel trueProcessModel, double[] tr
pidDataSet.U[500,0] = Double.NaN;
}

var modelId = new ClosedLoopUnitIdentifier();
(var identifiedModel, var estDisturbance) = modelId.Identify(pidDataSet, pidModel1.GetModelParameters(), pidInputIdx);
(var identifiedModel, var estDisturbance) = ClosedLoopUnitIdentifier.Identify(pidDataSet, pidModel1.GetModelParameters(), pidInputIdx);

Console.WriteLine(identifiedModel.ToString());
Console.WriteLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ public void GenericDisturbanceTest (UnitModel trueProcessModel, double[] trueDi

}

var modelId = new ClosedLoopUnitIdentifier();
(var identifiedModel, var estDisturbance) = modelId.Identify(pidDataSet, pidModel1.GetModelParameters());
(var identifiedModel, var estDisturbance) = ClosedLoopUnitIdentifier.Identify(pidDataSet, pidModel1.GetModelParameters());

Console.WriteLine(identifiedModel.ToString());
Console.WriteLine();
Expand Down

0 comments on commit 95e3126

Please sign in to comment.