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

@@ -15,14 +15,11 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using NLog;
using Raytheon.Common;
using Raytheon.Instruments;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using NLog;
namespace Raytheon
{
@@ -45,16 +42,7 @@ namespace Raytheon
public bool FrontPanelEnabled
{
get
{
if (_powerSupply != null)
{
return _powerSupply[null].FrontPanelEnabled;
}
else
return true;
}
private get { return false; }
set
{
if (_powerSupply != null)
@@ -67,7 +55,7 @@ namespace Raytheon
/// <summary>
/// constructor
/// </summary>
/// <param name="stePowerSupplyInstanceName">the name specified in the Instruments.xml file</param>
/// <param></param>
public PowerModuleMeasurementManager(PowerSupply powerSupply, IConfigurationFile powerOffAndSelfTestConfig)
{
_logger = LogManager.GetCurrentClassLogger();
@@ -109,6 +97,22 @@ namespace Raytheon
_powerSupply[module].ReadPowerSupplyData(out voltage, out current, out voltageSetPoint, out isOn, out faultStatus);
}
/// <summary>
/// Get all the names of modules in the power system
/// </summary>
public List<string> GetModuleNames()
{
return _powerSupply.GetPowerSupplyModuleNames();
}
/// <summary>
/// Get all the configuration information for each module
/// </summary>
public Dictionary<string, Instruments.PowerSupplies.PowerSupplyModuleInfo> GetPowerSupplyModuleInfoDict()
{
return _powerSupply.GetPowerSupplyModuleInfoDict();
}
/// <summary>
/// Enable the output of the power supply.
/// </summary>

View File

@@ -76,17 +76,22 @@ namespace Raytheon
{
get
{
if (!powerSystemId.GetType().IsEnum)
string powerSystemName;
if (powerSystemId.GetType().IsEnum || powerSystemId is string)
{
throw new ArgumentException($"{nameof(powerSystemId)} must be an enumerated type");
powerSystemName = powerSystemId.ToString();
}
else
{
throw new ArgumentException($"{nameof(powerSystemId)} must be an enumerated or string type");
}
if (!_powerSystemNameToPowerModuleMeasurementManagerDict.ContainsKey(powerSystemId.ToString()))
if (!_powerSystemNameToPowerModuleMeasurementManagerDict.ContainsKey(powerSystemName))
{
throw new Exception($"Invalid power supply system: {powerSystemId.ToString()}");
throw new Exception($"Invalid power supply system: {powerSystemName}");
}
return _powerSystemNameToPowerModuleMeasurementManagerDict[powerSystemId.ToString()];
return _powerSystemNameToPowerModuleMeasurementManagerDict[powerSystemName];
}
}