diff --git a/Source/Program/Actions/UutPowerAction.cs b/Source/Program/Actions/UutPowerAction.cs index 1cee122..c4057cf 100644 --- a/Source/Program/Actions/UutPowerAction.cs +++ b/Source/Program/Actions/UutPowerAction.cs @@ -70,17 +70,22 @@ namespace ProgramLib { _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].OutputDisable(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V); - // enable front panel - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = true; - - // signal to PowerSupplyReadThread to stop monitoring power - Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF].Set(); - - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + if (Program.Instance()._isUutPwrOn) { - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Hide(); - }); + Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].OutputDisable(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V); + // enable front panel + Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = true; + + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + { + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Hide(); + }); + + Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON].Reset(); + Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF].Set(); + + Program.Instance()._isUutPwrOn = false; + } } } catch (Exception) @@ -102,9 +107,7 @@ namespace ProgramLib { _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method..."); - Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].ReadPowerSupplyData(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V, out double voltage, out double current, out double voltageSetPoint, out bool isOn, out int faultStatus); - - if (!isOn) + if (!Program.Instance()._isUutPwrOn) { Task.Factory.StartNew(() => PerformSttoTask()); ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate @@ -126,14 +129,20 @@ namespace ProgramLib // disable front panel Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = false; - // signal to PowerSupplyReadThread to start monitoring power + Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF].Reset(); Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON].Set(); + + Program.Instance()._isUutPwrOn = true; } else { throw new Exception(fatalErrorMsg); } } + else + { + throw new Exception("UUT power is already on."); + } } } catch (Exception) diff --git a/Source/Program/Common/Misc/EventManager.cs b/Source/Program/Common/Misc/EventManager.cs index 100e213..6d8859f 100644 --- a/Source/Program/Common/Misc/EventManager.cs +++ b/Source/Program/Common/Misc/EventManager.cs @@ -31,13 +31,6 @@ namespace ProgramLib { private EventWaitHandle[] _events = new EventWaitHandle[Enum.GetValues(typeof(Events)).Cast().Max() + 1]; - // specify which event should have to be manually reset - List _manualEventList = new List - { - Events.GLOBAL_QUIT, - Events.FATAL_FAILURE - }; - /// /// The private constructor /// @@ -45,12 +38,7 @@ namespace ProgramLib { for (int i = 0; i < _events.Count(); i++) { - if (_manualEventList.Contains((Events)i)) - { - _events[i] = new ManualResetEvent(false); - } - else - _events[i] = new AutoResetEvent(false); + _events[i] = new ManualResetEvent(false); } } diff --git a/Source/Program/Program.MeasurementManager.cs b/Source/Program/Program.MeasurementManager.cs index f584458..be05777 100644 --- a/Source/Program/Program.MeasurementManager.cs +++ b/Source/Program/Program.MeasurementManager.cs @@ -108,6 +108,12 @@ namespace ProgramLib _threadList.Add(new PowerSupplyReadThread(ps.Name)); _threadList.Last().Start(); } + + _threadList.Add(new PassthroughDataGuiUpdateThread()); + _threadList.Last().Start(); + + _threadList.Add(new PowerSupplyGuiUpdateThread()); + _threadList.Last().Start(); } } catch (Exception ex) diff --git a/Source/Program/Program.cs b/Source/Program/Program.cs index 8b45853..71183e6 100644 --- a/Source/Program/Program.cs +++ b/Source/Program/Program.cs @@ -65,6 +65,7 @@ namespace ProgramLib internal EventManager _eventManager = new EventManager(); internal FileAndFolderManager _fileAndFolderManager; internal IConfigurationFile _programConfig { get; private set; } + internal bool _isUutPwrOn = false; /// /// Create an instance of this class. Only one instance is allowed @@ -261,6 +262,11 @@ namespace ProgramLib } } + /// + /// Save error message originated from other threads + /// + /// + /// internal void SetFatalErrorMsgFromThread(string errorMsg) { lock(_fatalErrorMsgFromThreadSyncObj) diff --git a/Source/Program/Threads/PassthroughDataGuiUpdateThread.cs b/Source/Program/Threads/PassthroughDataGuiUpdateThread.cs new file mode 100644 index 0000000..bcf09be --- /dev/null +++ b/Source/Program/Threads/PassthroughDataGuiUpdateThread.cs @@ -0,0 +1,172 @@ +/*------------------------------------------------------------------------- +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ +using NLog; +using ProgramGui; +using ProgramGui.Model; +using ProgramGui.ViewModel; +using ProgramLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace ProgramLib +{ + internal class PassthroughDataGuiUpdateThread : BasicThread + { + private enum Events + { + GLOBAL_QUIT, + UUT_POWER_ON, + UUT_POWER_OFF, + + // DO NOT change the name + // This must be the last member in the enum + EVENT_TIMED_OUT + } + + private ILogger _logger; + private MainWindow _mainWindow; + private PassthroughData _passthroughData = null; + + public PassthroughDataGuiUpdateThread() + { + _logger = LogManager.GetCurrentClassLogger(); + + _mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN]; + + _passthroughData = new PassthroughData(_mainWindow.datagridPassthroughData.Columns.Count); + + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + { + _mainWindow._mainWindowViewModel.AddPassthroughData(_passthroughData.GetPassthroughDataModelDict()); + }); + } + + ~PassthroughDataGuiUpdateThread() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ..."); + } + + protected override void DoWork() + { + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running..."); + + try + { + Dictionary eventDict = new Dictionary(); + eventDict[Events.GLOBAL_QUIT] = Program.Instance()._eventManager[EventManager.Events.GLOBAL_QUIT]; + eventDict[Events.UUT_POWER_ON] = Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON]; + eventDict[Events.EVENT_TIMED_OUT] = null; + + EventGroup eventGroup = new EventGroup(eventDict); + + while (true) + { + Events id = eventGroup.WaitAny(); + + if (id == Events.UUT_POWER_ON) + { + UpdatePassthroughDataGui(); + } + else + break; + } + } + catch (Exception ex) + { + _logger?.Error(ex.Message + "\n" + ex.StackTrace); + } + + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting..."); + + } + + private void UpdatePassthroughDataGui() + { + int pollRateMs = 1000; + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running..."); + + try + { + Dictionary eventDict = new Dictionary(); + eventDict[Events.GLOBAL_QUIT] = Program.Instance()._eventManager[EventManager.Events.GLOBAL_QUIT]; + eventDict[Events.UUT_POWER_OFF] = Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF]; + eventDict[Events.EVENT_TIMED_OUT] = null; + + EventGroup eventGroup = new EventGroup(eventDict); + + Random rnd = new Random(); + while (true) + { + Events id = eventGroup.WaitAny(pollRateMs); + + if (id == Events.EVENT_TIMED_OUT) + { + rnd = new Random(); + + float num = 70.0f + GenerateRandomFraction(); + _passthroughData.SetValue(PassthroughData.Variables.VAR1, num.ToString("0.00")); + + Thread.Sleep(100); + num = 30.0f + GenerateRandomFraction(); + _passthroughData.SetValue(PassthroughData.Variables.VAR2, num.ToString("0.00")); + Thread.Sleep(200); + num = 40.0f + GenerateRandomFraction(); + _passthroughData.SetValue(PassthroughData.Variables.VAR3, num.ToString("0.00")); + Thread.Sleep(100); + num = 50.0f + GenerateRandomFraction(); + _passthroughData.SetValue(PassthroughData.Variables.VAR4, num.ToString("0.00")); + Thread.Sleep(100); + num = 60.0f + GenerateRandomFraction(); + _passthroughData.SetValue(PassthroughData.Variables.VAR5, num.ToString("0.00")); + Thread.Sleep(200); + num = 10.0f + GenerateRandomFraction(); + _passthroughData.SetValue(PassthroughData.Variables.VAR6, num.ToString("0.00")); + } + else + break; + } + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\n" + ex.StackTrace); + } + + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting..."); + } + + static float GenerateRandomFraction() + { + Random rnd = new Random(); + int randNum = 0; + const int minimum = 1; + + randNum = rnd.Next(20); + + if (randNum <= minimum) + { + randNum += minimum; + } + + return (float)(1.0 / (float)randNum); + } + } +} diff --git a/Source/Program/Threads/PowerSupplyGuiUpdateThread.cs b/Source/Program/Threads/PowerSupplyGuiUpdateThread.cs new file mode 100644 index 0000000..239aa40 --- /dev/null +++ b/Source/Program/Threads/PowerSupplyGuiUpdateThread.cs @@ -0,0 +1,172 @@ +/*------------------------------------------------------------------------- +// UNCLASSIFIED +/*------------------------------------------------------------------------- +RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION +PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS +AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO +UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO +RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS +CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS +OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON +COMPANY. + +THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S. +GOVERNMENT. + +UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY. +-------------------------------------------------------------------------*/ +using NLog; +using ProgramGui; +using ProgramGui.Model; +using ProgramGui.ViewModel; +using ProgramLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace ProgramLib +{ + internal class PowerSupplyGuiUpdateThread : BasicThread + { + private enum Events + { + GLOBAL_QUIT, + UUT_POWER_ON, + UUT_POWER_OFF, + + // DO NOT change the name + // This must be the last member in the enum + EVENT_TIMED_OUT + } + + private ILogger _logger; + private MainWindow _mainWindow; + + private Dictionary _powerModuleToPowerDataModelDict = new Dictionary(); + + public PowerSupplyGuiUpdateThread() + { + _logger = LogManager.GetCurrentClassLogger(); + + _mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN]; + + _powerModuleToPowerDataModelDict["UUT_P20V"] = new PowerModuleDataModel(); + _powerModuleToPowerDataModelDict["UUT_N20V"] = new PowerModuleDataModel(); + + ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate + { + _mainWindow._mainWindowViewModel.AddPowerData(_powerModuleToPowerDataModelDict); + }); + } + + ~PowerSupplyGuiUpdateThread() + { + _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ..."); + } + + protected override void DoWork() + { + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running..."); + + try + { + Dictionary eventDict = new Dictionary(); + eventDict[Events.GLOBAL_QUIT] = Program.Instance()._eventManager[EventManager.Events.GLOBAL_QUIT]; + eventDict[Events.UUT_POWER_ON] = Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON]; + eventDict[Events.EVENT_TIMED_OUT] = null; + + EventGroup eventGroup = new EventGroup(eventDict); + + while (true) + { + Events id = eventGroup.WaitAny(); + + if (id == Events.UUT_POWER_ON) + { + UpdatePowerSupplyGui(); + } + else + break; + } + } + catch (Exception ex) + { + _logger?.Error(ex.Message + "\n" + ex.StackTrace); + } + + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting..."); + + } + + private void UpdatePowerSupplyGui() + { + int pollRateMs = 1000; + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running..."); + + try + { + Dictionary eventDict = new Dictionary(); + eventDict[Events.GLOBAL_QUIT] = Program.Instance()._eventManager[EventManager.Events.GLOBAL_QUIT]; + eventDict[Events.UUT_POWER_OFF] = Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF]; + eventDict[Events.EVENT_TIMED_OUT] = null; + + EventGroup eventGroup = new EventGroup(eventDict); + + Random rnd = new Random(); + while (true) + { + Events id = eventGroup.WaitAny(pollRateMs); + + if (id == Events.EVENT_TIMED_OUT) + { + rnd = new Random(); + + _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_OFF]; + float num = 20.0f + GenerateRandomFraction(); + _powerModuleToPowerDataModelDict["UUT_P20V"].ActualVoltage = num.ToString("0.00"); + _powerModuleToPowerDataModelDict["UUT_P20V"].ExpectedVoltage = "20.0"; + Thread.Sleep(100); + num = 1.0f + GenerateRandomFraction(); + _powerModuleToPowerDataModelDict["UUT_P20V"].ActualCurrent = num.ToString("0.00"); + Thread.Sleep(100); + num = 20.0f + GenerateRandomFraction(); + _powerModuleToPowerDataModelDict["UUT_N20V"].ActualVoltage = num.ToString("0.00"); + _powerModuleToPowerDataModelDict["UUT_N20V"].ExpectedVoltage = "20.0"; + Thread.Sleep(200); + _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_ON]; + + num = 5.0f + GenerateRandomFraction(); + _powerModuleToPowerDataModelDict["UUT_N20V"].ActualCurrent = num.ToString("0.00"); + } + else + break; + } + } + catch (Exception ex) + { + _logger.Error(ex.Message + "\n" + ex.StackTrace); + } + + _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is exiting..."); + } + + static float GenerateRandomFraction() + { + Random rnd = new Random(); + int randNum = 0; + const int minimum = 1; + + randNum = rnd.Next(20); + + if (randNum <= minimum) + { + randNum += minimum; + } + + return (float)(1.0 / (float)randNum); + } + } +} diff --git a/Source/Program/Threads/PowerSupplyReadThread.cs b/Source/Program/Threads/PowerSupplyReadThread.cs index c80b638..9516aea 100644 --- a/Source/Program/Threads/PowerSupplyReadThread.cs +++ b/Source/Program/Threads/PowerSupplyReadThread.cs @@ -43,11 +43,9 @@ namespace ProgramLib } private ILogger _logger; - private MainWindow _mainWindow; + private string _powerSupplySystemName; - private Dictionary _powerModuleToPowerDataModelDict = new Dictionary(); - private PassthroughData _passthroughData = null; public PowerSupplyReadThread(string powerSupplySystemName) { @@ -55,18 +53,6 @@ namespace ProgramLib _powerSupplySystemName = powerSupplySystemName; - _mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN]; - - _powerModuleToPowerDataModelDict["UUT_P20V"] = new PowerModuleDataModel(); - _powerModuleToPowerDataModelDict["UUT_N20V"] = new PowerModuleDataModel(); - - _passthroughData = new PassthroughData(_mainWindow.datagridPassthroughData.Columns.Count); - - ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate - { - _mainWindow._mainWindowViewModel.AddPowerData(_powerModuleToPowerDataModelDict); - _mainWindow._mainWindowViewModel.AddPassthroughData(_passthroughData.GetPassthroughDataModelDict()); - }); } ~PowerSupplyReadThread() @@ -129,47 +115,8 @@ namespace ProgramLib if (id == Events.EVENT_TIMED_OUT) { - rnd = new Random(); + Thread.Sleep(100); - _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_OFF]; - float num = 20.0f + GenerateRandomFraction(); - _powerModuleToPowerDataModelDict["UUT_P20V"].ActualVoltage = num.ToString("0.00"); - _powerModuleToPowerDataModelDict["UUT_P20V"].ExpectedVoltage = "20.0"; - Thread.Sleep(100); - num = 1.0f + GenerateRandomFraction(); - _powerModuleToPowerDataModelDict["UUT_P20V"].ActualCurrent = num.ToString("0.00"); - _powerModuleToPowerDataModelDict["UUT_P20V"].ExpectedCurrent = "1.0"; - Thread.Sleep(100); - num = 20.0f + GenerateRandomFraction(); - _powerModuleToPowerDataModelDict["UUT_N20V"].ActualVoltage = num.ToString("0.00"); - _powerModuleToPowerDataModelDict["UUT_N20V"].ExpectedVoltage = "20.0"; - Thread.Sleep(200); - _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_ON]; - - num = 5.0f + GenerateRandomFraction(); - _powerModuleToPowerDataModelDict["UUT_N20V"].ActualCurrent = num.ToString("0.00"); - _powerModuleToPowerDataModelDict["UUT_N20V"].ExpectedCurrent = "1.0"; - Thread.Sleep(100); - num = 70.0f + GenerateRandomFraction(); - _passthroughData.SetValue(PassthroughData.Variables.VAR1, num.ToString("0.00")); - - Thread.Sleep(100); - num = 30.0f + GenerateRandomFraction(); - _passthroughData.SetValue(PassthroughData.Variables.VAR2, num.ToString("0.00")); - Thread.Sleep(200); - _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_OFF]; - num = 40.0f + GenerateRandomFraction(); - _passthroughData.SetValue(PassthroughData.Variables.VAR3, num.ToString("0.00")); - Thread.Sleep(100); - num = 50.0f + GenerateRandomFraction(); - _passthroughData.SetValue(PassthroughData.Variables.VAR4, num.ToString("0.00")); - Thread.Sleep(100); - num = 60.0f + GenerateRandomFraction(); - _passthroughData.SetValue(PassthroughData.Variables.VAR5, num.ToString("0.00")); - Thread.Sleep(200); - _mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_ON]; - num = 10.0f + GenerateRandomFraction(); - _passthroughData.SetValue(PassthroughData.Variables.VAR6, num.ToString("0.00")); } else break; @@ -183,20 +130,5 @@ namespace ProgramLib _logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {_powerSupplySystemName} is exiting..."); } - static float GenerateRandomFraction() - { - Random rnd = new Random(); - int randNum = 0; - const int minimum = 1; - - randNum = rnd.Next(20); - - if (randNum <= minimum) - { - randNum += minimum; - } - - return (float)(1.0 / (float)randNum); - } } } diff --git a/Source/ProgramGUI/MainWindow.xaml b/Source/ProgramGUI/MainWindow.xaml index a76c784..1e4958e 100644 --- a/Source/ProgramGUI/MainWindow.xaml +++ b/Source/ProgramGUI/MainWindow.xaml @@ -473,8 +473,7 @@