diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs index 5c0247b7f..379cf20f6 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs @@ -50,7 +50,7 @@ namespace TBF.BenchControl.Elde.RegulValve { if (args.Command == CfgChangeCmd.CfgChange) { - RegulValveCfg.PidCoef = tmpcfg.PidCoef; + RegulValveCfg.PidCoef = tmpcfg.PidCoef; // TODO PID: Remove RegulValveCfg.StableTimeMs = tmpcfg.StableTimeMs; RegulValveCfg.FlowStableSec = tmpcfg.FlowStableSec; } @@ -102,12 +102,13 @@ namespace TBF.BenchControl.Elde.RegulValve /// Flowmeter component /// Lower limit of the required flow [m3/h] /// Higher limit of the required flow [m3/h] - /// Measured flow [m3/h] + /// PID coefficient (float) + /// Measured flow [m3/h] /// Timeout in [s] /// SetFlowOp instance - public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout) + public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout) { - return new SetFlowOp(controlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout); + return new SetFlowOp(controlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout); } /// @@ -120,9 +121,9 @@ namespace TBF.BenchControl.Elde.RegulValve /// Measured flow [m3/h] /// Timeout in [s] /// SetFlowOp instance - public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout, float filterConstant) + public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout, float filterConstant) { - return new SetFlowOp(controlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true); + return new SetFlowOp(controlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, true); } /// diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs index 97fab0fb4..2f8c5a286 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs @@ -17,7 +17,7 @@ namespace TBF.BenchControl.Elde.RegulValve public int Idx1; /// 1..7 public int DacValueClosed; /// 0..1023 public int DacValueOpen; /// 0..1023 - public int PidCoef; /// 1..100 + public int PidCoef; /// 1..100 // TODO PID: Remove public int StableTimeMs; /// 200..1500 ms public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions public int FlowStableSec; /// 0..60 sec @@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde.RegulValve Idx1 = 1; DacValueClosed = 100; DacValueOpen = 500; - PidCoef = 20; + PidCoef = 20; // TODO PID: Remove StableTimeMs = 500; StoredPositionReuse = false; FlowStableSec = 5; @@ -55,7 +55,7 @@ namespace TBF.BenchControl.Elde.RegulValve Idx1, DacValueClosed, DacValueOpen, - PidCoef, + PidCoef, // TODO PID: Remove StableTimeMs, StoredPositionReuse, FlowStableSec); diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs index 3660cd42c..090d7e7b1 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs @@ -72,7 +72,7 @@ namespace TBF.BenchControl.Elde.RegulValve positionTextBox.Text = config.Idx1.ToString(); dacClosedTextBox.Text = config.DacValueClosed.ToString(); dacOpenTextBox.Text = config.DacValueOpen.ToString(); - pidCoefTextBox.Text = config.PidCoef.ToString(); + pidCoefTextBox.Text = config.PidCoef.ToString(); // TODO PID: Remove stableTimeTextBox.Text = config.StableTimeMs.ToString(); storedPosReuseCheckBox.Checked = config.StoredPositionReuse; flowStableSecTextBox.Text = config.FlowStableSec.ToString(); @@ -180,6 +180,7 @@ namespace TBF.BenchControl.Elde.RegulValve flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange); } + // TODO PID: Remove tmp = int.Parse(pidCoefTextBox.Text); if (config.PidCoef != tmp) { diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs index 544cce3d6..ca90b3c02 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs @@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde.RegulValve private static readonly ILog log = LogManager.GetLogger(typeof(SetFlowOp)); public override string ToString() { - return string.Format("SetFlowOp({0},{1},{2})", regulValve.Name, reqFlowLo, reqFlowHi); + return string.Format("SetFlowOp({0}, Qfrom={1}, Qto={2}, PID={3})", regulValve.Name, reqFlowLo, reqFlowHi, pidCoef); } /// Set by the constructor @@ -22,6 +22,7 @@ namespace TBF.BenchControl.Elde.RegulValve readonly float reqFlowLo; readonly float reqFlowHi; readonly float reqFlowAve; + readonly float pidCoef; readonly int timeout; readonly bool leaveMeasurementRunning; @@ -56,11 +57,13 @@ namespace TBF.BenchControl.Elde.RegulValve /// Flowmeter component /// Lower limit of the flow to be achieved in [m3/h] /// Upper limit of the flow to be achieved in [m3/h] + /// PID coefficient (float) /// Timeout for the flow setting in [s] /// true = Leave the measurement running after op. stop /// Only Elde.Valve flow are used, other flow on the lists are ignored public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regulValve, IFlowMeter flowMeter, - float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout, bool leaveMeasurementRunning) + float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, + int timeout, bool leaveMeasurementRunning) { if (controlBoard == null) throw new ArgumentNullException("ctrlBoard"); this.controlBoard = controlBoard; @@ -87,6 +90,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.reqFlowLo = requiredFlowLo; this.reqFlowHi = requiredFlowHi; this.reqFlowAve = (reqFlowLo + reqFlowHi) / 2.0f; + this.pidCoef = pidCoef; this.measuredFlow = measuredFlow; this.timeout = timeout; @@ -101,8 +105,8 @@ namespace TBF.BenchControl.Elde.RegulValve /// Events: FlowSet /// public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, - float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout) - : this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false) + float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout) + : this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, false) { } @@ -111,8 +115,8 @@ namespace TBF.BenchControl.Elde.RegulValve /// Events: FlowSet /// public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, - float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow) - : this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false) + float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow) + : this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, int.MaxValue, false) { } @@ -174,6 +178,7 @@ namespace TBF.BenchControl.Elde.RegulValve TestMethods tm = 0; StopDevs sd = 0; + // TODO PID: Replace 'regulValve.RegulValveCfg.PidCoef' by operation parameter 'pidCoef' controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route, int.MaxValue, tm, 0.0f, regulValve.RegulValveCfg.PidCoef, 0, sd); } diff --git a/TestBenchFramework/BenchControl/GenericDevices/IRegulValve.cs b/TestBenchFramework/BenchControl/GenericDevices/IRegulValve.cs index ac4548e56..d10158854 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IRegulValve.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IRegulValve.cs @@ -23,10 +23,12 @@ namespace TBF.BenchControl.GenericDevices /// /// Lower limit of the required flow [m3/h] /// Higher limit of the required flow [m3/h] - /// Measured flow [m3/h] + /// PID coefficient (float) + /// Measured flow [m3/h] /// Timeout in [s] /// SetFlowOp instance - IOperation SetFlowOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout); + IOperation SetFlowOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, + float pidCoef, FloatBox measuredFlow, int timeout); /// /// Operation to set the water flow within tolerances. Leave the measurement running. @@ -34,11 +36,13 @@ namespace TBF.BenchControl.GenericDevices /// /// Lower limit of the required flow [m3/h] /// Higher limit of the required flow [m3/h] - /// Measured flow [m3/h] + /// PID coefficient (float) + /// Measured flow [m3/h] /// Timeout in [s] /// Passed to SendCommand() as argument filterContant /// SetFlowOp instance - IOperation SetFlowAndMeasureOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, FloatBox measuredFlow, int timeout, float filter); + IOperation SetFlowAndMeasureOp(IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, + float pidCoef, FloatBox measuredFlow, int timeout, float filter); /// /// Operation to set the regulation valve to a required position diff --git a/TestBenchFramework/BenchControl/OutputPath.cs b/TestBenchFramework/BenchControl/OutputPath.cs index 3059ff9b7..e3d288757 100644 --- a/TestBenchFramework/BenchControl/OutputPath.cs +++ b/TestBenchFramework/BenchControl/OutputPath.cs @@ -11,6 +11,7 @@ namespace TBF.BenchControl public float Qto; public IRegulValve RegulValve; public IFlowMeter FlowMeter; + public float PidCoef; public IValve StartValve; public IDiverter Diverter; public ITempMeter TempDiv; @@ -26,6 +27,7 @@ namespace TBF.BenchControl Name = name; ValvesOpen = new List(); ValvesClose = new List(); + PidCoef = 10.0f; /// TODO PID: remove } /// Constructor from data entity @@ -36,6 +38,7 @@ namespace TBF.BenchControl Qto = entity.Qto; RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components); FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components); + PidCoef = entity.PidCoef; StartValve = (IValve)TbfComponents.FindComponent(entity.StartValve, components); Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components); TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components); diff --git a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs index 45a497119..afc2cfab2 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs @@ -58,7 +58,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection //-------------------------------- State.Create("RoiDetection : Setting the flow") .AddOperation(checkUiOp) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs index 59845f38a..d7cf2ba59 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs @@ -125,7 +125,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters //-------------------------------- State.Create("CombinedMeters : Setting the flow") .AddOperation(checkUiOp) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 0bacfed7d..ec2b84566 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -138,7 +138,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection State.Create("CombinedWithDetection : Set the initial flow") .AddOperation(checkUiOp) .AddOperations(measureOperations) - .AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600, (float)test.TolerRed)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600, (float)test.TolerRed)) /// timeout = 10 min. .EnterState(); do { @@ -323,7 +323,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection State.Create("CombinedWithDetection : Switching flow detected, going back") .AddOperation(checkUiOp) .AddOperations(measureOperations) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { @@ -344,7 +344,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection //State.Create("set_RV_position", .AddOperation(checkUiOp) .AddOperations(measureOperations) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_test, qto_test, refFlow, 600)) /// timeout = 10 sec. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_test, qto_test, outPath.PidCoef, refFlow, 600)) /// timeout = 10 sec. //.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue)) .EnterState(); do diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index c5703ee37..e018ff50d 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -123,7 +123,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection //-------------------------------- State.Create("FixedStartMassCollection : Setting the flow") .AddOperation(checkUiOp) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index ae818b4ba..5848336e2 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -120,7 +120,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart //-------------------------------- State.Create("FlyingStart : Setting the flow") .AddOperation(checkUiOp) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs index 55d90a228..bd08de237 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs @@ -120,7 +120,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod //-------------------------------- State.Create("FlyingStartCollectionMethod : Setting the flow") .AddOperation(checkUiOp) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs index 270789a27..98429fd6f 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs @@ -120,7 +120,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration //-------------------------------- State.Create("ReferenceFlowmeterCalibration : Setting the flow") .AddOperation(checkUiOp) - .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min. + .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, refFlow, 600)) /// timeout = 10 min. .EnterState(); do { diff --git a/TestBenchFramework/Entities/OutputPath.cs b/TestBenchFramework/Entities/OutputPath.cs index 4b3f2a438..5545244c2 100644 --- a/TestBenchFramework/Entities/OutputPath.cs +++ b/TestBenchFramework/Entities/OutputPath.cs @@ -12,6 +12,7 @@ namespace TBF.Entities public virtual float Qto { get; set; } /// Water flow in [m3/h] public virtual string RegulValve { get; set; } public virtual string FlowMeter { get; set; } + public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path public virtual string StartValve { get; set; } public virtual string Diverter { get; set; } public virtual string TempDiv { get; set; } @@ -26,7 +27,8 @@ namespace TBF.Entities public OutputPath() { - } + PidCoef = 10.0f; /// TODO PID: remove + } public OutputPath(string name, int itemNr) : this() @@ -42,6 +44,7 @@ namespace TBF.Entities Qto = path.Qto; RegulValve = (path.RegulValve != null) ? path.RegulValve.Cfg.Name : null; FlowMeter = (path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : null; + PidCoef = path.PidCoef; StartValve = (path.StartValve != null) ? path.StartValve.Cfg.Name : null; Diverter = (path.Diverter != null) ? path.Diverter.Cfg.Name : null; TempDiv = (path.TempDiv != null) ? path.TempDiv.Cfg.Name : null; @@ -74,6 +77,7 @@ namespace TBF.Entities result.Qto = Qto; result.RegulValve = RegulValve; result.FlowMeter = FlowMeter; + result.PidCoef = PidCoef; result.StartValve = StartValve; result.Diverter = Diverter; result.TempDiv = TempDiv; diff --git a/TestBenchFramework/Mappings/OutputPathMap.cs b/TestBenchFramework/Mappings/OutputPathMap.cs index 2cf6ea31e..78f1c99f2 100644 --- a/TestBenchFramework/Mappings/OutputPathMap.cs +++ b/TestBenchFramework/Mappings/OutputPathMap.cs @@ -14,6 +14,7 @@ namespace TBF.Mappings Map(x => x.Qto); Map(x => x.RegulValve); Map(x => x.FlowMeter); + //Map(x => x.PID); /// TODO PID: enable Map(x => x.StartValve); Map(x => x.Diverter); Map(x => x.TempDiv); diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index 0a40c6df4..de74d5d00 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -726,6 +726,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Flowmeter. + /// + internal static string Flowmeter { + get { + return ResourceManager.GetString("Flowmeter", resourceCulture); + } + } + /// /// Looks up a localized string similar to Get mass of water in the tank. /// @@ -1203,6 +1212,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to PID. + /// + internal static string PID { + get { + return ResourceManager.GetString("PID", resourceCulture); + } + } + /// /// Looks up a localized string similar to Please change the following settings:. /// diff --git a/TestBenchFramework/Resources/Strings.de.resx b/TestBenchFramework/Resources/Strings.de.resx index d9b4e455b..3f40cad83 100644 --- a/TestBenchFramework/Resources/Strings.de.resx +++ b/TestBenchFramework/Resources/Strings.de.resx @@ -780,4 +780,7 @@ mehr + + Durchflussmesser + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 67e8295df..97290be63 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -874,4 +874,10 @@ Changes will be lost. Do you want to proceed? + + PID + + + Flowmeter + \ No newline at end of file diff --git a/TestBenchFramework/UiControls/PathsOutputCtrl.cs b/TestBenchFramework/UiControls/PathsOutputCtrl.cs index 262c80315..9437defb2 100644 --- a/TestBenchFramework/UiControls/PathsOutputCtrl.cs +++ b/TestBenchFramework/UiControls/PathsOutputCtrl.cs @@ -21,7 +21,8 @@ namespace TBF.UiControls Qfrom, Qto, RegulValve, - Ref, + RefFlowmtr, + PidCoef, StartValve, Div, Tdiv, @@ -60,12 +61,13 @@ namespace TBF.UiControls Columns.Add(Strings.Q_from_m3h, (ls.OutputColumnCount > 1) ? ls.OutputColumnWidths[1] : 50 * parent.Dpi / PathsDlg.Dpi100pct); Columns.Add(Strings.Q_to_m3h, (ls.OutputColumnCount > 2) ? ls.OutputColumnWidths[2] : 50 * parent.Dpi / PathsDlg.Dpi100pct); Columns.Add(Strings.Reg_valve, (ls.OutputColumnCount > 3) ? ls.OutputColumnWidths[3] : 80 * parent.Dpi / PathsDlg.Dpi100pct); - Columns.Add(Strings.Reference, (ls.OutputColumnCount > 4) ? ls.OutputColumnWidths[4] : 85 * parent.Dpi / PathsDlg.Dpi100pct); - Columns.Add(Strings.StartValve, (ls.OutputColumnCount > 5) ? ls.OutputColumnWidths[5] : 80 * parent.Dpi / PathsDlg.Dpi100pct); - Columns.Add(Strings.Diverter, (ls.OutputColumnCount > 6) ? ls.OutputColumnWidths[6] : 60 * parent.Dpi / PathsDlg.Dpi100pct); - Columns.Add(Strings.T_div, (ls.OutputColumnCount > 7) ? ls.OutputColumnWidths[7] : 70 * parent.Dpi / PathsDlg.Dpi100pct); - Columns.Add(Strings.Balance, (ls.OutputColumnCount > 8) ? ls.OutputColumnWidths[8] : 50 * parent.Dpi / PathsDlg.Dpi100pct); - Columns.Add(Strings.Emptying_valve, (ls.OutputColumnCount > 9) ? ls.OutputColumnWidths[9] : 80 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.Flowmeter, (ls.OutputColumnCount > 4) ? ls.OutputColumnWidths[4] : 85 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.PID, (ls.OutputColumnCount > 5) ? ls.OutputColumnWidths[5] : 50 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.StartValve, (ls.OutputColumnCount > 6) ? ls.OutputColumnWidths[6] : 80 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.Diverter, (ls.OutputColumnCount > 7) ? ls.OutputColumnWidths[7] : 60 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.T_div, (ls.OutputColumnCount > 8) ? ls.OutputColumnWidths[8] : 70 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.Balance, (ls.OutputColumnCount > 9) ? ls.OutputColumnWidths[9] : 50 * parent.Dpi / PathsDlg.Dpi100pct); + Columns.Add(Strings.Emptying_valve, (ls.OutputColumnCount > 10)? ls.OutputColumnWidths[10]: 80 * parent.Dpi / PathsDlg.Dpi100pct); int clmn = (int)Column.FixedColumnsCount; foreach (var vlv in parent.Valves) { @@ -107,15 +109,16 @@ namespace TBF.UiControls editors = new Control[fixedColumnsCount + 64]; /// - editors[(int)Column.Name] = new TextBox(); /// Name - editors[(int)Column.Qfrom] = new TextBox(); /// Q_from - editors[(int)Column.Qto] = new TextBox(); /// Q_to + editors[(int)Column.Name] = new TextBox(); /// Name + editors[(int)Column.Qfrom] = new TextBox(); /// Q_from + editors[(int)Column.Qto] = new TextBox(); /// Q_to editors[(int)Column.RegulValve] = regulValveComboBox; - editors[(int)Column.Ref] = flowMeterComboBox; - editors[(int)Column.StartValve] = startValveComboBox; - editors[(int)Column.Div] = diverterComboBox; - editors[(int)Column.Tdiv] = tempMeterDivComboBox; - editors[(int)Column.Scale] = balanceComboBox; + editors[(int)Column.RefFlowmtr] = flowMeterComboBox; + editors[(int)Column.PidCoef] = new TextBox(); /// PID + editors[(int)Column.StartValve] = startValveComboBox; + editors[(int)Column.Div] = diverterComboBox; + editors[(int)Column.Tdiv] = tempMeterDivComboBox; + editors[(int)Column.Scale] = balanceComboBox; editors[(int)Column.EmptyValve] = emptyValveComboBox; /// Prepare valve combo-boxes (max. 64 valves) for (int i = 0; i < 64; i++) @@ -158,6 +161,7 @@ namespace TBF.UiControls lvi.SubItems.Add(path.Qto.ToString()); lvi.SubItems.Add((path.RegulValve != null) ? path.RegulValve.Cfg.Name : "---"); lvi.SubItems.Add((path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : "---"); + lvi.SubItems.Add(path.PidCoef.ToString("F1")); lvi.SubItems.Add((path.StartValve != null) ? path.StartValve.Cfg.Name : "---"); lvi.SubItems.Add((path.Diverter != null) ? path.Diverter.Cfg.Name : "---"); lvi.SubItems.Add((path.TempDiv != null) ? path.TempDiv.Cfg.Name : "---"); @@ -203,8 +207,13 @@ namespace TBF.UiControls entity.Qto = Qto; entity.RegulValve = lvi.SubItems[(int)Column.RegulValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RegulValve].Text; - entity.FlowMeter = lvi.SubItems[(int)Column.Ref].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Ref].Text; - entity.StartValve = lvi.SubItems[(int)Column.StartValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StartValve].Text; + entity.FlowMeter = lvi.SubItems[(int)Column.RefFlowmtr].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RefFlowmtr].Text; + + float pid; + allOk &= Utils.TryParseSFloat(lvi.SubItems[(int)Column.PidCoef].Text, out pid); + entity.PidCoef = pid; + + entity.StartValve = lvi.SubItems[(int)Column.StartValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StartValve].Text; entity.Diverter = lvi.SubItems[(int)Column.Div].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Div].Text; entity.TempDiv = lvi.SubItems[(int)Column.Tdiv].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Tdiv].Text; entity.Balance = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;