Monitor power supply data for fault conditions

This commit is contained in:
Duc
2025-01-04 18:41:54 -07:00
parent 7e2a821337
commit b38765789d
14 changed files with 242 additions and 70 deletions

View File

@@ -57,7 +57,7 @@ namespace Raytheon.Instruments.PowerSupplies
string coupledModules = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.COUPLED_MODULES.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
string groupedModules = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.GROUPED_MODULES.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
List<string> powerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
PowerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_coupledModules = coupledModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_groupedModules = groupedModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
@@ -81,9 +81,9 @@ namespace Raytheon.Instruments.PowerSupplies
if (_groupedModules.Count() > 1)
{
powerModules.Clear();
PowerModules.Clear();
// since modules are grouped, we pick the first module as the representative module
powerModules.Add(_groupedModules[0]);
PowerModules.Add(_groupedModules[0]);
}
// build the power module map
@@ -98,9 +98,9 @@ namespace Raytheon.Instruments.PowerSupplies
double minCurrent = 0.0;
double maxCurrent = 0.0;
for (int i = 0; i < powerModules.Count(); i++)
for (int i = 0; i < PowerModules.Count(); i++)
{
string moduleName = powerModules[i];
string moduleName = PowerModules[i];
moduleIndex = _config.ReadValue(moduleName, PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.OCP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ocp);
@@ -143,7 +143,6 @@ namespace Raytheon.Instruments.PowerSupplies
/// <returns></returns>
public override bool FrontPanelEnabled
{
get { SemObj?.Release(); throw new NotImplementedException(); }
set
{
string command;

View File

@@ -97,15 +97,21 @@ namespace Raytheon.Instruments.PowerSupplies
{
get
{
if (!(powerDeviceId == null || powerDeviceId.GetType().IsEnum))
string powerDeviceName = String.Empty;
if (powerDeviceId != null && (powerDeviceId.GetType().IsEnum || powerDeviceId is string))
{
throw new ArgumentException($"{nameof(powerDeviceId)} must be an enumerated type or null");
powerDeviceName = powerDeviceId.ToString();
}
else if (powerDeviceId != null)
{
throw new ArgumentException($"{nameof(powerDeviceId)} must be null or enumerated or string type");
}
_powerSupplyModule.GetSemphamore().WaitOne();
if (powerDeviceId != null)
_powerSupplyModule.SetActivePowerModule(powerDeviceId.ToString());
_powerSupplyModule.SetActivePowerModule(powerDeviceName);
return _powerSupplyModule;
}