Skip to content

Commit

Permalink
- output of ClosedLoopUnitIdentifier now should have a cap on the num…
Browse files Browse the repository at this point in the history
…ber of digits in parameters.
  • Loading branch information
Steinar Elgsæter committed Nov 22, 2024
1 parent 38a79fc commit d92d293
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion Dynamic/Identification/ClosedLoopUnitIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class ClosedLoopUnitIdentifier
const int firstPassNumIterations = 60;//TODO:change back to 50!
const int secondPassNumIterations = 10;
const double initalGuessFactor_higherbound = 2.5;// 2 is a bit low, should be a bit higher
const int nDigits = 5; //number of significant digits in results.
////////////////////////
const bool doDebuggingPlot = false;
/// <summary>
Expand Down Expand Up @@ -101,7 +102,7 @@ public class ClosedLoopUnitIdentifier
List<UnitModel> idUnitModelsList = new List<UnitModel>();
List<double> processGainList = new List<double>();

double[] u0 = dataSet.U.GetRow(0);
double[] u0 = SignificantDigits.Format(dataSet.U.GetRow(0), nDigits);
double y0 = dataSet.Y_meas[0];
bool isOK;
var dataSet1 = new UnitDataSet(dataSet);
Expand Down Expand Up @@ -307,6 +308,20 @@ public class ClosedLoopUnitIdentifier
{
ClosedLoopSim(dataSet, identUnitModel.modelParameters, pidParams, disturbance);
}
// round resulting parameters

identUnitModel.modelParameters.LinearGains = SignificantDigits.Format(identUnitModel.modelParameters.LinearGains, nDigits);
identUnitModel.modelParameters.LinearGainUnc = SignificantDigits.Format(identUnitModel.modelParameters.LinearGainUnc, nDigits);
identUnitModel.modelParameters.Bias = SignificantDigits.Format(identUnitModel.modelParameters.Bias, nDigits);
if (identUnitModel.modelParameters.BiasUnc.HasValue)
identUnitModel.modelParameters.BiasUnc = SignificantDigits.Format(identUnitModel.modelParameters.BiasUnc.Value, nDigits);

identUnitModel.modelParameters.TimeConstant_s = SignificantDigits.Format(identUnitModel.modelParameters.TimeConstant_s, nDigits);
if (identUnitModel.modelParameters.TimeConstantUnc_s.HasValue)
identUnitModel.modelParameters.TimeConstantUnc_s = SignificantDigits.Format(identUnitModel.modelParameters.TimeConstantUnc_s.Value, nDigits);
identUnitModel.modelParameters.UNorm = SignificantDigits.Format(identUnitModel.modelParameters.UNorm, nDigits);


return (identUnitModel,disturbance);
}

Expand Down
2 changes: 1 addition & 1 deletion TimeSeriesAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RunAnalyzersDuringLiveAnalysis>False</RunAnalyzersDuringLiveAnalysis>
<RepositoryUrl>https://github.com/equinor/TimeSeriesAnalysis.git</RepositoryUrl>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<Version>1.3.31</Version>
<Version>1.3.32</Version>
<Company>Equinor</Company>
<Authors>Equinor</Authors>
<IncludeSymbols>true</IncludeSymbols>
Expand Down

0 comments on commit d92d293

Please sign in to comment.