final modification for AdjustableMeter.cs, Added units A,V ElectricUnits, calculation based on [A]
This commit is contained in:
parent
30f5e6c935
commit
2a94347f3e
@ -105,6 +105,14 @@ namespace Common
|
||||
///
|
||||
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
|
||||
[Description("kWh/pulse")] kWhpp, /// 1 kWh/pulse
|
||||
|
||||
///
|
||||
[Description("A")] A, /// *1 A
|
||||
[Description("mA")] mA, /// 1 mA = 0.001 A
|
||||
///
|
||||
[Description("V")] V, /// *1 V
|
||||
[Description("mV")] mV, /// 1 mV = 0.001 V
|
||||
|
||||
|
||||
Count
|
||||
}
|
||||
@ -135,6 +143,8 @@ namespace Common
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum und Uhrzeit")] DateTime,
|
||||
[Description("Aufgezählt")] Enumerated,
|
||||
[Description("Strom")] Current,
|
||||
[Description("Spannung")] Voltage,
|
||||
#elif LANG_PL
|
||||
[Description("Objętość")] Volume,
|
||||
[Description("Przepływ")] Flow,
|
||||
@ -158,6 +168,8 @@ namespace Common
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Data i czas")] DateTime,
|
||||
[Description("Wyliczone")] Enumerated,
|
||||
[Description("Prąd")] Current,
|
||||
[Description("Napięcie")] Voltage,
|
||||
#elif LANG_CS
|
||||
[Description("Objem")] Volume,
|
||||
[Description("Průtok")] Flow,
|
||||
@ -181,6 +193,8 @@ namespace Common
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum a čas")] DateTime,
|
||||
[Description("Vyjmenované")] Enumerated,
|
||||
[Description("Proud")] Current,
|
||||
[Description("Napětí")] Voltage,
|
||||
#elif LANG_IT
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flusso")] Flow,
|
||||
@ -204,6 +218,8 @@ namespace Common
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Data e ora")] DateTime,
|
||||
[Description("Enumerato")] Enumerated,
|
||||
[Description("Corrente")] Current,
|
||||
[Description("Voltaggio")] Voltage,
|
||||
#else
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flow")] Flow,
|
||||
@ -227,6 +243,8 @@ namespace Common
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Date and time")] DateTime,
|
||||
[Description("Enumerated")] Enumerated,
|
||||
[Description("Current")] Current,
|
||||
[Description("Voltage")] Voltage,
|
||||
#endif
|
||||
Count,
|
||||
}
|
||||
@ -242,7 +260,8 @@ namespace Common
|
||||
{
|
||||
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
|
||||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
|
||||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
|
||||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh || unit == Unit.A ||
|
||||
unit == Unit.V;
|
||||
}
|
||||
|
||||
public static bool IsQuantity(Unit unit, Quantity quantity)
|
||||
@ -351,6 +370,14 @@ namespace Common
|
||||
case Unit.ppkWh:
|
||||
case Unit.kWhpp:
|
||||
return Quantity.PulsePerKWh;
|
||||
|
||||
case Unit.A:
|
||||
case Unit.mA:
|
||||
return Quantity.Current;
|
||||
|
||||
case Unit.V:
|
||||
case Unit.mV:
|
||||
return Quantity.Voltage;
|
||||
|
||||
default:
|
||||
return Quantity.Number;
|
||||
@ -372,6 +399,8 @@ namespace Common
|
||||
public static bool IsPulsePerLtr(Unit unit) { return IsQuantity(unit, Quantity.PulsePerLtr); }
|
||||
public static bool IsPulsePerKWh(Unit unit) { return IsQuantity(unit, Quantity.PulsePerKWh); }
|
||||
public static bool IsConductivity(Unit unit) { return IsQuantity(unit, Quantity.Conductivity); }
|
||||
public static bool IsCurrent(Unit unit) { return IsQuantity(unit, Quantity.Current); }
|
||||
public static bool IsVoltage(Unit unit) { return IsQuantity(unit, Quantity.Voltage); }
|
||||
|
||||
|
||||
|
||||
@ -455,6 +484,13 @@ namespace Common
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
|
||||
|
||||
/// Current: internal representation in A
|
||||
case Unit.mA: return 1000 * v; /// 1000 mA = 1 A
|
||||
|
||||
/// Voltage: internal representation in V
|
||||
case Unit.mV: return 1000 * v; /// 1000 mV = 1 V
|
||||
|
||||
|
||||
default: return v; /// Do not convert
|
||||
}
|
||||
@ -534,6 +570,12 @@ namespace Common
|
||||
|
||||
/// Electrical conductivity
|
||||
case Unit.mSpm: return 10 * v;
|
||||
|
||||
/// Current: internal representation in A
|
||||
case Unit.mA: return 0.001 * v; /// 1 mA = 0.001 A
|
||||
|
||||
/// Voltage: internal representation in V
|
||||
case Unit.mV: return 0.001 * v; /// 1 mV = 0.001 V
|
||||
|
||||
/// Invert
|
||||
case Unit.kWhpp:
|
||||
|
||||
@ -22,6 +22,9 @@ namespace Config.Entities
|
||||
public virtual string PressMtrUp { get; set; }
|
||||
public virtual string PressMtrDown { get; set; }
|
||||
public virtual string PressMtrDelta { get; set; }
|
||||
public virtual string ElectricMtrUp { get; set; }
|
||||
public virtual string ElectricMtrDown { get; set; }
|
||||
public virtual string ElectricMtrDelta { get; set; }
|
||||
public virtual string StopBFValve { get; set; }
|
||||
|
||||
/// Valves
|
||||
@ -59,6 +62,9 @@ namespace Config.Entities
|
||||
result.PressMtrUp = PressMtrUp;
|
||||
result.PressMtrDown = PressMtrDown;
|
||||
result.PressMtrDelta = PressMtrDelta;
|
||||
result.ElectricMtrUp = ElectricMtrUp;
|
||||
result.ElectricMtrDown = ElectricMtrDown;
|
||||
result.ElectricMtrDelta = ElectricMtrDelta;
|
||||
result.StopBFValve = StopBFValve;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
|
||||
@ -78,6 +78,7 @@ namespace Config.Entities
|
||||
public virtual Unit TempUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
|
||||
public virtual Unit PressUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
|
||||
public virtual Unit LengthUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
|
||||
public virtual Unit ElectricUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
|
||||
|
||||
/// Wrappers
|
||||
public virtual double QfromM3ph()
|
||||
@ -209,6 +210,7 @@ namespace Config.Entities
|
||||
result.TempUnit = TempUnit;
|
||||
result.PressUnit = PressUnit;
|
||||
result.LengthUnit = LengthUnit;
|
||||
result.ElectricUnit = ElectricUnit;
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
||||
|
||||
return result;
|
||||
|
||||
@ -332,6 +332,12 @@ namespace SchematicDrawing
|
||||
Shapes[DrShIx(Shape.PressM, Sz.M)] = new DrawingShape(Shape.PressM, Sz.M, 0, 0);
|
||||
Shapes[DrShIx(Shape.PressM, Sz.L)] = new DrawingShape(Shape.PressM, Sz.L, 0, 0);
|
||||
Shapes[DrShIx(Shape.PressM, Sz.XL)] = new DrawingShape(Shape.PressM, Sz.XL, 0, 0);
|
||||
|
||||
/// Electric meter
|
||||
Shapes[DrShIx(Shape.ElectricM, Sz.S)] = new DrawingShape(Shape.ElectricM, Sz.S, 0, 0);
|
||||
Shapes[DrShIx(Shape.ElectricM, Sz.M)] = new DrawingShape(Shape.ElectricM, Sz.M, 0, 0);
|
||||
Shapes[DrShIx(Shape.ElectricM, Sz.L)] = new DrawingShape(Shape.ElectricM, Sz.L, 0, 0);
|
||||
Shapes[DrShIx(Shape.ElectricM, Sz.XL)] = new DrawingShape(Shape.ElectricM, Sz.XL, 0, 0);
|
||||
|
||||
/// Parallel flow meters
|
||||
Shapes[DrShIx(Shape.ParallelFlowM, Sz.S)] = new DrawingShape(Shape.ParallelFlowM, Sz.S, 0, 0);
|
||||
|
||||
@ -51,6 +51,7 @@ namespace SchematicDrawing
|
||||
Vacuum,
|
||||
Valve,
|
||||
WaterM,
|
||||
ElectricM,
|
||||
|
||||
Count,
|
||||
Custom,
|
||||
|
||||
23
TBF/Resources/Strings.Designer.cs
generated
23
TBF/Resources/Strings.Designer.cs
generated
@ -1,7 +1,6 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@ -1257,12 +1256,21 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Current.
|
||||
/// </summary>
|
||||
internal static string Current {
|
||||
get {
|
||||
return ResourceManager.GetString("Current", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to current.
|
||||
/// </summary>
|
||||
internal static string current {
|
||||
internal static string current_ {
|
||||
get {
|
||||
return ResourceManager.GetString("current", resourceCulture);
|
||||
return ResourceManager.GetString("current_", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6813,6 +6821,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Voltage.
|
||||
/// </summary>
|
||||
internal static string Voltage {
|
||||
get {
|
||||
return ResourceManager.GetString("Voltage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Volume.
|
||||
/// </summary>
|
||||
|
||||
@ -1746,4 +1746,10 @@
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Tisknout</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Proud</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Napětí</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -2211,4 +2211,10 @@
|
||||
<data name="Calibration_certificate_validity_expired" xml:space="preserve">
|
||||
<value>Kalibrierschein gültigkeit abgelaufen</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Strom</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Spannung</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -2010,4 +2010,10 @@
|
||||
<data name="Fill" xml:space="preserve">
|
||||
<value>Inonder</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Curren</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Tension</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -1779,4 +1779,10 @@
|
||||
<data name="Start_cycle" xml:space="preserve">
|
||||
<value>Avviare il ciclo</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Corrente</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Voltaggio</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -1686,4 +1686,10 @@
|
||||
<data name="Uncertainty" xml:space="preserve">
|
||||
<value>Nepevność</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Prąd</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Napięcie</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -1813,7 +1813,7 @@
|
||||
<data name="Refresh" xml:space="preserve">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
<data name="current" xml:space="preserve">
|
||||
<data name="current_" xml:space="preserve">
|
||||
<value>current</value>
|
||||
</data>
|
||||
<data name="Flow" xml:space="preserve">
|
||||
@ -2449,4 +2449,10 @@
|
||||
<data name="Test_Bench_Framework" xml:space="preserve">
|
||||
<value>Test Bench Framework</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Current</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Voltage</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -831,4 +831,10 @@
|
||||
<data name="Evaporation" xml:space="preserve">
|
||||
<value>Evaporare</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Current</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Voltage</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -1599,4 +1599,10 @@
|
||||
<data name="Evaporation" xml:space="preserve">
|
||||
<value>испарение</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Current</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Voltage</value>
|
||||
</data>
|
||||
</root>
|
||||
3302
TBF/Resources/Strings.zh-CN.Designer.cs
generated
3302
TBF/Resources/Strings.zh-CN.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -1191,4 +1191,10 @@
|
||||
<data name="Evaporation" xml:space="preserve">
|
||||
<value>蒸发</value>
|
||||
</data>
|
||||
<data name="Current" xml:space="preserve">
|
||||
<value>Current</value>
|
||||
</data>
|
||||
<data name="Voltage" xml:space="preserve">
|
||||
<value>Voltage</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -18,6 +18,9 @@ namespace TBF.Rig
|
||||
public IPressureMeter PressMtrUp;
|
||||
public IPressureMeter PressMtrDown;
|
||||
public IPressureMeter PressMtrDelta;
|
||||
public IAdjustableMeter ElectricMtrUp;
|
||||
public IAdjustableMeter ElectricMtrDown;
|
||||
public IAdjustableMeter ElectricMtrDelta;
|
||||
public IValve StopBFValve;
|
||||
public IList<IValve> ValvesOpen;
|
||||
public IList<IValve> ValvesClose;
|
||||
@ -43,6 +46,9 @@ namespace TBF.Rig
|
||||
PressMtrUp = TbfComponents.FindComponent(entity.PressMtrUp, components) as IPressureMeter;
|
||||
PressMtrDown = TbfComponents.FindComponent(entity.PressMtrDown, components) as IPressureMeter;
|
||||
PressMtrDelta = TbfComponents.FindComponent(entity.PressMtrDelta, components) as IPressureMeter;
|
||||
ElectricMtrUp = TbfComponents.FindComponent(entity.ElectricMtrUp, components) as IAdjustableMeter;
|
||||
ElectricMtrDown = TbfComponents.FindComponent(entity.ElectricMtrDown, components) as IAdjustableMeter;
|
||||
ElectricMtrDelta = TbfComponents.FindComponent(entity.ElectricMtrDelta, components) as IAdjustableMeter;
|
||||
StopBFValve = TbfComponents.FindComponent(entity.StopBFValve, components) as IValve;
|
||||
|
||||
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
||||
|
||||
@ -35,6 +35,7 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
public Unit TempUnit { get { return myCfg.TempUnit; } }
|
||||
public Unit PressUnit { get { return myCfg.PressUnit; } }
|
||||
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
|
||||
public Unit ElectricUnit { get { return myCfg.ElectricUnit; } }
|
||||
|
||||
public ICollection<ProcedureSelection> Sources
|
||||
{
|
||||
|
||||
@ -47,6 +47,7 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
public ProcedureSelection Source2; /// 21
|
||||
public ProcedureSelection Source3; /// 22
|
||||
public ProcedureSelection Source4; /// 23
|
||||
public Unit ElectricUnit; /// 24
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
|
||||
@ -36,6 +36,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
public Unit TempUnit { get { return myCfg.TempUnit; } }
|
||||
public Unit PressUnit { get { return myCfg.PressUnit; } }
|
||||
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
|
||||
public Unit ElectricUnit { get { return myCfg.ElectricUnit; } }
|
||||
public Side Side { get { return myCfg.Side; } }
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
|
||||
|
||||
@ -49,6 +49,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
public ProcedureSelection Source2; /// 23
|
||||
public ProcedureSelection Source3; /// 24
|
||||
public ProcedureSelection Source4; /// 25
|
||||
public Unit ElectricUnit; /// 26
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
@ -99,6 +100,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
Source2 = ProcedureSelection.FromLocalDB;
|
||||
Source3 = ProcedureSelection.None;
|
||||
Source4 = ProcedureSelection.None;
|
||||
ElectricUnit = Unit.A;
|
||||
|
||||
CalibCertificateNr = string.Empty;
|
||||
CalibDate = TBF.UI.Constants.MinDate;
|
||||
@ -133,6 +135,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
"Procedure selection source 2", /// 23
|
||||
"Procedure selection source 3", /// 24
|
||||
"Procedure selection source 4", /// 25
|
||||
"Preffered electric unit", /// 26
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@ -193,6 +196,13 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
for (ProcedureSelection src = 0; src < ProcedureSelection.Count; src++)
|
||||
list.Add(src.ToDescription());
|
||||
return list;
|
||||
|
||||
case 26:
|
||||
for (Unit unit = 0; unit < Unit.Count; unit++)
|
||||
if (Units.IsQuantity(unit, Quantity.Current) ||
|
||||
Units.IsQuantity(unit, Quantity.Voltage))
|
||||
list.Add(unit.ToDescription());
|
||||
return list;
|
||||
|
||||
default:
|
||||
return null;
|
||||
@ -229,6 +239,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
case 23: return Source2.ToDescription();
|
||||
case 24: return Source3.ToDescription();
|
||||
case 25: return Source4.ToDescription();
|
||||
case 26: return ElectricUnit.ToDescription();
|
||||
default:
|
||||
return string.Format("{0}: Bench={1}, ID={2}, Mtrs={3}, Lines={4}, Compund mtrs={5}, S1={6}, S2={7}, S3={8}, S4={9}",
|
||||
Name, TestBenchName, TestBenchId, WaterMetersCount, LinesCount, CompoundMetersCount, Source1, Source2, Source3, Source4);
|
||||
@ -329,6 +340,10 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
}
|
||||
break;
|
||||
|
||||
case 26:
|
||||
ElectricUnit = Units.FromDescription(str);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
@ -388,6 +403,10 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
if (str == source.ToDescription()) return true;
|
||||
}
|
||||
break;
|
||||
case 26:
|
||||
if (ParamValues(i).Contains(str)) return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
@ -425,6 +444,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
prms.Source2 = Source2;
|
||||
prms.Source3 = Source3;
|
||||
prms.Source4 = Source4;
|
||||
prms.ElectricUnit = ElectricUnit;
|
||||
|
||||
prms.CalibCertificateNr = this.CalibCertificateNr;
|
||||
prms.CertPath = this.CertPath;
|
||||
|
||||
31
TBF/Rig/GenericDevices/IAdjustableMeter.cs
Normal file
31
TBF/Rig/GenericDevices/IAdjustableMeter.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using TBF.Boxes;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.GenericDevices
|
||||
{
|
||||
public interface IAdjustableMeter : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Events: PressureDone, Error
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the measured pressure in bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadAdjustableOp(ref DoubleBox value);
|
||||
|
||||
/// <summary>
|
||||
/// Events: pressureDone, Error
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the measured pressure in bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadAdjustableOp(ref DoubleBox value, Event valueDone);
|
||||
|
||||
bool MsrmntAvailable { get; }
|
||||
double MeasuredVal { get; }
|
||||
double MsrdValLimLo { get; }
|
||||
double MsrdValLimHi { get; }
|
||||
string MsrdFormat { get; }
|
||||
Common.Unit MsrdUnit { get; }
|
||||
string AltString { get; }
|
||||
}
|
||||
}
|
||||
@ -29,5 +29,6 @@ namespace TBF.Rig.GenericDevices
|
||||
Unit TempUnit { get; }
|
||||
Unit PressUnit { get; }
|
||||
Unit LengthUnit { get; }
|
||||
}
|
||||
Unit ElectricUnit { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,43 +12,43 @@ using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
namespace TBF.Rig.Modbus.Meret.AdjustableScale
|
||||
{
|
||||
public class PressureMeter : ComponentBase, IPressureMeter, IDevice, ISequenceCondition, IDrawingItCmpntWithMeasuredVal
|
||||
public class AdjustableMeter : ComponentBase, IAdjustableMeter, IDevice, ISequenceCondition, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(AdjustableMeter));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly PressureMeterCfg pressureMtrCfg;
|
||||
public IDrawingItem DrawingItem { get { return pressureMtrCfg as IDrawingItem; } }
|
||||
readonly AdjustableMeterCfg _adjustableMtrCfg;
|
||||
public IDrawingItem DrawingItem { get { return _adjustableMtrCfg as IDrawingItem; } }
|
||||
|
||||
Common.Modbus modbus;
|
||||
|
||||
double receivedPressure;
|
||||
double receivedValue;
|
||||
double receivedAmpers;
|
||||
|
||||
public bool MsrmntAvailable { get { return true; } }
|
||||
public double MeasuredVal { get { return receivedPressure; } }
|
||||
public double MsrdValLimLo { get { return Units.ConvertFrom(MsrdUnit, pressureMtrCfg.MsrdValLimLo); } }
|
||||
public double MsrdValLimHi { get { return Units.ConvertFrom(MsrdUnit, pressureMtrCfg.MsrdValLimHi); } }
|
||||
public Unit MsrdUnit { get { return pressureMtrCfg.MsrdUnit; } }
|
||||
public string MsrdFormat { get { return pressureMtrCfg.MsrdFormat; } }
|
||||
public double MeasuredVal { get { return receivedValue; } }
|
||||
public double MsrdValLimLo { get { return Units.ConvertFrom(MsrdUnit, _adjustableMtrCfg.MsrdValLimLo); } }
|
||||
public double MsrdValLimHi { get { return Units.ConvertFrom(MsrdUnit, _adjustableMtrCfg.MsrdValLimHi); } }
|
||||
public Unit MsrdUnit { get { return _adjustableMtrCfg.MsrdUnit; } }
|
||||
public string MsrdFormat { get { return _adjustableMtrCfg.MsrdFormat; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
|
||||
int ticketNumber; /// 0 .. number of devices registered for regular polling - 1
|
||||
|
||||
public double CorrectionValLo { get { return Units.ConvertFrom(MsrdUnit, pressureMtrCfg.CorrectionValLo); } }
|
||||
public double CorrectionValHi { get { return Units.ConvertFrom(MsrdUnit, pressureMtrCfg.CorrectionValHi); } }
|
||||
public double CorrectionValLo { get { return Units.ConvertFrom(MsrdUnit, _adjustableMtrCfg.CorrectionValLo); } }
|
||||
public double CorrectionValHi { get { return Units.ConvertFrom(MsrdUnit, _adjustableMtrCfg.CorrectionValHi); } }
|
||||
|
||||
IList<MeasurementCorrection> CorrectionsLocal;
|
||||
|
||||
|
||||
public PressureMeter() { }
|
||||
public AdjustableMeter() { }
|
||||
|
||||
public PressureMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
public AdjustableMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
pressureMtrCfg = cfg as PressureMeterCfg;
|
||||
_adjustableMtrCfg = cfg as AdjustableMeterCfg;
|
||||
CreateConditions();
|
||||
}
|
||||
|
||||
@ -85,19 +85,19 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
|
||||
private void InitModbus()
|
||||
{
|
||||
modbus = TbfComponents.FindComponent(pressureMtrCfg.ParentName) as Common.Modbus;
|
||||
modbus = TbfComponents.FindComponent(_adjustableMtrCfg.ParentName) as Common.Modbus;
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
modbus.ComponentNames[pressureMtrCfg.ModbusAddress] = Name;
|
||||
modbus.ComponentNames[_adjustableMtrCfg.ModbusAddress] = Name;
|
||||
ticketNumber = modbus.RegisterForPolling();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (DebugLevel == DebugMode.Normal && modbus.ReceivedTelegrams[pressureMtrCfg.ModbusAddress].Count > 0)
|
||||
if (DebugLevel == DebugMode.Normal && modbus.ReceivedTelegrams[_adjustableMtrCfg.ModbusAddress].Count > 0)
|
||||
{
|
||||
byte[] telegram = modbus.ReceivedTelegrams[pressureMtrCfg.ModbusAddress].Dequeue();
|
||||
byte[] telegram = modbus.ReceivedTelegrams[_adjustableMtrCfg.ModbusAddress].Dequeue();
|
||||
if (telegram.Length == 9 && telegram[1] == 4 && telegram[2] == 4)
|
||||
{
|
||||
/// Swap byte order
|
||||
@ -110,9 +110,17 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
telegram[5] = t2;
|
||||
telegram[6] = t1;
|
||||
|
||||
receivedAmpers = Units.ConvertFrom(Unit.kPa, System.BitConverter.ToSingle(telegram, 3));
|
||||
receivedPressure = MeasurementCorrection.GetCorrection(receivedAmpers, CorrectionsLocal);
|
||||
log.WarnFormat("Pressure: {0}={1}bar interpolated from Ampers: {2}", Name, receivedPressure.ToString("F3"), receivedAmpers.ToString("F3"));
|
||||
receivedAmpers = Units.ConvertFrom(Unit.A, System.BitConverter.ToSingle(telegram, 3));
|
||||
if (CorrectionsLocal != null)
|
||||
{
|
||||
receivedValue = MeasurementCorrection.GetCorrection(receivedAmpers, CorrectionsLocal);
|
||||
}
|
||||
else
|
||||
{
|
||||
receivedValue = receivedAmpers;
|
||||
}
|
||||
|
||||
log.WarnFormat("Adjustable meter: {0}={1} Unit interpolated from Ampers: {2}", Name, receivedValue.ToString("F3"), receivedAmpers.ToString("F3"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,7 +131,7 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
{
|
||||
const byte Function = 4; /// Read input registers
|
||||
const ushort Address = 0; /// Pressure
|
||||
modbus.SendMessage((byte)pressureMtrCfg.ModbusAddress, Function, Address, 2, Name);
|
||||
modbus.SendMessage((byte)_adjustableMtrCfg.ModbusAddress, Function, Address, 2, Name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,7 +147,7 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
{
|
||||
if (DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
return MeasurementCorrection.CorrectedValue(receivedPressure, Corrections);
|
||||
return MeasurementCorrection.CorrectedValue(receivedValue, Corrections);
|
||||
}
|
||||
else if (DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
@ -156,20 +164,20 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
/// </summary>
|
||||
/// <param name="pressureBox">Reference to a variable for the pressure in Bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressureBox)
|
||||
public IOperation ReadAdjustableOp(ref DoubleBox value)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressureBox);
|
||||
return new ReadValueOp(this, ref value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: pressureDone, Error
|
||||
/// Events: valueDone, Error
|
||||
/// </summary>
|
||||
/// <param name="pressureBox">Reference to a variable for the pressure in Bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressureBox, Event pressureDone)
|
||||
public IOperation ReadAdjustableOp(ref DoubleBox value, Event valueDone)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressureBox, pressureDone);
|
||||
return new ReadValueOp(this, ref value, valueDone);
|
||||
}
|
||||
|
||||
|
||||
@ -219,8 +227,8 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
ClearConditions();
|
||||
foreach (var pressLimit in new double[] { 2.18, 2.2, 2.22, 2.24, 2.26, 2.27 })
|
||||
{
|
||||
AddCondition(string.Format("{0} {1} > {2} bar", Strings.Wait_until, Name, pressLimit), new WaitUntilPressureIsOp(this, Pr.IsGT, pressLimit));
|
||||
AddCondition(string.Format("{0} {1} < {2} bar", Strings.Wait_until, Name, pressLimit), new WaitUntilPressureIsOp(this, Pr.IsLT, pressLimit));
|
||||
AddCondition(string.Format("{0} {1} > {2} bar", Strings.Wait_until, Name, pressLimit), new WaitUntilValueIsOp(this, Pr.IsGT, pressLimit));
|
||||
AddCondition(string.Format("{0} {1} < {2} bar", Strings.Wait_until, Name, pressLimit), new WaitUntilValueIsOp(this, Pr.IsLT, pressLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,12 +10,12 @@ using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
namespace TBF.Rig.Modbus.Meret.AdjustableScale
|
||||
{
|
||||
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IParamsProvider,
|
||||
public class AdjustableMeterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IParamsProvider,
|
||||
IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AdjustableMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
|
||||
@ -62,18 +62,18 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
PressureMeterCfg()
|
||||
AdjustableMeterCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
}
|
||||
|
||||
public PressureMeterCfg(IComponentFactory factory)
|
||||
public AdjustableMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.PressM;
|
||||
Shape = Shape.ElectricM;
|
||||
Sz = Sz.M;
|
||||
Factory = factory;
|
||||
Name = "Pr";
|
||||
Name = "Ad";
|
||||
ParentName = "Modbus";
|
||||
InitializeAll();
|
||||
}
|
||||
@ -84,8 +84,8 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
{
|
||||
ModbusAddress = 49;
|
||||
DefaultPressure = 2.34;
|
||||
MsrdFormat = "{0:F2} bar";
|
||||
MsrdUnit = Unit.bar;
|
||||
MsrdFormat = "{0:F2} A";
|
||||
MsrdUnit = Unit.A;
|
||||
MsrdValLimLo = -0.1;
|
||||
MsrdValLimHi = 25.0;
|
||||
|
||||
@ -98,13 +98,13 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Modbus address", /// 0
|
||||
"Default pressure", /// 1
|
||||
"Default value", /// 1
|
||||
"Display format", /// 2
|
||||
"Unit of pressure", /// 3
|
||||
"Pressure limit Lo", /// 4
|
||||
"Pressure limit Hi", /// 5
|
||||
"Correction Pressure limit Lo", /// 6
|
||||
"Correction Pressure limit Hi", /// 7
|
||||
"Unit", /// 3
|
||||
"Limit Lo", /// 4
|
||||
"Limit Hi", /// 5
|
||||
"Correction limit Lo", /// 6
|
||||
"Correction limit Hi", /// 7
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@ -114,7 +114,7 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
switch (i)
|
||||
{
|
||||
case 3:
|
||||
return new string[] { "Pa", "hPa", "mbar", "kPa", "inHg", "psi", "bar", "MPa" };
|
||||
return new string[] { "A", "mA", "V", "mV", "Pa", "hPa", "mbar", "kPa", "inHg", "psi", "bar", "MPa" };
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -145,7 +145,7 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
case 1: DefaultPressure = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: MsrdFormat = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3:
|
||||
foreach (var u in new Unit[] { Unit.Pa, Unit.hPa, Unit.mbar, Unit.kPa, Unit.inHg, Unit.psi, Unit.bar, Unit.MPa })
|
||||
foreach (var u in new Unit[] { Unit.A, Unit.mA, Unit.V, Unit.mV, Unit.Pa, Unit.hPa, Unit.mbar, Unit.kPa, Unit.inHg, Unit.psi, Unit.bar, Unit.MPa })
|
||||
{
|
||||
if (str == u.ToDescription())
|
||||
{
|
||||
@ -194,7 +194,7 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(PressureMeterCfg prms)
|
||||
void CopyContentTo(AdjustableMeterCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
@ -227,7 +227,7 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
PressureMeterCfg pars = new PressureMeterCfg();
|
||||
AdjustableMeterCfg pars = new AdjustableMeterCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
@ -4,22 +4,22 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
namespace TBF.Rig.Modbus.Meret.AdjustableScale
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new PressureMeter(); }
|
||||
public IComponent DummyComponent() { return new AdjustableMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new PressureMeter(cfg, components); }
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new AdjustableMeter(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new PressureMeterCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new AdjustableMeterCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(PressureMeterCfg.Serializer, component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(AdjustableMeterCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
TBF/Rig/Modbus/Meret/AdjustableScale/ReadValueOp.cs
Normal file
60
TBF/Rig/Modbus/Meret/AdjustableScale/ReadValueOp.cs
Normal file
@ -0,0 +1,60 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.Modbus.Meret.AdjustableScale
|
||||
{
|
||||
public class ReadValueOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadValueOp));
|
||||
public override string ToString() { return string.Format("ReadPressureOp(.,{0},.)", eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly AdjustableMeter _adjustableMeter;
|
||||
readonly DoubleBox value; /// Box for the measured value
|
||||
readonly Event eventDone;
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureDone or Error
|
||||
/// </summary>
|
||||
/// <param name="adjustableMeter">Pressure meter reference</param>
|
||||
/// <param name="value">Reference to the measured pressure variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadValueOp(AdjustableMeter adjustableMeter, ref DoubleBox value, Event eventDone)
|
||||
{
|
||||
if (adjustableMeter == null) throw new ArgumentNullException("adjustableMeter");
|
||||
this._adjustableMeter = adjustableMeter;
|
||||
this.value = value;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadValueOp(AdjustableMeter adjustableMeter, ref DoubleBox value)
|
||||
: this(adjustableMeter, ref value, Event.PressureDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (value != null) value.Val = _adjustableMeter.ReadPressure();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.PressureInDone or Event.PressureOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (value != null) value.Val = _adjustableMeter.ReadPressure();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
namespace TBF.Rig.Modbus.Meret.AdjustableScale
|
||||
{
|
||||
public enum Pr
|
||||
{
|
||||
@ -12,14 +12,14 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
IsLT,
|
||||
}
|
||||
|
||||
public class WaitUntilPressureIsOp : IOperation
|
||||
public class WaitUntilValueIsOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaitUntilPressureIsOp));
|
||||
public override string ToString() { return string.Format("WaitUntilPressureIsOp({0}, {1}, {2:F1}bar)", meter.Name, condition, pressureLimit); }
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaitUntilValueIsOp));
|
||||
public override string ToString() { return string.Format("WaitUntilPressureIsOp({0}, {1}, {2:F1}bar)", meter.Name, condition, valueLimit); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly PressureMeter meter;
|
||||
readonly double pressureLimit;
|
||||
readonly AdjustableMeter meter;
|
||||
readonly double valueLimit;
|
||||
readonly Pr condition;
|
||||
|
||||
/// <summary>
|
||||
@ -27,11 +27,11 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
/// </summary>
|
||||
/// <param name="meter">Temp. controller reference</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public WaitUntilPressureIsOp(PressureMeter meter, Pr condition, double pressureLimit)
|
||||
public WaitUntilValueIsOp(AdjustableMeter meter, Pr condition, double valueLimit)
|
||||
{
|
||||
if (meter == null) throw new ArgumentNullException("tempControl");
|
||||
this.meter = meter;
|
||||
this.pressureLimit = pressureLimit;
|
||||
this.valueLimit = valueLimit;
|
||||
this.condition = condition;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@ -43,11 +43,11 @@ namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
/// <summary>Run this operation</summary>
|
||||
public Event Run()
|
||||
{
|
||||
if (condition == Pr.IsGT && meter.ReadPressure() > pressureLimit)
|
||||
if (condition == Pr.IsGT && meter.ReadPressure() > valueLimit)
|
||||
{
|
||||
return Event.ConditionMet;
|
||||
}
|
||||
else if (condition == Pr.IsLT && meter.ReadPressure() < pressureLimit)
|
||||
else if (condition == Pr.IsLT && meter.ReadPressure() < valueLimit)
|
||||
{
|
||||
return Event.ConditionMet;
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.Modbus.PressureMeter.AdjustableScale
|
||||
{
|
||||
public class ReadPressureOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadPressureOp));
|
||||
public override string ToString() { return string.Format("ReadPressureOp(.,{0},.)", eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly PressureMeter pressureMeter;
|
||||
readonly DoubleBox pressure; /// Box for the measured value
|
||||
readonly Event eventDone;
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureDone or Error
|
||||
/// </summary>
|
||||
/// <param name="pressureMeter">Pressure meter reference</param>
|
||||
/// <param name="pressure">Reference to the measured pressure variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure, Event eventDone)
|
||||
{
|
||||
if (pressureMeter == null) throw new ArgumentNullException("pressureMeter");
|
||||
this.pressureMeter = pressureMeter;
|
||||
this.pressure = pressure;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure)
|
||||
: this(pressureMeter, ref pressure, Event.PressureDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (pressure != null) pressure.Val = pressureMeter.ReadPressure();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.PressureInDone or Event.PressureOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (pressure != null) pressure.Val = pressureMeter.ReadPressure();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
@ -43,6 +43,7 @@ namespace TBF.Rig.Sequences
|
||||
public static Unit TempUnit { get { return BenchInfo != null ? BenchInfo.TempUnit : Unit.C; } }
|
||||
public static Unit PressUnit { get { return BenchInfo != null ? BenchInfo.PressUnit : Unit.bar; } }
|
||||
public static Unit LengthUnit { get { return BenchInfo != null ? BenchInfo.LengthUnit : Unit.mm; } }
|
||||
public static Unit ElectricUnit { get { return BenchInfo != null ? BenchInfo.ElectricUnit : Unit.A; } }
|
||||
|
||||
///
|
||||
/// Procedure related state variables
|
||||
@ -275,6 +276,9 @@ namespace TBF.Rig.Sequences
|
||||
public static DoubleBox PressUp = new DoubleBox() { Name = "Pressure Up", Format = "F2" }; /// [bar]
|
||||
public static DoubleBox PressDown = new DoubleBox() { Name = "Pressure Dn", Format = "F2" }; /// [bar]
|
||||
public static DoubleBox PressDelta = new DoubleBox() { Name = "Pressure Delta", Format = "F2" }; /// [bar]
|
||||
public static DoubleBox ElectricUp = new DoubleBox() { Name = "Electric Up", Format = "F2" }; /// [A]
|
||||
public static DoubleBox ElectricDown = new DoubleBox() { Name = "Electric Dn", Format = "F2" }; /// [A]
|
||||
public static DoubleBox ElectricDelta = new DoubleBox() { Name = "Electric Delta", Format = "F2" }; /// [A]
|
||||
public static FloatBox Conductivity = new FloatBox(750) { Name = "Conductivity", Format = "F0" }; /// [uS/cm], default is 750
|
||||
|
||||
public static int RefPulses { get { return StateMachine.ControlBoard.RefPulses; } }
|
||||
|
||||
@ -62,7 +62,7 @@ namespace TBF.Rig
|
||||
new Modbus.Common.Factory(), /// Modbus
|
||||
new Modbus.Ambient.Comet.Factory(), /// Comet Ambient temp./pressure/humidity measurement via a modbus on a PC
|
||||
new Modbus.PressureMeter.Meret.Factory(), /// Meret pressure meter connected via a modbus on a PC
|
||||
new Modbus.PressureMeter.AdjustableScale.Factory(), /// Adjustable pressure meter connected via a modbus on a PC
|
||||
new Modbus.Meret.AdjustableScale.Factory(), /// Adjustable meter connected via a modbus on a PC
|
||||
new Modbus.PumpFM.DanfossVLT.Factory(), /// Pump controlled by Danfoss VLT connected via Modbus
|
||||
new Modbus.QuidoRS.Factory(), /// Modbus.QuidoRS
|
||||
new Modbus.TankSelector.Factory(), /// Modbus.TankSelector
|
||||
|
||||
@ -36,6 +36,9 @@ namespace TBF.Rig.TestMethods.Dummy
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
if (benchPath.ElectricMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref ElectricUp));
|
||||
if (benchPath.ElectricMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref ElectricDown));
|
||||
if (benchPath.ElectricMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref ElectricDelta));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
|
||||
@ -588,6 +588,7 @@
|
||||
<Compile Include="Rig\Dummy\TempControl\Factory.cs" />
|
||||
<Compile Include="Rig\Dummy\Valve\Component.cs" />
|
||||
<Compile Include="Rig\Dummy\Valve\Factory.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IAdjustableMeter.cs" />
|
||||
<Compile Include="Rig\GenericDevices\ICalibInfoCfg.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IEvaporation.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IEventTrigger.cs" />
|
||||
@ -678,11 +679,11 @@
|
||||
<Compile Include="Rig\Modbus\Common\Modbus.cs" />
|
||||
<Compile Include="Rig\Modbus\Common\ModbusCfg.cs" />
|
||||
<Compile Include="Rig\Modbus\Common\Factory.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\AdjustableScale\Factory.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\AdjustableScale\PressureMeter.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\AdjustableScale\PressureMeterCfg.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\AdjustableScale\ReadPressureOp.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\AdjustableScale\WaitUntilPressureIsOp.cs" />
|
||||
<Compile Include="Rig\Modbus\Meret\AdjustableScale\Factory.cs" />
|
||||
<Compile Include="Rig\Modbus\Meret\AdjustableScale\AdjustableMeter.cs" />
|
||||
<Compile Include="Rig\Modbus\Meret\AdjustableScale\AdjustableMeterCfg.cs" />
|
||||
<Compile Include="Rig\Modbus\Meret\AdjustableScale\ReadValueOp.cs" />
|
||||
<Compile Include="Rig\Modbus\Meret\AdjustableScale\WaitUntilValueIsOp.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\Meret\Factory.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\Meret\PressureMeter.cs" />
|
||||
<Compile Include="Rig\Modbus\PressureMeter\Meret\PressureMeterCfg.cs" />
|
||||
@ -2011,6 +2012,12 @@
|
||||
<Compile Include="UI\Bench\Metrology\MetrologyDlg.designer.cs">
|
||||
<DependentUpon>MetrologyDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Bench\Metrology\MetrologyDlgAdjustableScaleTab.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Bench\Metrology\MetrologyDlgAdjustableScaleTab.designer.cs">
|
||||
<DependentUpon>MetrologyDlgAdjustableScaleTab.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Bench\Metrology\MetrologyDlgScaleTab.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@ -3081,6 +3088,9 @@
|
||||
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlg.resx">
|
||||
<DependentUpon>MetrologyDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgAdjustableScaleTab.resx">
|
||||
<DependentUpon>MetrologyDlgAdjustableScaleTab.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgScaleTab.resx">
|
||||
<DependentUpon>MetrologyDlgScaleTab.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -3499,7 +3509,9 @@
|
||||
<Name>Results</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Rig\Modbus\Meret\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -758,6 +758,12 @@ namespace TBF.UI.Bench.Components
|
||||
(cfg as Rig.Modbus.PressureMeter.Meret.PressureMeterCfg).ModbusAddress = (byte)(zeroBasedIdx + 1);
|
||||
return true;
|
||||
}
|
||||
else if (cfg is Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg)
|
||||
{
|
||||
(cfg as IChildComponentCfg).ParentName = "CB";
|
||||
(cfg as Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg).ModbusAddress = (byte)(zeroBasedIdx + 1);
|
||||
return true;
|
||||
}
|
||||
else if (cfg is Rig.RegisterReaders.PulsesFromUniCB.RRCfg)
|
||||
{
|
||||
(cfg as IChildComponentCfg).ParentName = "UniCB";
|
||||
|
||||
@ -511,7 +511,7 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
break;
|
||||
case Element.Label:
|
||||
if (item is IDrawingItemWithMeasuredVal &&
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient))
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient /*|| item.Shape == Shape.ElectricM*/))
|
||||
{
|
||||
/// Move measured value together with the label, keep label nearby the (nonexisting) body
|
||||
if (!large && item.LblX > 0)
|
||||
@ -563,7 +563,7 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
break;
|
||||
case Element.Label:
|
||||
if (item is IDrawingItemWithMeasuredVal &&
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient))
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient /*|| item.Shape == Shape.ElectricM*/))
|
||||
{
|
||||
/// Move measured value together with the label, keep label nearby the (nonexisting) body
|
||||
if (!large && item.LblX < SchematicDrawing.Const.GridSize - 1)
|
||||
@ -616,7 +616,7 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
break;
|
||||
case Element.Label:
|
||||
if (item is IDrawingItemWithMeasuredVal &&
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient))
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient /*|| item.Shape == Shape.ElectricM*/))
|
||||
{
|
||||
/// Move measured value together with the label, keep label nearby the (nonexisting) body
|
||||
if (!large && item.LblY > 0)
|
||||
@ -668,7 +668,7 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
break;
|
||||
case Element.Label:
|
||||
if (item is IDrawingItemWithMeasuredVal &&
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient))
|
||||
(item.Shape == Shape.TempM || item.Shape == Shape.PressM || item.Shape == Shape.Ambient /*|| item.Shape == Shape.ElectricM*/))
|
||||
{
|
||||
/// Move measured value together with the label, keep label nearby the (nonexisting) body
|
||||
if (!large && item.LblY < SchematicDrawing.Const.GridSize - 1)
|
||||
|
||||
@ -155,6 +155,20 @@ namespace TBF.UI.Bench.Metrology
|
||||
tabPage.Controls.Add(uiControl);
|
||||
metrologyTabControl.TabPages.Add(tabPage);
|
||||
}
|
||||
|
||||
/// Tab-pages for Adjustable scale
|
||||
if (factory is Rig.Modbus.Meret.AdjustableScale.Factory)
|
||||
{
|
||||
pressMetersCount++;
|
||||
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
|
||||
MetrologyDlgAdjustableScaleTab uiControl = new MetrologyDlgAdjustableScaleTab();
|
||||
uiControl.MeterEntity = cmpnt;
|
||||
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as Rig.GenericDevices.ICalibInfoCfg;
|
||||
uiControl.Dock = DockStyle.Fill;
|
||||
tabPage.Tag = uiControl;
|
||||
tabPage.Controls.Add(uiControl);
|
||||
metrologyTabControl.TabPages.Add(tabPage);
|
||||
}
|
||||
|
||||
/// Tab-pages for temperature meters
|
||||
if (factory is Rig.Modbus.TempMeter.Groch.Factory ||
|
||||
|
||||
417
TBF/UI/Bench/Metrology/MetrologyDlgAdjustableScaleTab.cs
Normal file
417
TBF/UI/Bench/Metrology/MetrologyDlgAdjustableScaleTab.cs
Normal file
@ -0,0 +1,417 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Shared;
|
||||
|
||||
namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
public partial class MetrologyDlgAdjustableScaleTab : UserControl, IMetrologyDlgTab
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgAdjustableScaleTab));
|
||||
|
||||
public const int SignifDigits = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Component entity that has a list of 'measurement-correction' pairs
|
||||
/// to be updated in the database on OK.
|
||||
/// </summary>
|
||||
Component meterEntity;
|
||||
public Component MeterEntity
|
||||
{
|
||||
get { return meterEntity; }
|
||||
set { meterEntity = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Balance configuration (with buoyancy parameters)
|
||||
/// </summary>
|
||||
public Rig.GenericDevices.ICalibInfoCfg CalibInfoCfg;
|
||||
|
||||
/// <summary>
|
||||
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||
/// </summary>
|
||||
public IList<MeasurementCorrection> ToBeRemoved
|
||||
{
|
||||
get { return toBeRemoved; }
|
||||
set { toBeRemoved = value; }
|
||||
}
|
||||
IList<MeasurementCorrection> toBeRemoved;
|
||||
|
||||
MetrologyDlg parent;
|
||||
bool unlocked;
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
|
||||
Unit currentUnit;
|
||||
|
||||
public MetrologyDlgAdjustableScaleTab()
|
||||
{
|
||||
InitializeComponent();
|
||||
toBeRemoved = new List<MeasurementCorrection>();
|
||||
unlocked = false;
|
||||
}
|
||||
|
||||
private void MetrologyDlgPressMeterTab_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
if (meterEntity == null) return;
|
||||
|
||||
parent = ParentForm as MetrologyDlg;
|
||||
|
||||
Localize();
|
||||
|
||||
/// Panel1
|
||||
cmpntNameLabel.Text = meterEntity.Name;
|
||||
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
if (Units.IsCurrent(u) || Units.IsVoltage(u) || Units.IsPressure(u))
|
||||
unitComboBox.Items.Add(u.ToDescription());
|
||||
|
||||
/// Panel2
|
||||
this.Controls.Add(measurementTextBox = new TextBox());
|
||||
this.Controls.Add(correctionTextBox = new TextBox());
|
||||
this.Controls.Add(errorTextBox = new TextBox());
|
||||
|
||||
currentUnit = TBF.Rig.Sequences.ProcessData.ElectricUnit;
|
||||
unitComboBox.Text = currentUnit.ToDescription();
|
||||
InitializeColumns(listViewEx, currentUnit);
|
||||
RefreshAll();
|
||||
|
||||
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged);
|
||||
}
|
||||
|
||||
void InitializeColumns(ListView lv, Unit unit)
|
||||
{
|
||||
lv.Columns.Clear();
|
||||
lv.Columns.Add(new ColumnHeader() { Text = Strings.Nr, Width = 60 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Current, unit.ToDescription()), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [{1}]", Strings.Correction, unit.ToDescription()), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader() { Text = string.Format("{0} [%]", Strings.Error), Width = 100 });
|
||||
|
||||
measuredLabel.Text = string.Format("{0} [{1}]:", Strings.Measured, unit.ToDescription());
|
||||
correctedLabel.Text = string.Format("{0} [{1}]:", Strings.Corrected, unit.ToDescription());
|
||||
measuredTextBox.Text = string.Empty;
|
||||
correctedTextBox.Text = string.Empty;
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
componentLabel.Text = Strings.Component;
|
||||
testGroupBox.Text = Strings.Test_measured_corrected;
|
||||
}
|
||||
|
||||
void RefreshAll()
|
||||
{
|
||||
if (CalibInfoCfg != null) calibCertificateCtrl.Refresh(CalibInfoCfg);
|
||||
|
||||
listViewEx.Items.Clear();
|
||||
foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr);
|
||||
}
|
||||
|
||||
void AddOneLVI(MeasurementCorrection corr)
|
||||
{
|
||||
int nr = listViewEx.Items.Count + 1;
|
||||
ListViewItem lvi = new ListViewItem(nr.ToString());
|
||||
lvi.Tag = corr;
|
||||
lvi.SubItems.Add(Units.ConvertTo(currentUnit, corr.Measurement).ToString());
|
||||
double trueValue = corr.Measurement + corr.Correction;
|
||||
double difference = Units.IsDefaultUnit(currentUnit)
|
||||
? corr.Correction
|
||||
: Units.ConvertTo(currentUnit, trueValue) - Units.ConvertTo(currentUnit, corr.Measurement);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(difference, SignifDigits));
|
||||
|
||||
if (corr.Measurement == 0)
|
||||
{
|
||||
lvi.SubItems.Add(Strings.NaN);
|
||||
}
|
||||
else
|
||||
{
|
||||
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
|
||||
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
|
||||
}
|
||||
|
||||
listViewEx.Items.Add(lvi);
|
||||
}
|
||||
|
||||
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (unlocked && e.SubItem == 1)
|
||||
{
|
||||
listViewEx.StartEditing(measurementTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 2)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (unlocked && e.SubItem == 3)
|
||||
{
|
||||
listViewEx.StartEditing(correctionTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
}
|
||||
|
||||
void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (ParseItem(e.Item, e.SubItem, e.DisplayText)) return;
|
||||
|
||||
/// New value is NOK, revert the original text
|
||||
e.DisplayText = e.Item.Text;
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse text of a ListViewItem
|
||||
/// </summary>
|
||||
/// <returns>true = value parsed OK</returns>
|
||||
bool ParseItem(ListViewItem item, int subItem, string strValue)
|
||||
{
|
||||
double oriMeasurement; /// Measurement in selected units
|
||||
double measurement; /// Measurement in default units
|
||||
double difference; /// Correction in selected unit
|
||||
double correction; /// Correction in default unit
|
||||
double error = 0;
|
||||
|
||||
if (subItem == 1 && Utils.TryParseEDouble(strValue, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) >= 0)
|
||||
{
|
||||
(item.Tag as MeasurementCorrection).Measurement = measurement;
|
||||
|
||||
/// Update error (if possible)
|
||||
if (Utils.TryParseEDouble(item.SubItems[2].Text, out difference) && (measurement != 0))
|
||||
{
|
||||
correction = Units.IsDefaultUnit(currentUnit) ? difference
|
||||
: Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement);
|
||||
error = Formulas.ErrorFromVolumes(measurement, measurement + correction);
|
||||
item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SubItems[3].Text = Strings.NaN;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (subItem == 2 && Utils.TryParseEDouble(strValue, out difference))
|
||||
{
|
||||
if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement))
|
||||
{
|
||||
measurement = Units.ConvertFrom(currentUnit, oriMeasurement);
|
||||
correction = Units.IsDefaultUnit(currentUnit) ? difference
|
||||
: Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement);
|
||||
(item.Tag as MeasurementCorrection).Correction = correction;
|
||||
|
||||
/// Update error (if possible)
|
||||
if (measurement != 0)
|
||||
{
|
||||
error = Formulas.ErrorFromVolumes(measurement, measurement + correction);
|
||||
item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SubItems[3].Text = Strings.NaN;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (subItem == 3 && ((strValue == Strings.NaN) || Utils.TryParseEDouble(strValue, out error)))
|
||||
{
|
||||
if (strValue == Strings.NaN)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0)
|
||||
{
|
||||
correction = Formulas.CorrectionFromError(measurement, error);
|
||||
(item.Tag as MeasurementCorrection).Correction = correction;
|
||||
difference = Units.IsDefaultUnit(currentUnit)
|
||||
? correction
|
||||
: Units.ConvertTo(currentUnit, measurement + correction) - oriMeasurement;
|
||||
item.SubItems[2].Text = Common.Utils.ToNiceString(difference, SignifDigits);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
unlocked = true;
|
||||
|
||||
calibCertificateCtrl.Unlock();
|
||||
|
||||
if (listViewEx.SelectedItems.Count == 1)
|
||||
{
|
||||
int ix = listViewEx.SelectedIndices[0];
|
||||
listViewEx.Focus();
|
||||
listViewEx.Items[ix].Selected = true;
|
||||
listViewEx.Items[ix].EnsureVisible();
|
||||
}
|
||||
}
|
||||
|
||||
public void OkBtnClicked()
|
||||
{
|
||||
if (CalibInfoCfg != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
calibCertificateCtrl.Update(CalibInfoCfg);
|
||||
Component modified = CalibInfoCfg.CreateDbEntity();
|
||||
MeterEntity.Parameters = modified.Parameters;
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show(Strings.Invalid_calib_info_Correct_pls,
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelBtnClicked()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
MeasurementCorrection corr = new MeasurementCorrection();
|
||||
MeterEntity.Corrections.Add(corr);
|
||||
AddOneLVI(corr);
|
||||
|
||||
listViewEx.Focus();
|
||||
listViewEx.SelectedItems.Clear();
|
||||
listViewEx.Items[listViewEx.Items.Count - 1].Selected = true;
|
||||
listViewEx.Items[listViewEx.Items.Count - 1].EnsureVisible();
|
||||
}
|
||||
|
||||
public void RemoveSelected()
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count != 1) return;
|
||||
|
||||
int removeItemNr = listViewEx.SelectedIndices[0];
|
||||
|
||||
MeasurementCorrection selected =
|
||||
(MeasurementCorrection)listViewEx.SelectedItems[0].Tag;
|
||||
if (selected.Id != 0) toBeRemoved.Add(selected);
|
||||
MeterEntity.Corrections.RemoveAt(removeItemNr);
|
||||
RefreshAll();
|
||||
|
||||
if (removeItemNr < listViewEx.Items.Count)
|
||||
{
|
||||
listViewEx.Focus();
|
||||
listViewEx.Items[removeItemNr].Selected = true;
|
||||
listViewEx.Items[removeItemNr].EnsureVisible();
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveUpSelected()
|
||||
{
|
||||
}
|
||||
|
||||
public void MoveDownSelected()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler that indicates the selected item position
|
||||
/// and updates 'Remove', 'Up' and 'Down' buttons in the parent dialog.
|
||||
/// </summary>
|
||||
private void listViewEx_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewEx.SelectedItems.Count != 1)
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
else if (listViewEx.Items.Count == 1)
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.FirstAndLast);
|
||||
}
|
||||
else if (listViewEx.SelectedIndices[0] == 0)
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.First);
|
||||
}
|
||||
else if (listViewEx.SelectedIndices[0] == (listViewEx.Items.Count - 1))
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Last);
|
||||
}
|
||||
else
|
||||
{
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
|
||||
}
|
||||
}
|
||||
|
||||
private void measuredTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
double measured;
|
||||
if (double.TryParse(measuredTextBox.Text,
|
||||
NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent,
|
||||
CultureInfo.CurrentCulture,
|
||||
out measured) ||
|
||||
double.TryParse(measuredTextBox.Text,
|
||||
NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowExponent,
|
||||
CultureInfo.InvariantCulture,
|
||||
out measured))
|
||||
{
|
||||
var corrections = new List<MeasurementCorrection>();
|
||||
foreach (var c in meterEntity.Corrections) corrections.Add(c);
|
||||
corrections.Sort();
|
||||
double corrected = MeasurementCorrection.CorrectedValue(Units.ConvertFrom(currentUnit, measured), corrections);
|
||||
correctedTextBox.Text = Units.ConvertTo(currentUnit, corrected).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
|
||||
private void unitComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (u.ToDescription() == unitComboBox.Text)
|
||||
{
|
||||
currentUnit = u;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InitializeColumns(listViewEx, currentUnit);
|
||||
RefreshAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
231
TBF/UI/Bench/Metrology/MetrologyDlgAdjustableScaleTab.designer.cs
generated
Normal file
231
TBF/UI/Bench/Metrology/MetrologyDlgAdjustableScaleTab.designer.cs
generated
Normal file
@ -0,0 +1,231 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
partial class MetrologyDlgAdjustableScaleTab
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl();
|
||||
this.unitLabel = new System.Windows.Forms.Label();
|
||||
this.unitComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.testGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.correctedTextBox = new System.Windows.Forms.TextBox();
|
||||
this.measuredTextBox = new System.Windows.Forms.TextBox();
|
||||
this.correctedLabel = new System.Windows.Forms.Label();
|
||||
this.measuredLabel = new System.Windows.Forms.Label();
|
||||
this.componentLabel = new System.Windows.Forms.Label();
|
||||
this.cmpntNameLabel = new System.Windows.Forms.Label();
|
||||
this.listViewEx = new Common.Forms.ListViewEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.testGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.unitLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.unitComboBox);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.componentLabel);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(975, 462);
|
||||
this.splitContainer1.SplitterDistance = 112;
|
||||
this.splitContainer1.SplitterWidth = 6;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// calibCertificateCtrl
|
||||
//
|
||||
this.calibCertificateCtrl.Location = new System.Drawing.Point(294, 14);
|
||||
this.calibCertificateCtrl.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8);
|
||||
this.calibCertificateCtrl.Name = "calibCertificateCtrl";
|
||||
this.calibCertificateCtrl.Size = new System.Drawing.Size(360, 154);
|
||||
this.calibCertificateCtrl.TabIndex = 11;
|
||||
//
|
||||
// unitLabel
|
||||
//
|
||||
this.unitLabel.AutoSize = true;
|
||||
this.unitLabel.Location = new System.Drawing.Point(21, 86);
|
||||
this.unitLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.unitLabel.Name = "unitLabel";
|
||||
this.unitLabel.Size = new System.Drawing.Size(101, 20);
|
||||
this.unitLabel.TabIndex = 10;
|
||||
this.unitLabel.Text = "Unit of scale:";
|
||||
//
|
||||
// unitComboBox
|
||||
//
|
||||
this.unitComboBox.FormattingEnabled = true;
|
||||
this.unitComboBox.Location = new System.Drawing.Point(184, 82);
|
||||
this.unitComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.unitComboBox.Name = "unitComboBox";
|
||||
this.unitComboBox.Size = new System.Drawing.Size(91, 28);
|
||||
this.unitComboBox.TabIndex = 9;
|
||||
this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// testGroupBox
|
||||
//
|
||||
this.testGroupBox.Controls.Add(this.correctedTextBox);
|
||||
this.testGroupBox.Controls.Add(this.measuredTextBox);
|
||||
this.testGroupBox.Controls.Add(this.correctedLabel);
|
||||
this.testGroupBox.Controls.Add(this.measuredLabel);
|
||||
this.testGroupBox.Location = new System.Drawing.Point(663, 14);
|
||||
this.testGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.testGroupBox.Name = "testGroupBox";
|
||||
this.testGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.testGroupBox.Size = new System.Drawing.Size(300, 154);
|
||||
this.testGroupBox.TabIndex = 4;
|
||||
this.testGroupBox.TabStop = false;
|
||||
this.testGroupBox.Text = "Test";
|
||||
//
|
||||
// correctedTextBox
|
||||
//
|
||||
this.correctedTextBox.Location = new System.Drawing.Point(172, 75);
|
||||
this.correctedTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.correctedTextBox.Name = "correctedTextBox";
|
||||
this.correctedTextBox.ReadOnly = true;
|
||||
this.correctedTextBox.Size = new System.Drawing.Size(108, 26);
|
||||
this.correctedTextBox.TabIndex = 5;
|
||||
//
|
||||
// measuredTextBox
|
||||
//
|
||||
this.measuredTextBox.Location = new System.Drawing.Point(172, 37);
|
||||
this.measuredTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.measuredTextBox.Name = "measuredTextBox";
|
||||
this.measuredTextBox.Size = new System.Drawing.Size(108, 26);
|
||||
this.measuredTextBox.TabIndex = 4;
|
||||
this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
|
||||
//
|
||||
// correctedLabel
|
||||
//
|
||||
this.correctedLabel.AutoSize = true;
|
||||
this.correctedLabel.Location = new System.Drawing.Point(10, 80);
|
||||
this.correctedLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.correctedLabel.Name = "correctedLabel";
|
||||
this.correctedLabel.Size = new System.Drawing.Size(79, 20);
|
||||
this.correctedLabel.TabIndex = 3;
|
||||
this.correctedLabel.Text = "Corrected";
|
||||
//
|
||||
// measuredLabel
|
||||
//
|
||||
this.measuredLabel.AutoSize = true;
|
||||
this.measuredLabel.Location = new System.Drawing.Point(10, 42);
|
||||
this.measuredLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.measuredLabel.Name = "measuredLabel";
|
||||
this.measuredLabel.Size = new System.Drawing.Size(80, 20);
|
||||
this.measuredLabel.TabIndex = 2;
|
||||
this.measuredLabel.Text = "Measured";
|
||||
//
|
||||
// componentLabel
|
||||
//
|
||||
this.componentLabel.AutoSize = true;
|
||||
this.componentLabel.Location = new System.Drawing.Point(21, 26);
|
||||
this.componentLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.componentLabel.Name = "componentLabel";
|
||||
this.componentLabel.Size = new System.Drawing.Size(96, 20);
|
||||
this.componentLabel.TabIndex = 1;
|
||||
this.componentLabel.Text = "Component:";
|
||||
//
|
||||
// cmpntNameLabel
|
||||
//
|
||||
this.cmpntNameLabel.AutoSize = true;
|
||||
this.cmpntNameLabel.Location = new System.Drawing.Point(146, 26);
|
||||
this.cmpntNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.cmpntNameLabel.Name = "cmpntNameLabel";
|
||||
this.cmpntNameLabel.Size = new System.Drawing.Size(131, 20);
|
||||
this.cmpntNameLabel.TabIndex = 0;
|
||||
this.cmpntNameLabel.Text = "componentName";
|
||||
//
|
||||
// listViewEx
|
||||
//
|
||||
this.listViewEx.AllowColumnReorder = true;
|
||||
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listViewEx.DoubleClickActivation = false;
|
||||
this.listViewEx.FullRowSelect = true;
|
||||
this.listViewEx.GridLines = true;
|
||||
this.listViewEx.HideSelection = false;
|
||||
this.listViewEx.Location = new System.Drawing.Point(0, 0);
|
||||
this.listViewEx.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.listViewEx.Name = "listViewEx";
|
||||
this.listViewEx.Size = new System.Drawing.Size(975, 344);
|
||||
this.listViewEx.TabIndex = 0;
|
||||
this.listViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
|
||||
//
|
||||
// MetrologyDlgAdjustableScaleTab
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "MetrologyDlgAdjustableScaleTab";
|
||||
this.Size = new System.Drawing.Size(975, 462);
|
||||
this.Load += new System.EventHandler(this.MetrologyDlgPressMeterTab_Load);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.testGroupBox.ResumeLayout(false);
|
||||
this.testGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Label componentLabel;
|
||||
private System.Windows.Forms.Label cmpntNameLabel;
|
||||
private Common.Forms.ListViewEx listViewEx;
|
||||
private System.Windows.Forms.GroupBox testGroupBox;
|
||||
private System.Windows.Forms.TextBox correctedTextBox;
|
||||
private System.Windows.Forms.TextBox measuredTextBox;
|
||||
private System.Windows.Forms.Label correctedLabel;
|
||||
private System.Windows.Forms.Label measuredLabel;
|
||||
private System.Windows.Forms.Label unitLabel;
|
||||
private System.Windows.Forms.ComboBox unitComboBox;
|
||||
private CalibCertificateCtrl calibCertificateCtrl;
|
||||
}
|
||||
}
|
||||
120
TBF/UI/Bench/Metrology/MetrologyDlgAdjustableScaleTab.resx
Normal file
120
TBF/UI/Bench/Metrology/MetrologyDlgAdjustableScaleTab.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@ -34,6 +34,9 @@ namespace TBF.UI.Bench.Paths
|
||||
Pup,
|
||||
Pdown,
|
||||
Pdelta,
|
||||
Eup,
|
||||
Edown,
|
||||
Edelta,
|
||||
StopBFValve,
|
||||
FixedColumnsCount,
|
||||
}
|
||||
@ -117,6 +120,12 @@ namespace TBF.UI.Bench.Paths
|
||||
prDownCBox.Items.Add(cmpnt.Cfg.Name);
|
||||
prDeltaCBox.Items.Add(cmpnt.Cfg.Name);
|
||||
}
|
||||
if (cmpnt is Rig.GenericDevices.IAdjustableMeter)
|
||||
{
|
||||
prUpCBox.Items.Add(cmpnt.Cfg.Name);
|
||||
prDownCBox.Items.Add(cmpnt.Cfg.Name);
|
||||
prDeltaCBox.Items.Add(cmpnt.Cfg.Name);
|
||||
}
|
||||
if (cmpnt is IValve && (cmpnt as IValve).CoupledTo == null)
|
||||
{
|
||||
stopBFValveComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||
@ -135,6 +144,9 @@ namespace TBF.UI.Bench.Paths
|
||||
editors[(int)Column.Pup] = prUpCBox;
|
||||
editors[(int)Column.Pdown] = prDownCBox;
|
||||
editors[(int)Column.Pdelta] = prDownCBox;
|
||||
editors[(int)Column.Eup] = prUpCBox;
|
||||
editors[(int)Column.Edown] = prDownCBox;
|
||||
editors[(int)Column.Edelta] = prDownCBox;
|
||||
editors[(int)Column.StopBFValve] = stopBFValveComboBox;
|
||||
/// Prepare valve combo-boxes (max. 64 valves)
|
||||
for (int i = 0; i < 64; i++)
|
||||
@ -326,6 +338,9 @@ namespace TBF.UI.Bench.Paths
|
||||
entity.PressMtrUp = lvi.SubItems[(int)Column.Pup].Text;
|
||||
entity.PressMtrDown = lvi.SubItems[(int)Column.Pdown].Text;
|
||||
entity.PressMtrDelta = lvi.SubItems[(int)Column.Pdelta].Text;
|
||||
entity.ElectricMtrUp = lvi.SubItems[(int)Column.Pup].Text;
|
||||
entity.ElectricMtrDown = lvi.SubItems[(int)Column.Pdown].Text;
|
||||
entity.ElectricMtrDelta = lvi.SubItems[(int)Column.Pdelta].Text;
|
||||
entity.StopBFValve = lvi.SubItems[(int)Column.StopBFValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StopBFValve].Text;
|
||||
|
||||
string valvesOpen = string.Empty;
|
||||
|
||||
@ -155,7 +155,7 @@ namespace TBF.UI.Graphs
|
||||
|
||||
if (ProcessData.BatchRslts != null && batchNrStr == ProcessData.BatchRslts.Batch.BatchNr.ToString())
|
||||
{
|
||||
node.Text = string.Format("{0} ({1})", batchNrStr, Strings.current);
|
||||
node.Text = string.Format("{0} ({1})", batchNrStr, Strings.current_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,6 +457,7 @@ namespace TBF.UI.Procedures
|
||||
test.TempUnit = ProcessData.TempUnit;
|
||||
test.PressUnit = ProcessData.PressUnit;
|
||||
test.LengthUnit = ProcessData.LengthUnit;
|
||||
test.ElectricUnit = ProcessData.ElectricUnit;
|
||||
test.ResetChngdFlags();
|
||||
}
|
||||
|
||||
@ -2663,6 +2664,7 @@ namespace TBF.UI.Procedures
|
||||
test.TempUnit = (benchInfo != null) ? benchInfo.TempUnit : Unit.C;
|
||||
test.PressUnit = (benchInfo != null) ? benchInfo.PressUnit : Unit.bar;
|
||||
test.LengthUnit = (benchInfo != null) ? benchInfo.LengthUnit : Unit.mm;
|
||||
test.ElectricUnit = (benchInfo != null) ? benchInfo.ElectricUnit : Unit.A;
|
||||
|
||||
TestWizard.RoiData roiData = new TestWizard.RoiData();
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@ using TBF.Rig.Sequences;
|
||||
using TBF.Rig.Various.Drawing.Junction;
|
||||
using TBF.UiBridge;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.Rig.Modbus.Meret.AdjustableScale;
|
||||
using Factory = TBF.Rig.Various.Drawing.Junction.Factory;
|
||||
|
||||
namespace TBF.UI.Process
|
||||
{
|
||||
@ -370,11 +372,13 @@ namespace TBF.UI.Process
|
||||
Rig.Modbus.PumpFM.DanfossVLT.PumpCfg pumpCfg; /// | setpoint, route based (initially bit nr. = 124)
|
||||
Rig.Modbus.TempMeter.Groch.TempMeterCfg tempInCfg; /// | measured value
|
||||
Rig.Modbus.PressureMeter.Meret.PressureMeterCfg pressUpCfg; /// | measured value
|
||||
Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg electricUpCfg; /// | measured value
|
||||
Rig.WaterMeters.WaterMeter.WaterMeterCfg wm1Cfg; /// |
|
||||
Rig.WaterMeters.WaterMeter.WaterMeterCfg wm2Cfg; /// |
|
||||
Rig.WaterMeters.WaterMeter.WaterMeterCfg wmLastCfg; /// |
|
||||
Rig.Modbus.TempMeter.Groch.TempMeterCfg tempOutCfg; /// | measured value
|
||||
Rig.Modbus.PressureMeter.Meret.PressureMeterCfg pressDnCfg; /// | measured value
|
||||
Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg electricDownCfg; /// | measured value
|
||||
Rig.BuiltIn.Valve.ValveCfg startValveCfg; /// | route based (initially bit nr. = 125)
|
||||
Rig.Uni.FlowMeter.FlowMeterCfg flowMeterCfg; /// | measured value
|
||||
Rig.Uni.RegValve.RegValveCfg regValveCfg; /// | setpoint
|
||||
@ -384,11 +388,12 @@ namespace TBF.UI.Process
|
||||
Rig.BuiltIn.Valve.ValveCfg drainValveCfg; /// v route based (initially bit nr. = 127)
|
||||
///
|
||||
int scaleId, tankId, drainValveId, diverterId, regValveId, flowMeterId, startValveId;
|
||||
int pumpId, tempInId, tempOutId, tempDivId, pressUpId, pressDownId;
|
||||
int pumpId, tempInId, tempOutId, tempDivId, pressUpId, pressDownId, electricUpId, electricDownId;
|
||||
int wm1Id, wm2Id, wmLastId, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11;
|
||||
///
|
||||
int scaleMsrdIx, flowMeterMsrdIx, tempMtrUpMsrdIx, tempMtrDownMsrdIx, tempMtrDivMsrdIx;
|
||||
int pressMtrUpMsrdIx, pressMtrDownMsrdIx;
|
||||
int electricMtrUpMsrdIx, electricMtrDownMsrdIx;
|
||||
///
|
||||
int regValveSetpIx, pumpSetpIx;
|
||||
///
|
||||
@ -461,6 +466,18 @@ namespace TBF.UI.Process
|
||||
MsrdValLimLo = -0.1, MsrdValLimHi = 25,
|
||||
});
|
||||
|
||||
/// Electric up
|
||||
electricMtrUpMsrdIx = msrdIx++;
|
||||
processDrawingCtrl.AddItem(
|
||||
electricUpCfg = new Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg(new Rig.Modbus.Meret.AdjustableScale.Factory())
|
||||
{
|
||||
Id = electricUpId = id++, Name = "El up",
|
||||
X = 50, Y = 270, Shape = Shape.ElectricM, Sz = Sz.M, Orient = Orient.R, Flip = false,
|
||||
LblX = 0, LblY = 0, LblOrient = Orient.R,
|
||||
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F2} A", MsrdUnit = Unit.A,
|
||||
MsrdValLimLo = -0.1, MsrdValLimHi = 25,
|
||||
});
|
||||
|
||||
if (mtrKind == MetersKind.Combined)
|
||||
{
|
||||
/// WM 1 main
|
||||
@ -540,6 +557,18 @@ namespace TBF.UI.Process
|
||||
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F2} bar", MsrdUnit = Common.Unit.bar,
|
||||
MsrdValLimLo = -0.1, MsrdValLimHi = 25,
|
||||
});
|
||||
|
||||
/// El down
|
||||
electricMtrDownMsrdIx = msrdIx++;
|
||||
processDrawingCtrl.AddItem(
|
||||
electricDownCfg = new AdjustableMeterCfg(new Rig.Modbus.Meret.AdjustableScale.Factory())
|
||||
{
|
||||
Id = electricDownId = id++, Name = "El dn",
|
||||
X = 370, Y = 270, Shape = Shape.PressM, Sz = Sz.M, Orient = Orient.R, Flip = false,
|
||||
LblX = 0, LblY = 0, LblOrient = Orient.R,
|
||||
MsrdX = 0, MsrdY = 22, MsrdOrient = Orient.R, MsrdFormat = "{0:F2} A", MsrdUnit = Common.Unit.A,
|
||||
MsrdValLimLo = -0.1, MsrdValLimHi = 25,
|
||||
});
|
||||
|
||||
/// Junction
|
||||
processDrawingCtrl.AddItem(new Configuration("J7", new Factory()) { Id=(j7=id++), Shape=Shape.Junction, X=460, Y=370, Sz=Sz.L, });
|
||||
@ -735,7 +764,14 @@ namespace TBF.UI.Process
|
||||
pressUpCfg.MsrdUnit = (args.BenchPath != null && args.BenchPath.PressMtrUp != null) ? args.BenchPath.PressMtrUp.MsrdUnit : Unit.bar;
|
||||
pressUpCfg.MsrdValLimLo = (args.BenchPath != null && args.BenchPath.PressMtrUp != null) ? args.BenchPath.PressMtrUp.MsrdValLimLo : 0;
|
||||
pressUpCfg.MsrdValLimHi = (args.BenchPath != null && args.BenchPath.PressMtrUp != null) ? args.BenchPath.PressMtrUp.MsrdValLimHi : 15;
|
||||
|
||||
|
||||
//Electric
|
||||
electricUpCfg.Name = (args.BenchPath != null && args.BenchPath.ElectricMtrUp != null) ? args.BenchPath.ElectricMtrUp.Name : "n/a";
|
||||
electricUpCfg.MsrdFormat = (args.BenchPath != null && args.BenchPath.ElectricMtrUp != null) ? args.BenchPath.ElectricMtrUp.MsrdFormat : "{0:F2} A";
|
||||
electricUpCfg.MsrdUnit = (args.BenchPath != null && args.BenchPath.ElectricMtrUp != null) ? args.BenchPath.ElectricMtrUp.MsrdUnit : Unit.A;
|
||||
electricUpCfg.MsrdValLimLo = (args.BenchPath != null && args.BenchPath.ElectricMtrUp != null) ? args.BenchPath.ElectricMtrUp.MsrdValLimLo : 0;
|
||||
electricUpCfg.MsrdValLimHi = (args.BenchPath != null && args.BenchPath.ElectricMtrUp != null) ? args.BenchPath.ElectricMtrUp.MsrdValLimHi : 15;
|
||||
|
||||
tempOutCfg.Name = (args.BenchPath != null && args.BenchPath.TempMtrDown != null) ? args.BenchPath.TempMtrDown.Name : "n/a";
|
||||
tempOutCfg.MsrdFormat = (args.BenchPath != null && args.BenchPath.TempMtrDown != null) ? args.BenchPath.TempMtrDown.MsrdFormat : "{0:F1} °C";
|
||||
tempOutCfg.MsrdUnit = (args.BenchPath != null && args.BenchPath.TempMtrDown != null) ? args.BenchPath.TempMtrDown.MsrdUnit : Unit.C;
|
||||
@ -747,6 +783,13 @@ namespace TBF.UI.Process
|
||||
pressDnCfg.MsrdUnit = (args.BenchPath != null && args.BenchPath.PressMtrDown != null) ? args.BenchPath.PressMtrDown.MsrdUnit : Unit.bar;
|
||||
pressDnCfg.MsrdValLimLo = (args.BenchPath != null && args.BenchPath.PressMtrDown != null) ? args.BenchPath.PressMtrDown.MsrdValLimLo : 0;
|
||||
pressDnCfg.MsrdValLimHi = (args.BenchPath != null && args.BenchPath.PressMtrDown != null) ? args.BenchPath.PressMtrDown.MsrdValLimHi : 15;
|
||||
|
||||
//Electric
|
||||
electricDownCfg.Name = (args.BenchPath != null && args.BenchPath.ElectricMtrDown != null) ? args.BenchPath.ElectricMtrDown.Name : "n/a";
|
||||
electricDownCfg.MsrdFormat = (args.BenchPath != null && args.BenchPath.ElectricMtrDown != null) ? args.BenchPath.ElectricMtrDown.MsrdFormat : "{0:F2} A";
|
||||
electricDownCfg.MsrdUnit = (args.BenchPath != null && args.BenchPath.ElectricMtrDown != null) ? args.BenchPath.ElectricMtrDown.MsrdUnit : Unit.A;
|
||||
electricDownCfg.MsrdValLimLo = (args.BenchPath != null && args.BenchPath.ElectricMtrDown != null) ? args.BenchPath.ElectricMtrDown.MsrdValLimLo : 0;
|
||||
electricDownCfg.MsrdValLimHi = (args.BenchPath != null && args.BenchPath.ElectricMtrDown != null) ? args.BenchPath.ElectricMtrDown.MsrdValLimHi : 15;
|
||||
|
||||
/// Output path
|
||||
startValveCfg.Name = (args.OutputPath != null && args.OutputPath.StartValve1 != null) ? args.OutputPath.StartValve1.Name : "n/a";
|
||||
@ -871,6 +914,8 @@ namespace TBF.UI.Process
|
||||
cmpntWithMeasuredVal[tempMtrDivMsrdIx] = args.OutputPath.TempMtrDiv as IDrawingItCmpntWithMeasuredVal;
|
||||
cmpntWithMeasuredVal[pressMtrUpMsrdIx] = args.BenchPath.PressMtrUp as IDrawingItCmpntWithMeasuredVal;
|
||||
cmpntWithMeasuredVal[pressMtrDownMsrdIx] = args.BenchPath.PressMtrDown as IDrawingItCmpntWithMeasuredVal;
|
||||
cmpntWithMeasuredVal[electricMtrUpMsrdIx] = args.BenchPath.ElectricMtrUp as IDrawingItCmpntWithMeasuredVal;
|
||||
cmpntWithMeasuredVal[electricMtrDownMsrdIx] = args.BenchPath.ElectricMtrDown as IDrawingItCmpntWithMeasuredVal;
|
||||
|
||||
cmpntWithSetpoint[regValveSetpIx] = args.OutputPath.RegValve as IDrawingItCmpntWithSetpoint;
|
||||
cmpntWithSetpoint[pumpSetpIx] = args.FeedingPath.Pump as IDrawingItCmpntWithSetpoint;
|
||||
|
||||
65
TBFTests/Entities/MeasurementCorrectionTest.cs
Normal file
65
TBFTests/Entities/MeasurementCorrectionTest.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace TBFTests.Entities
|
||||
{
|
||||
[TestClass]
|
||||
[TestSubject(typeof(MeasurementCorrection))]
|
||||
public class MeasurementCorrectionTest
|
||||
{
|
||||
|
||||
[TestMethod]
|
||||
public void GetCorrection()
|
||||
{
|
||||
double rawValue, expectedVal;
|
||||
IList<MeasurementCorrection> corrections;
|
||||
|
||||
corrections = new List<MeasurementCorrection>(2);
|
||||
MeasurementCorrection Lo, Hi;
|
||||
Lo = new MeasurementCorrection(1);
|
||||
Lo.Measurement = 0.04; //CorrectionValLo;
|
||||
Lo.Correction = 0.0F; //MsrdValLimLo;
|
||||
corrections.Add(Lo);
|
||||
Hi = new MeasurementCorrection(2);
|
||||
Hi.Measurement = 0.22F;//CorrectionValHi;
|
||||
Hi.Correction = 2.0F;//MsrdValLimHi;
|
||||
corrections.Add(Hi);
|
||||
|
||||
|
||||
|
||||
expectedVal = Lo.Correction;
|
||||
rawValue = Lo.Measurement; //Ampers
|
||||
|
||||
double CorrectionVal = MeasurementCorrection.GetCorrection(rawValue, corrections);
|
||||
Console.WriteLine("{0} Correction - rawValue: {1} CorrectionVal: {2}", "TEST " + rawValue, rawValue, CorrectionVal);
|
||||
Assert.IsTrue(expectedVal == CorrectionVal);
|
||||
|
||||
expectedVal = Hi.Correction;
|
||||
rawValue = Hi.Measurement; //Ampers
|
||||
|
||||
CorrectionVal = MeasurementCorrection.GetCorrection(rawValue, corrections);
|
||||
Console.WriteLine("{0} Correction - rawValue: {1} CorrectionVal: {2}", "TEST " + rawValue, rawValue, CorrectionVal);
|
||||
Assert.IsTrue(expectedVal == CorrectionVal);
|
||||
|
||||
double toler = 0.3;
|
||||
expectedVal = 1.24; //bar
|
||||
rawValue = 0.152; //Ampers
|
||||
|
||||
CorrectionVal = MeasurementCorrection.GetCorrection(rawValue, corrections);
|
||||
Console.WriteLine("{0} Correction - rawValue: {1} CorrectionVal: {2}", "TEST " + rawValue, rawValue, CorrectionVal);
|
||||
Assert.IsTrue((expectedVal + toler) >= CorrectionVal && (expectedVal - toler) <= CorrectionVal);
|
||||
|
||||
toler = 0.0001;
|
||||
expectedVal = 1.0;
|
||||
rawValue = Lo.Measurement + ((Hi.Measurement - Lo.Measurement) / 2.0); //Ampers 0.129999999403954
|
||||
|
||||
CorrectionVal = MeasurementCorrection.GetCorrection(rawValue, corrections);
|
||||
Console.WriteLine("{0} Correction - rawValue: {1} CorrectionVal: {2}", "TEST " + rawValue, rawValue, CorrectionVal);
|
||||
Assert.IsTrue((expectedVal + toler) >= CorrectionVal && (expectedVal - toler) <= CorrectionVal);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user