Skip to content

Commit

Permalink
- change the order of UnitParameters and PidParameters to make the mo…
Browse files Browse the repository at this point in the history
…st important ones show up highest
  • Loading branch information
Steinar Elgsæter committed Nov 22, 2024
1 parent d92d293 commit aa3674c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 45 deletions.
34 changes: 20 additions & 14 deletions Dynamic/SimulatableModels/PidParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ public PidParameters(PidParameters existingParam)
}


/// <summary>
/// If true, the model will set u[k] based on the error term e[k-1], if false it will be set from e[k]
/// </summary>
public bool DelayOutputOneSample = false;


/// <summary>
/// Proportional gain of controller
Expand All @@ -70,15 +67,17 @@ public PidParameters(PidParameters existingParam)
/// </summary>
public double Td_s { get; set; } = 0;



/// <summary>
/// Output value when e=0, used only for P-only controllers, u = Kp*e + u0
/// PID-scaling object. This is optional, set to null to use unscaled PID.
/// </summary>
public double u0 { get; set; } = 50;
public PidScaling Scaling { get; set; }

/// <summary>
/// If the PID-controller is to be protected from a specific value that is used to identify bad or missing data, specify here
/// PID-filtering object. This is optional
/// </summary>
public double NanValue { get; set; } = -9999;
public PidFilterParams Filtering { get; set; }

/// <summary>
/// Gain-scheduling object. This is optional, set to null gain-scheduling is not in use.
Expand All @@ -90,20 +89,27 @@ public PidParameters(PidParameters existingParam)
/// </summary>
public PidFeedForward FeedForward { get; set; } = null;


/// <summary>
/// PID-scaling object. This is optional, set to null to use unscaled PID.
/// PID anti-surge parameters object. This is optional, set to null if not anti-surge PID
/// </summary>
public PidScaling Scaling { get; set; }
public PidAntiSurgeParams AntiSurgeParams { get; set; } = null;

/// <summary>
/// PID-filtering object. This is optional
/// If true, the model will set u[k] based on the error term e[k-1], if false it will be set from e[k]
/// </summary>
public PidFilterParams Filtering { get; set; }
public bool DelayOutputOneSample = false;

/// <summary>
/// PID anti-surge parameters object. This is optional, set to null if not anti-surge PID
/// Output value when e=0, used only for P-only controllers, u = Kp*e + u0
/// </summary>
public PidAntiSurgeParams AntiSurgeParams { get; set; } = null;
public double u0 { get; set; } = 50;

/// <summary>
/// If the PID-controller is to be protected from a specific value that is used to identify bad or missing data, specify here
/// </summary>
public double NanValue { get; set; } = -9999;


/// <summary>
/// Store a warning that arouse during identification
Expand Down
59 changes: 29 additions & 30 deletions Dynamic/SimulatableModels/UnitParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,34 @@ namespace TimeSeriesAnalysis.Dynamic
/// </summary>
public class UnitParameters : ModelParametersBaseClass
{
/// <summary>
/// An array of gains that determine how much in the steady state each input change affects the output(multiplied with (u-u0))
/// </summary>
public double[] LinearGains { get; set; } = null;

/// <summary>
/// The minimum allowed output value(if set to NaN, no minimum is applied)
/// An array of 95% uncertatinty in the linear gains (u-u0))
/// </summary>
public double Y_min = double.NaN;
public double[] LinearGainUnc { get; set; } = null;


/// <summary>
/// the maximum allowed output value(if set to NaN, no maximum is applied)
/// The nonlinear curvature of the process gain, this paramter is multiplied + Curvatures*((u-u0)/Unorm)^2.
/// If value is <c>null</c>c> then no curvatures are added to the model
/// </summary>
public double Y_max = double.NaN;
public double[] Curvatures { get; set; } = null;

/// <summary>
/// User-specified inputs to model fitting process such as minima,maxima and working point
/// The unceratainties of the curvature term of the process gains
/// </summary>
public FittingSpecs FittingSpecs = new FittingSpecs();
public double[] CurvatureUnc { get; set; } = null;

/// <summary>
/// A time constant in seconds, the time a 1. order linear system requires to do 63% of a step response.
/// Set to zero to turn off time constant in model.
/// </summary>
public double TimeConstant_s { get; set; } = 0;

/// <summary>
/// Damping (second-order) values between ~0.3-0.99 will cause step response with a single visibl overshoot. )
/// Set to zero to disable damping.
/// As values less than 0.3 approach zero, the step response will become more and more oscillatory.
/// </summary>
public double DampingRatio { get; set; } = 0;

/// <summary>
/// The uncertinty of the time constant estimate
/// </summary>
Expand All @@ -49,28 +48,23 @@ public class UnitParameters : ModelParametersBaseClass
/// Set to zero to turn of time delay in model.
/// </summary>
public double TimeDelay_s { get; set; } = 0;
/// <summary>
/// An array of gains that determine how much in the steady state each input change affects the output(multiplied with (u-u0))
/// </summary>
public double[] LinearGains { get; set; } = null;

/// <summary>
/// An array of 95% uncertatinty in the linear gains (u-u0))
/// Damping (second-order) values between ~0.3-0.99 will cause step response with a single visibl overshoot. )
/// Set to zero to disable damping.
/// As values less than 0.3 approach zero, the step response will become more and more oscillatory.
/// </summary>
public double[] LinearGainUnc { get; set; } = null;

public double DampingRatio { get; set; } = 0;

/// <summary>
/// The nonlinear curvature of the process gain, this paramter is multiplied + Curvatures*((u-u0)/Unorm)^2.
/// If value is <c>null</c>c> then no curvatures are added to the model
/// The constant bias that is added so that models and dataset match on average, this value will depend on U0 and other parameters.
/// </summary>
public double[] Curvatures { get; set; } = null;
public double Bias { get; set; } = 0;

/// <summary>
/// The unceratainties of the curvature term of the process gains
/// The 95% uncertainty of the bias
/// </summary>
public double[] CurvatureUnc { get; set; } = null;

public double? BiasUnc { get; set; } = null;

/// <summary>
/// The working point of the model, the value of each U around which the model is localized.
Expand All @@ -85,14 +79,19 @@ public class UnitParameters : ModelParametersBaseClass
public double[] UNorm { get; set; } = null;

/// <summary>
/// The constant bias that is added so that models and dataset match on average, this value will depend on U0 and other parameters.
/// The minimum allowed output value(if set to NaN, no minimum is applied)
/// </summary>
public double Bias { get; set; } = 0;
public double Y_min = double.NaN;

/// <summary>
/// The 95% uncertainty of the bias
/// the maximum allowed output value(if set to NaN, no maximum is applied)
/// </summary>
public double? BiasUnc { get; set; } = null;
public double Y_max = double.NaN;

/// <summary>
/// User-specified inputs to model fitting process such as minima,maxima and working point
/// </summary>
public FittingSpecs FittingSpecs = new FittingSpecs();


private List<UnitdentWarnings> errorsAndWarningMessages;
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.32</Version>
<Version>1.3.33</Version>
<Company>Equinor</Company>
<Authors>Equinor</Authors>
<IncludeSymbols>true</IncludeSymbols>
Expand Down

0 comments on commit aa3674c

Please sign in to comment.