Big changes

This commit is contained in:
Duc
2025-03-13 12:04:22 -07:00
parent c689fcb7f9
commit ffa9905494
748 changed files with 199255 additions and 3743 deletions

View File

@@ -16,15 +16,9 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using NLog;
using ProgramGui.Model;
using ProgramGui;
using ProgramLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ProgramLib
{

View File

@@ -16,16 +16,12 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using NLog;
using ProgramGui;
using ProgramGui.Model;
using ProgramGui.ViewModel;
using ProgramLib;
using ProgramLib.GUI.Model;
using ProgramLib.GUI.View;
using ProgramLib.GUI.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ProgramLib
{
@@ -46,7 +42,7 @@ namespace ProgramLib
}
private ILogger _logger;
private MainWindow _mainWindow;
private LiveDataWindow _liveDataWindow;
private PassthroughData _passthroughData = null;
/// <summary>
@@ -56,13 +52,13 @@ namespace ProgramLib
{
_logger = LogManager.GetCurrentClassLogger();
_mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN];
_liveDataWindow = (LiveDataWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA];
_passthroughData = new PassthroughData(_mainWindow.datagridPassthroughData.Columns.Count);
_passthroughData = new PassthroughData(_liveDataWindow.datagridPassthroughData.Columns.Count);
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Dispatcher.Invoke((Action)delegate
{
_mainWindow._mainWindowViewModel.AddPassthroughData(_passthroughData.GetPassthroughDataModelDict());
_liveDataWindow.LiveDataWindowViewModel.AddPassthroughData(_passthroughData.GetPassthroughDataModelDict());
});
}
@@ -137,7 +133,7 @@ namespace ProgramLib
if (id == Events.EVENT_TIMED_OUT)
{
rnd = new Random();
_mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_OFF];
_liveDataWindow.LiveDataWindowViewModel.UutPowerLedImagePath = _liveDataWindow.LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_OFF];
float num = 70.0f + GenerateRandomFraction();
_passthroughData.SetValue(PassthroughData.Variables.VAR1, num.ToString("0.00"));
@@ -152,7 +148,7 @@ namespace ProgramLib
num = 50.0f + GenerateRandomFraction();
_passthroughData.SetValue(PassthroughData.Variables.VAR4, num.ToString("0.00"));
Thread.Sleep(100);
_mainWindow._mainWindowViewModel.UutPowerLedImagePath = _mainWindow._mainWindowViewModel._imageToResourcePathDict[MainWindowViewModel.Images.LED_ON];
_liveDataWindow.LiveDataWindowViewModel.UutPowerLedImagePath = _liveDataWindow.LiveDataWindowViewModel.ImageToResourcePathDict[LiveDataWindowViewModel.Images.LED_ON];
num = 60.0f + GenerateRandomFraction();
_passthroughData.SetValue(PassthroughData.Variables.VAR5, num.ToString("0.00"));
Thread.Sleep(200);

View File

@@ -20,6 +20,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Threading;
using NLog;
using Raytheon.Instruments.PowerSupply;
namespace ProgramLib
{
@@ -44,7 +45,8 @@ namespace ProgramLib
private string _powerSupplySystemName;
private List<string> _powerModuleNameList;
Dictionary<string, Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo> _powerSupplyModuleInfoDict;
Dictionary<string, PowerSupplyModuleInfo> _powerSupplyModuleInfoDict;
/// <summary>
/// Constructor
@@ -80,8 +82,8 @@ namespace ProgramLib
EventGroup<Events, EventWaitHandle> eventGroup = new EventGroup<Events, EventWaitHandle>(eventDict);
_powerModuleNameList = Program.Instance().GetPowerSupplyMeasurementManager()[_powerSupplySystemName].GetModuleNames();
_powerSupplyModuleInfoDict = Program.Instance().GetPowerSupplyMeasurementManager()[_powerSupplySystemName].GetPowerSupplyModuleInfoDict();
_powerModuleNameList = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetPowerSupplyList(_powerSupplySystemName);
_powerSupplyModuleInfoDict = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.GetPowerSupplyModuleInfoDict(_powerSupplySystemName);
while (true)
{
@@ -123,12 +125,6 @@ namespace ProgramLib
EventGroup<Events, EventWaitHandle> eventGroup = new EventGroup<Events, EventWaitHandle>(eventDict);
double voltage;
double current;
double voltageSetPoint;
bool isOn;
int faultStatus;
while (true)
{
Events id = eventGroup.WaitAny(pollRateMs);
@@ -137,22 +133,16 @@ namespace ProgramLib
{
foreach (string moduleName in _powerModuleNameList)
{
Program.Instance().GetPowerSupplyMeasurementManager()[_powerSupplySystemName].ReadPowerSupplyData(moduleName, out voltage, out current, out voltageSetPoint, out isOn, out faultStatus);
PowerData data = Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.ReadPowerData(moduleName);
BitArray statusReg = new BitArray(new int[] { faultStatus });
BitArray statusReg = new BitArray(new int[] { data.FaultStatus });
bool ovpTriggeredInPowerSupply = statusReg[0];
bool ocpTriggeredInPowerSupply = statusReg[1];
if (!ovpTriggeredInPowerSupply && !ocpTriggeredInPowerSupply)
{
if (IsCurrentWithinLimits(moduleName, current))
break;
if (IsVoltageWithinLimits(moduleName, voltage))
break;
Program.Instance()._powerSupplySharedData.SetData(moduleName, voltage, current, _powerSupplyModuleInfoDict[moduleName]);
Program.Instance()._powerSupplySharedData.SetData(moduleName, data.Voltage, data.Current, _powerSupplyModuleInfoDict[moduleName]);
}
else
{
@@ -193,14 +183,16 @@ namespace ProgramLib
private bool IsCurrentWithinLimits(string moduleName, double current)
{
bool outOfLimits = false;
Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName];
if ((current < powerSupplyModuleInfo.currentLowerLimit_ || current > powerSupplyModuleInfo.currentUpperLimit_) && powerSupplyModuleInfo.isOn_)
{
outOfLimits = true;
string errorMsg = moduleName + "'s current is out of limits (" + powerSupplyModuleInfo.currentLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.currentUpperLimit_.ToString("0.00") + "). Current reading: " + current.ToString("0.00");
HandleOutOfToleranceCondition(errorMsg);
}
// Duc - is this function needed?
//Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName];
//if ((current < powerSupplyModuleInfo.currentLowerLimit_ || current > powerSupplyModuleInfo.currentUpperLimit_) && powerSupplyModuleInfo.isOn_)
//{
// outOfLimits = true;
// string errorMsg = moduleName + "'s current is out of limits (" + powerSupplyModuleInfo.currentLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.currentUpperLimit_.ToString("0.00") + "). Current reading: " + current.ToString("0.00");
// HandleOutOfToleranceCondition(errorMsg);
//}
return outOfLimits;
}
@@ -213,14 +205,15 @@ namespace ProgramLib
private bool IsVoltageWithinLimits(string moduleName, double voltage)
{
bool outOfLimits = false;
Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName];
// Duc - is this function needed?
//Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo = _powerSupplyModuleInfoDict[moduleName];
if ((voltage < powerSupplyModuleInfo.voltageLowerLimit_ || voltage > powerSupplyModuleInfo.voltageUpperLimit_) && powerSupplyModuleInfo.isOn_)
{
outOfLimits = true;
string errorMsg = moduleName + "'s voltage is out of limits (" + powerSupplyModuleInfo.voltageLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.voltageUpperLimit_.ToString("0.00") + "). Voltage reading: " + voltage.ToString("0.00");
HandleOutOfToleranceCondition(errorMsg);
}
//if ((voltage < powerSupplyModuleInfo.voltageLowerLimit_ || voltage > powerSupplyModuleInfo.voltageUpperLimit_) && powerSupplyModuleInfo.isOn_)
//{
// outOfLimits = true;
// string errorMsg = moduleName + "'s voltage is out of limits (" + powerSupplyModuleInfo.voltageLowerLimit_.ToString("0.00") + "," + powerSupplyModuleInfo.voltageUpperLimit_.ToString("0.00") + "). Voltage reading: " + voltage.ToString("0.00");
// HandleOutOfToleranceCondition(errorMsg);
//}
return outOfLimits;
}

View File

@@ -16,16 +16,11 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using NLog;
using ProgramGui;
using ProgramGui.Model;
using ProgramGui.ViewModel;
using ProgramLib;
using ProgramLib.GUI.Model;
using ProgramLib.GUI.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ProgramLib
{
@@ -46,7 +41,7 @@ namespace ProgramLib
}
private ILogger _logger;
private MainWindow _mainWindow;
private LiveDataWindow _mainWindow;
private Dictionary<string, PowerModuleDataModel> _powerModuleToPowerDataModelDict = new Dictionary<string, PowerModuleDataModel>();
@@ -57,14 +52,14 @@ namespace ProgramLib
{
_logger = LogManager.GetCurrentClassLogger();
_mainWindow = (MainWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN];
_mainWindow = (LiveDataWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA];
_powerModuleToPowerDataModelDict["UUT_P20V"] = new PowerModuleDataModel();
_powerModuleToPowerDataModelDict["UUT_N20V"] = new PowerModuleDataModel();
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Dispatcher.Invoke((Action)delegate
{
_mainWindow._mainWindowViewModel.AddPowerData(_powerModuleToPowerDataModelDict);
_mainWindow.LiveDataWindowViewModel.AddPowerData(_powerModuleToPowerDataModelDict);
});
}
@@ -137,7 +132,7 @@ namespace ProgramLib
if (id == Events.EVENT_TIMED_OUT)
{
PowerSupplyData data = Program.Instance()._powerSupplySharedData.GetData(PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V.ToString());
PowerSupplyData data = Program.Instance()._powerSupplySharedData.GetData("STE_PVM_5V");
if (data != null && data._initialized)
{