Skip to content

Commit

Permalink
fix accidentally added code during refactor
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 54c5f29 commit f8143e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 7 additions & 6 deletions Dynamic/Identification/DisturbanceIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ private static UnitDataSet RemoveSetpointAndOtherInputChangeEffectsFromDataSet(U
var unitDataSet_adjusted = new UnitDataSet(unitDataSet);
if (unitModel != null && pidParams != null)
{
var pidModel1 = new PidModel(pidParams, "PID");
// BEGIN "no_dist" process simulation =
// a simulation of the process that does not include any real Y_meas or u_pid, thus no effects of
// disturbances are visible in this simulation

var pidModel1 = new PidModel(pidParams, "PID");
var processSim_noDist = new PlantSimulator(

var processSim_noDist = new PlantSimulator(
new List<ISimulatableModel> { pidModel1, unitModel });
processSim_noDist.ConnectModels(unitModel, pidModel1);
processSim_noDist.ConnectModels(pidModel1, unitModel,pidInputIdx);
Expand All @@ -174,12 +175,12 @@ private static UnitDataSet RemoveSetpointAndOtherInputChangeEffectsFromDataSet(U
inputData_noDist.Add(processSim_noDist.AddExternalSignal(pidModel1, SignalType.Setpoint_Yset), unitDataSet.Y_setpoint);
inputData_noDist.CreateTimestamps(unitDataSet.GetTimeBase());
inputData_noDist.SetIndicesToIgnore(unitDataSet.IndicesToIgnore);


// rewrite:
// (var processSim_noDist, var inputData_noDist) = PlantSimulator.CreateFeedbackLoop(unitDataSet, pidModel1, unitModel, pidInputIdx);
// (var processSim_noDist, var inputData_noDist) = PlantSimulator.CreateFeedbackLoop(unitDataSet, pidModel1, unitModel, pidInputIdx);
var noDist_isOk = processSim_noDist.Simulate(inputData_noDist, out TimeSeriesDataSet simData_noDist);
noDist_isOk = false;//TODO: remove temporary
// noDist_isOk = false;//TODO: remove temporary
if (noDist_isOk)
{
int idxFirstGoodValue = 0;
Expand Down
5 changes: 2 additions & 3 deletions Dynamic/PlantSimulator/PlantSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ public string ConnectModels(ISimulatableModel upstreamModel, ISimulatableModel d
/// <summary>
/// Create a PlantSimulator and TimeSeriesDataSet from a UnitDataSet, PidModel and UnitModel to do closed-loop simulations
///
/// The feedback loop has no disturbance signal added, but this can be added to the returned PlantSimualtor as needed.
///
/// </summary>
/// <param name="unitDataSet"></param>
/// <param name="pidModel"></param>
Expand All @@ -413,9 +415,6 @@ public static (PlantSimulator, TimeSeriesDataSet) CreateFeedbackLoop(UnitDataSet
var signalId1 = plantSim.ConnectModels(unitModel, pidModel);
var signalId2 = plantSim.ConnectModels(pidModel, unitModel, pidInputIdx);

// tell the simulator that there is a disturbance
// plantSim.AddExternalSignal(unitModel, SignalType.Disturbance_D);

var inputData = new TimeSeriesDataSet();
inputData.Add(signalId1, unitDataSet.Y_meas);
inputData.Add(signalId2, unitDataSet.U.GetColumn(pidInputIdx));
Expand Down

0 comments on commit f8143e4

Please sign in to comment.