From 62cd81b5f77faaa4d9dd5f3b77e49aa5f993c595 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 17 Sep 2015 18:14:49 +0200 Subject: [PATCH] Defines re-arranged so that new benches do not require any modification, bug in BADGER fixed. --- ResultsBrowser/Program.cs | 22 ++++++++++--- .../BenchControl/Elde/ControlBoardDev.cs | 26 +++++++-------- .../BenchControl/Elde/ControlComWrap.cs | 32 +++++++------------ .../BenchControl/StateMachine.cs | 3 +- TestBenchFramework/MainWnd.Designer.cs | 5 +-- 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/ResultsBrowser/Program.cs b/ResultsBrowser/Program.cs index ebc42ec52..c5e25f5c5 100644 --- a/ResultsBrowser/Program.cs +++ b/ResultsBrowser/Program.cs @@ -31,13 +31,27 @@ namespace ResultsBrowser /// Database related: This object reference is set after a successful user login public static DatabaseSettings CurrentBench; const string SQLiteDbFName = "SQLite.db"; - -#if (DN100 || MUNICH) + +#if DN100 || MUNICH public const int WMsCount = 3; -#elif FUZHOU300 || FUZHOU150 || PT200IL || TORINO50 || BADGER_MALA_TRAT + public const int LineSize = 3; + public const int CompoundWMsCount = 1; +#elif FUZHOU300 || FUZHOU150 || PT200IL public const int WMsCount = 6; -#elif TORUN_PT50_2015 + public const int LineSize = 6; + public const int CompoundWMsCount = 3; +#elif TORINO50 || BADGER_MALA_TRAT + public const int WMsCount = 6; + public const int LineSize = 6; + public const int CompoundWMsCount = 1; +#elif TORUN_PT50_2015 || CEVAK_PT40_272 public const int WMsCount = 20; + public const int LineSize = 10; + public const int CompoundWMsCount = 1; +#elif IPERLST + public const int WMsCount = 40; + public const int LineSize = 20; + public const int CompoundWMsCount = 1; #endif /// diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs index 209c05f27..0a822039b 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs @@ -118,13 +118,12 @@ namespace TBF.BenchControl.Elde public float[,] TempCalibData = new float[8, 5]; // Array length is the reference flowmeters count plus one -#if DN100 +#if DN100 || FUZHOU150 || FUZHOU300 || PT200IL public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 }; #elif MUNICH || TORINO50 || BADGER_MALA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 }; -#elif FUZHOU150 || FUZHOU300 || PT200IL - public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 }; #endif + public uint[] DiverterEdge = new uint[2] { 50, 50 }; public uint[] BalanceRange = new uint[2]; @@ -151,11 +150,12 @@ namespace TBF.BenchControl.Elde /// Power (0.0f .. 100.0f) public void SetFMFreq(int index, float power) { -#if FUZHOU300 || PT200IL || IPERLST - if ((FMFreq == null) || (FMFreq.Length != 6)) FMFreq = new float[6]; -#else +#if DN100 || MUNICH || FUZHOU150 if ((FMFreq == null) || (FMFreq.Length != 2)) FMFreq = new float[2]; +#else /// all newer benches + if ((FMFreq == null) || (FMFreq.Length != 6)) FMFreq = new float[6]; #endif + if (index >= 0 && index < FMFreq.Length) FMFreq[index] = power; log.DebugFormat("FMFreq=[{0}{1}{2}{3}{4}{5}]", FMFreq[0].ToString(), @@ -192,10 +192,10 @@ namespace TBF.BenchControl.Elde { controlBoardCfg = cfg; -#if FUZHOU300 || PT200IL || IPERLST - FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300,PT200IL=6 -#else - FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6 +#if DN100 || MUNICH || FUZHOU150 + FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6 +#else /// all newer benches + FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 }; #endif emergencyStop = false; previousEmergencyStop = false; @@ -227,11 +227,7 @@ namespace TBF.BenchControl.Elde ControlComponent3F300.UserControl1 ctrlBrdComponent, #elif PT200IL ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent, -#elif TORINO50 - ControlComponent_Torino2015.UserControl1 ctrlBrdComponent, -#elif BADGER_MALA_TRAT - ControlComponent_Torino2015.UserControl1 ctrlBrdComponent, -#elif TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST +#else /// all newer benches ControlComponent_Torino2015.UserControl1 ctrlBrdComponent, #endif ulong valvesToInvert, diff --git a/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs b/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs index b53e651b7..f966c06d7 100644 --- a/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs +++ b/TestBenchFramework/BenchControl/Elde/ControlComWrap.cs @@ -14,7 +14,9 @@ namespace TBF.BenchControl.Elde /// Properties /// public StatusP StatusP { get { return (StatusP)ctrlBrdComponent.StatusP; } } -#if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST +#if DN100 || MUNICH || FUZHOU150 + public float ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// In [Hz] 0..2500, nom.=2000 +#else /// all newer benches /// /// In case of I11, I12 /// referenceFreq[0] = I11 + I12 @@ -24,8 +26,6 @@ namespace TBF.BenchControl.Elde /// referenceFreq[0] = I2 or I3 or I4 /// public float ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq[0]; } } /// In [Hz] 0..2500, nom.=2000 -#else - public float ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// In [Hz] 0..2500, nom.=2000 #endif public int EtPulses(int wmNr0) { return (int)ctrlBrdComponent.etPulses[wmNr0]; } public UInt16 WMeterPulses(int wmNr0) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr0]; } @@ -37,10 +37,10 @@ namespace TBF.BenchControl.Elde public ulong RRoute { get { return ctrlBrdComponent.rRoute; } } public uint DivTime { get { return ctrlBrdComponent.divTime; } } public float TTime { get { return ctrlBrdComponent.Ttime; } } -#if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST - public uint FmState { get { return ctrlBrdComponent.fMState[0]; } } /// TODO: index -#else +#if DN100 || MUNICH || FUZHOU150 public uint FmState { get { return ctrlBrdComponent.fMState; } } +#else //if everything newer + public uint FmState { get { return ctrlBrdComponent.fMState[0]; } } /// TODO: index #endif public uint BeginState(int wmNr0) { return ctrlBrdComponent.beginSt[wmNr0]; } public float ReferenceFlow { get { return ctrlBrdComponent.referenceFlow; } } @@ -76,15 +76,11 @@ namespace TBF.BenchControl.Elde private ControlComponent3F300.UserControl1 ctrlBrdComponent; #elif PT200IL private ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent; -#elif TORINO50 - private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent; -#elif BADGER_MALA_TRAT - private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent; -#elif TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST +#else /// newer benches private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent; #endif - /// + /// /// Constructor that initializes the control board component reference /// /// @@ -98,11 +94,7 @@ namespace TBF.BenchControl.Elde public ControlComWrap(ControlComponent3F300.UserControl1 ctrlBrdComponent) #elif PT200IL public ControlComWrap(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent) -#elif TORINO50 - public ControlComWrap(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent) -#elif BADGER_MALA_TRAT - public ControlComWrap(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent) -#elif TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST +#else /// all newer benches public ControlComWrap(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent) #endif { @@ -198,10 +190,10 @@ namespace TBF.BenchControl.Elde // valveValue[0], // valveValue[1])); log.InfoFormat("ValveMove(#={0}, md={1}, [{2}, {3}])", valveNo, valveMode, valveValue[0], valveValue[1]); -#if FUZHOU300 || PT200IL || TORINO50 || BADGER_MALA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST - ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue, stableTime); -#else +#if DN100 || MUNICH || FUZHOU150 ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue); +#else /// all newer benches + ctrlBrdComponent.ValveMove((byte)valveNo, (byte)valveMode, valveValue, stableTime); #endif } diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index 11bc26b6e..d2538080d 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -60,6 +60,7 @@ namespace TBF.BenchControl #else public const int Period = 1; /// State machine period in sec. #endif + static DateTime startDateTime; /// DateTime of time instance when the state machine worker thread starts static int currentTimeSec; /// Time from the start of the state machine in seconds static bool quitStateMachine; /// flag to stop the worker thread @@ -195,7 +196,7 @@ namespace TBF.BenchControl public static void InitializeBoardEtc(ControlComponent3F300.UserControl1 ctrlBrdComponent) #elif PT200IL public static void InitializeBoardEtc(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent) -#elif TORINO50 || BADGER_MALA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST +#else /// all newer benches public static void InitializeBoardEtc(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent) #endif { diff --git a/TestBenchFramework/MainWnd.Designer.cs b/TestBenchFramework/MainWnd.Designer.cs index 0b455855d..988a2a898 100644 --- a/TestBenchFramework/MainWnd.Designer.cs +++ b/TestBenchFramework/MainWnd.Designer.cs @@ -588,10 +588,7 @@ namespace TBF #elif PT200IL private ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent; private TBF.Screens.ProcessTabPageCtrl6 processTabPageCtrl; -#elif TORINO50 - private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent; - private TBF.Screens.ProcessTabPageCtrl6 processTabPageCtrl; -#elif BADGER_MALA_TRAT +#elif TORINO50 || BADGER_MALA_TRAT private ControlComponent_Torino2015.UserControl1 ctrlBrdComponent; private TBF.Screens.ProcessTabPageCtrl6 processTabPageCtrl; #elif TORUN_PT50_2015 || CEVAK_PT40_272