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

8
.gitignore vendored
View File

@@ -3,9 +3,11 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
Source/HalTempFolder
Source/TestStand/Reports
Source/Nuget/cache/
Source/Nuget/SolutionPackages
Source/Nuget/SolutionPackages/*
!Source/Nuget/SolutionPackages/readme.txt
Thumbs.db
@@ -366,4 +368,6 @@ MigrationBackup/
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
!**/HAL/Implementations/BIT/COEComm/build/**

View File

@@ -1,299 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace Raytheon.Instruments.EthernetSockets
{
/// <summary>
/// Class for controlling a TCP client communication device
/// </summary>
public class TcpClient : ICommDevice
{
#region PrivateClassMembers
private Socket _sock;
private string _remoteAddress;
private int _remotePort;
private IPEndPoint _remoteEP = null;
private IPAddress _ipAddress = null;
private object _syncObj = new object();
private readonly string _name;
private State _state;
/// <summary>
/// NLog logger
/// </summary>
private static ILogger _logger;
/// <summary>
/// Raytheon configuration
/// </summary>
private readonly IConfigurationManager _configurationManager;
private readonly IConfiguration _configuration;
#endregion
public bool ClearErrors() => false;
public bool FrontPanelEnabled { get => false; set => throw new NotImplementedException(); }
public bool DisplayEnabled { get => false; set => throw new NotImplementedException(); }
public string DetailedStatus => $"This is a TCP/IP Device called {_name}";
public InstrumentMetadata Info => throw new NotImplementedException();
public State Status => _state;
public string Name => _name;
public SelfTestResult PerformSelfTest() => SelfTestResult;
public SelfTestResult SelfTestResult => SelfTestResult.Unknown;
public void Open() => Initialize();
public void Close() => Disconnect();
public void Shutdown() => Disconnect();
public void Reset()
{
Close();
Open();
}
#region Public Functions
/// <summary>
/// CommDevice factory constructor
/// </summary>
/// <param name="deviceInstanceName"></param>
/// <param name="configurationManager"></param>
public TcpClient(string deviceInstanceName, IConfigurationManager configurationManager, ILogger logger, string remoteAddress = "", int remotePort = 0)
{
_name = deviceInstanceName;
_state = State.Uninitialized;
_logger = logger;
_configurationManager = configurationManager;
// configuration obtained from [deviceInstanceName].xml file
_configuration = _configurationManager.GetConfiguration(Name);
if (string.IsNullOrEmpty(remoteAddress))
{
_remoteAddress = _configuration.GetConfigurationValue(deviceInstanceName, TcpClientConfigXml.REMOTE_ADDRESS.ToString(), "127.0.0.1");
}
else
{
_remoteAddress = remoteAddress;
}
if (remotePort == 0)
{
_remotePort = _configuration.GetConfigurationValue(deviceInstanceName, TcpClientConfigXml.REMOTE_PORT.ToString(), 0);
}
else
{
_remotePort = remotePort;
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="remoteAddress"></param>
/// <param name="remotePort"></param>
public TcpClient(string remoteAddress, int remotePort)
{
_remoteAddress = remoteAddress;
_remotePort = remotePort;
}
/// <summary>
/// initialize instrument
/// </summary>
public void Initialize()
{
// if remoteAddress is a hostname
if (!IPAddress.TryParse(_remoteAddress, out _ipAddress))
{
string preferredSubnet = "";
IPHostEntry host = Dns.GetHostEntry(_remoteAddress);
foreach (IPAddress ip in host.AddressList)
{
AddressFamily af = ip.AddressFamily;
if (af == AddressFamily.InterNetwork)
{
if (preferredSubnet != String.Empty)
{
if (Regex.IsMatch(ip.ToString(), preferredSubnet, RegexOptions.IgnoreCase))
_ipAddress = ip;
}
else
_ipAddress = ip;
if (_ipAddress != null)
break;
}
}
}
if (_ipAddress != null)
{
if (_remoteEP == null)
_remoteEP = new IPEndPoint(_ipAddress, _remotePort);
}
else
throw new Exception($"Unable to create IPEndPoint to {_remoteAddress}, port {_remotePort}");
if (_sock == null)
_sock = new Socket(_ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
}
/// <summary>
/// Connect to remote host
/// </summary>
/// <returns></returns>
public void Connect()
{
lock (_syncObj)
{
try
{
if (!_sock.Connected && IsRemoteHostAlive())
_sock.Connect(_remoteEP);
}
catch (ObjectDisposedException)
{
_sock = new Socket(_ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
if (IsRemoteHostAlive())
_sock.Connect(_remoteEP);
}
catch (Exception) { throw; }
}
}
/// <summary>
/// Disconnect from remote host
/// </summary>
/// <returns></returns>
public void Disconnect()
{
lock (_syncObj)
{
if (_sock.Connected)
{
_sock.Shutdown(SocketShutdown.Both);
_sock.Disconnect(true);
_sock.Close();
}
}
}
/// <summary>
/// Ping if remote host is alive
/// </summary>
/// <returns>true/false</returns>
bool IsRemoteHostAlive()
{
bool isRemoteHostAlive = true;
//Do a ping test to see if the server is reachable
try
{
Ping pingTest = new Ping();
PingReply reply = pingTest.Send(_ipAddress);
if (reply.Status != IPStatus.Success)
isRemoteHostAlive = false;
}
catch (PingException)
{
isRemoteHostAlive = false;
}
//See if the tcp state is ok
if (_sock.Poll(5000, SelectMode.SelectRead) && (_sock.Available == 0))
{
isRemoteHostAlive = false;
}
return isRemoteHostAlive;
}
/// <summary>
/// Read data from the device.
/// </summary>
/// <param name="dataBuf"></param>
/// <param name="responseTimeOutMs"></param>
/// <returns>The number of bytes read</returns>
public uint Read(ref byte[] dataBuf)
{
int bytesRec = 0;
lock (_syncObj)
{
try
{
bytesRec = _sock.Receive(dataBuf);
}
catch (SocketException)
{
bytesRec = 0;
}
}
return (uint)bytesRec;
}
/// <summary>
/// Sets the read timeout
/// </summary>
/// <param name="timeoutMs"></param>
public void SetReadTimeout(uint timeoutMs)
{
_sock.ReceiveTimeout = (int)timeoutMs;
}
/// <summary>
/// Write data to device.
/// </summary>
/// <param name="dataBuf"></param>
/// <returns>The number of bytes written</returns>
public uint Write(byte[] dataBuf, uint numBytesToWrite)
{
int bytesWritten = 0;
lock (_syncObj)
{
try
{
bytesWritten = _sock.Send(dataBuf, (int)numBytesToWrite, SocketFlags.None);
}
catch (SocketException)
{
bytesWritten = 0;
}
}
return (uint)bytesWritten;
}
#endregion
}
}

View File

@@ -1,33 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.EthernetSockets.TcpClient</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<Product>CommDevice TCP implementation</Product>
<Description>CommDevice TCP implementation</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Company>Raytheon Technologies</Company>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<!-- Dynamic Versioning (Suitable for Release) -->
<!-- <Version>$(Version)$(Suffix)</Version> -->
<!-- Static Versioning (Suitable for Development) -->
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0" />
<PackageReference Include="Raytheon.Configuration" Version="2.6.1" />
<PackageReference Include="Raytheon.Configuration.Contracts" Version="2.3.0" />
<PackageReference Include="Raytheon.Instruments.CommDevice.Contracts" Version="1.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,122 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Reflection;
namespace Raytheon.Instruments.EthernetSockets
{
[ExportInstrumentFactory(ModelNumber = "EthernetSocketsTcpClientFactory")]
public class TcpClientFactory : IInstrumentFactory
{
/// <summary>
/// The supported interfaces
/// </summary>
private readonly List<Type> _supportedInterfaces = new List<Type>();
private static ILogger _logger;
private readonly IConfigurationManager _configurationManager;
private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService";
private static string DefaultPath;
public TcpClientFactory(string defaultConfigPath = DefaultConfigPath)
: this(null, defaultConfigPath)
{
}
/// <summary>
/// COECommDeviceInstrumentFactory injection constructor
/// </summary>
/// <param name="configManager"></param>
/// <param name="simEngine"></param>
/// <param name="logger"></param>
[ImportingConstructor]
public TcpClientFactory([Import(AllowDefault = false)] IConfigurationManager configManager,
[Import(AllowDefault = true)] string defaultConfigPath = null)
{
DefaultPath = defaultConfigPath;
_logger = LogManager.GetCurrentClassLogger();
if (NLog.LogManager.Configuration == null)
{
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
}
_configurationManager = configManager ?? GetConfigurationManager();
_supportedInterfaces.Add(typeof(ICommDevice));
}
/// <summary>
/// Gets the instrument
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public IInstrument GetInstrument(string name)
{
try
{
return new TcpClient(name, _configurationManager, _logger);
}
catch (Exception ex)
{
_logger.Error(ex, $"Unable to construct {name} instrument instance");
return null;
}
}
/// <summary>
/// Gets the instrument
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public object GetInstrument(string name, bool simulateHw)
{
try
{
return new TcpClient(name, _configurationManager, _logger);
}
catch (Exception ex)
{
_logger.Error(ex, $"Unable to construct {name} instrument instance");
return null;
}
}
/// <summary>
/// Gets supported interfaces
/// </summary>
/// <returns></returns>
public ICollection<Type> GetSupportedInterfaces()
{
return _supportedInterfaces.ToArray();
}
/// <summary>
/// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
/// </summary>
/// <returns></returns>
private static IConfigurationManager GetConfigurationManager()
{
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
}
}
}

View File

@@ -1,35 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Company>Raytheon Technologies</Company>
<Product>General Instrument Manager</Product>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<Description>Instrument Manager that works with RINSS or without RINSS</Description>
<Version>1.4.1</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Raytheon.Composition" Version="1.0.0.14" />
<PackageReference Include="Raytheon.Configuration.Contracts" Version="2.3.0" />
<PackageReference Include="Raytheon.Configuration" Version="2.6.1" />
<PackageReference Include="Raytheon.Instruments.RpcInstrumentManager.Contracts" Version="1.1.1.0" />
<PackageReference Include="Raytheon.Logging.Contracts" Version="1.3.0.0" />
<PackageReference Include="Raytheon.Instruments.Contracts" Version="1.5.0" />
<PackageReference Include="Raytheon.Instruments.InstrumentManager.Contracts" Version="1.7.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>
</Project>

View File

@@ -1,43 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.PowerSupplies.Keysight67XX</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<Product>Keysight 67XX Series Power Supply</Product>
<Description>Keysight 67XX Series Power Supply</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Company>Raytheon Technologies</Company>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $(Year)</Copyright>
<!-- Dynamic Versioning (Suitable for Release) -->
<!-- <Version>$(Version)$(Suffix)</Version> -->
<!-- Static Versioning (Suitable for Development) -->
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0" />
<PackageReference Include="Raytheon.Configuration" Version="2.6.1" />
<PackageReference Include="Raytheon.Configuration.Contracts" Version="2.3.0" />
<!--
<PackageReference Include="Raytheon.Instruments.PowerSupply.Contracts" Version="1.1.0" />
<PackageReference Include="Raytheon.Instruments.PowerSupplies.Simulation" Version="1.0.0" />
-->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Interfaces\PowerSupply\PowerSupply.Contracts.csproj" />
<ProjectReference Include="..\..\EthernetSockets\CommDeviceTcpClient\TcpClient.csproj" />
<ProjectReference Include="..\PowerSupplySim\PowerSupplySim.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,117 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Reflection;
namespace Raytheon.Instruments.PowerSupplies
{
[ExportInstrumentFactory(ModelNumber = "PowerSupplyKeysightN67xxFactory")]
public class KeysightN67xxPowerFactory : IInstrumentFactory
{
/// <summary>
/// The supported interfaces
/// </summary>
private readonly List<Type> _supportedInterfaces = new List<Type>();
private static ILogger _logger;
private readonly IConfigurationManager _configurationManager;
private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService";
private static string DefaultPath;
public KeysightN67xxPowerFactory(string defaultConfigPath = DefaultConfigPath)
: this(null, defaultConfigPath)
{
}
/// <summary>
/// COECommDeviceInstrumentFactory injection constructor
/// </summary>
/// <param name="configManager"></param>
/// <param name="simEngine"></param>
/// <param name="logger"></param>
[ImportingConstructor]
public KeysightN67xxPowerFactory([Import(AllowDefault = false)] IConfigurationManager configManager,
[Import(AllowDefault = true)] string defaultConfigPath = null)
{
DefaultPath = defaultConfigPath;
_logger = LogManager.GetCurrentClassLogger();
if (NLog.LogManager.Configuration == null)
{
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
}
_configurationManager = configManager ?? GetConfigurationManager();
_supportedInterfaces.Add(typeof(PowerSupply));
}
/// <summary>
/// Gets the instrument
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public IInstrument GetInstrument(string name)
{
return null;
}
/// <summary>
/// Gets the instrument
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public object GetInstrument(string name, bool simulateHw)
{
try
{
if (simulateHw)
return new PowerSupplySim(name, _configurationManager, _logger);
else
return new KeysightN67xxPowerSupply(name, _configurationManager, _logger);
}
catch (Exception ex)
{
_logger.Error(ex, $"Unable to construct {name} instrument instance");
return null;
}
}
/// <summary>
/// Gets supported interfaces
/// </summary>
/// <returns></returns>
public ICollection<Type> GetSupportedInterfaces()
{
return _supportedInterfaces.ToArray();
}
/// <summary>
/// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
/// </summary>
/// <returns></returns>
private static IConfigurationManager GetConfigurationManager()
{
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
}
}
}

View File

@@ -1,662 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Raytheon.Instruments.PowerSupplies
{
/// <summary>
/// Class to simulate any power supply module
/// </summary>
class KeysightN67xxPowerModule : PowerSupplyModule
{
private List<string> _groupedModules;
private List<string> _coupledModules;
private string _powerSupplySystemName;
private EthernetSockets.TcpClient _tcpClient;
IConfigurationFile _config;
private ILogger _logger;
/// <summary>
/// Constructor
/// </summary>
public KeysightN67xxPowerModule(string iniFilePath, string powerSupplySystemName)
{
_logger = LogManager.GetCurrentClassLogger();
_powerSupplySystemName = powerSupplySystemName;
_config = new ConfigurationFile(iniFilePath);
string ipAddress = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.ETHERNET_ADDRESS.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
int port = 0;
Int32.TryParse(_config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.ETHERNET_PORT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out port);
string moduleDef = _config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.MODULE_DEFINITION.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
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);
PowerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_coupledModules = coupledModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_groupedModules = groupedModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_tcpClient = new EthernetSockets.TcpClient(ipAddress, port);
_tcpClient.Initialize();
_tcpClient.Connect();
ResetPowerSupplySystem();
bool systemRebooted = false;
if (_groupedModules.Count() > 1)
GroupModules(_groupedModules, out systemRebooted);
else if (_coupledModules.Count() > 1)
CoupleModules(_coupledModules);
if (systemRebooted)
{
_tcpClient.Disconnect();
_tcpClient.Connect();
}
if (_groupedModules.Count() > 1)
{
PowerModules.Clear();
// since modules are grouped, we pick the first module as the representative module
PowerModules.Add(_groupedModules[0]);
}
// build the power module map
string moduleIndex = "";
double ovp = 0.0;
double ocp = 0.0;
double voltageSetPoint = 0.0;
double voltageSlewRate = -1.0;
double minVoltage = 0.0;
double maxVoltage = 0.0;
double minCurrent = 0.0;
double maxCurrent = 0.0;
for (int i = 0; i < PowerModules.Count(); 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);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.OVP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ovp);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SETPOINT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSetPoint);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SLEW_RATE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSlewRate);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minVoltage);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxVoltage);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minCurrent);
Double.TryParse(_config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxCurrent);
PowerModuleInfoDict[moduleName] = new Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo(moduleIndex, ocp, ovp, voltageSetPoint, voltageSlewRate, minVoltage, maxVoltage, minCurrent, maxCurrent);
ActivePowerModule = moduleName;
SetConstantVoltageMode();
SetAndConfirmOvp();
SetAndConfirmOcp();
SetAndConfirmVoltageSetpoint();
SetAndConfirmVoltageSlewRate();
}
}
/// <summary>
/// Enable or Disable Front Panel
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override bool DisplayEnabled
{
set
{
SemObj?.Release();
}
}
/// <summary>
/// Enable or disable Front Panel
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override bool FrontPanelEnabled
{
set
{
string command;
try
{
lock (SyncObj)
{
if (value)
command = KeysightPowerSupplyScpiCommands.SET_FRONTPANEL_ENABLE_CMD + "\n";
else
command = KeysightPowerSupplyScpiCommands.SET_FRONTPANEL_DISABLE_CMD + "\n";
SendCommand(command);
}
}
finally { SemObj?.Release(); }
}
}
/// <summary>
/// Turn on power module's output
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override void On()
{
try
{
lock (SyncObj)
{
CheckActivePowerModuleValidity();
string command = KeysightPowerSupplyScpiCommands.SET_OUTPUT_ENABLE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
}
}
finally { SemObj?.Release(); }
}
/// <summary>
/// Turn off power module's output
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override void Off()
{
try
{
lock (SyncObj)
{
CheckActivePowerModuleValidity();
string command = KeysightPowerSupplyScpiCommands.SET_OUTPUT_DISABLE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
}
}
finally { SemObj?.Release(); }
}
/// <summary>
/// Perform self test
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override SelfTestResult PerformSelfTest()
{
try
{
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.SELFTEST_CMD + "\n";
string rsp = SendCommandAndGetResponse(command);
string[] stringVec = rsp.Split(',');
int status = -1;
Int32.TryParse(stringVec[0], out status);
if (status != 0)
{
SelfTestResult = SelfTestResult.Fail;
throw new Exception($"{_powerSupplySystemName}'s self-test failed with error code: {status}");
}
else
SelfTestResult = SelfTestResult.Pass;
}
}
finally { SemObj?.Release(); }
return SelfTestResult;
}
/// <summary>
/// Set constant voltage mode
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void SetConstantVoltageMode()
{
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.SET_CONSTANT_VOLTAGE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
}
}
/// <summary>
/// Set and Confirm OVP
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void SetAndConfirmOvp()
{
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.SET_OVP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
command = KeysightPowerSupplyScpiCommands.READ_OVP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
double ovp = 0.0;
Double.TryParse(rsp, out ovp);
if (ovp != PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_)
throw new Exception($"Unable to set OVP. Expected OVP: {PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_}. Actual: {ovp}");
}
}
/// <summary>
/// Set and Confirm OCP
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void SetAndConfirmOcp()
{
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.SET_OCP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
command = KeysightPowerSupplyScpiCommands.READ_OCP_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
double ocp = 0.0;
Double.TryParse(rsp, out ocp);
if (ocp != PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_)
throw new Exception($"Unable to set OCP. Expected OCP: {PowerModuleInfoDict[ActivePowerModule].overVoltageProtection_}. Actual: {ocp}");
}
}
/// <summary>
/// Set and Confirm Voltage Setpoint
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void SetAndConfirmVoltageSetpoint()
{
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.SET_VOLTAGE_SETPOINT_CMD + " " + PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
command = KeysightPowerSupplyScpiCommands.READ_VOLTAGE_SETPOINT_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
double voltage = 0.0;
Double.TryParse(rsp, out voltage);
if (voltage != PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_)
throw new Exception($"Unable to set Voltage Setpoint. Expected Voltage Setpoint: {PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_}. Actual: {voltage}");
}
}
/// <summary>
/// Set and Confirm Slew Rate
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void SetAndConfirmVoltageSlewRate()
{
lock (SyncObj)
{
if (PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_ > 0.0)
{
string command = KeysightPowerSupplyScpiCommands.SET_VOLTAGE_SLEW_RATE_CMD + " " + PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_ + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
SendCommand(command);
command = KeysightPowerSupplyScpiCommands.READ_VOLTAGE_SLEW_RATE_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
double voltageSlewRate = 0.0;
Double.TryParse(rsp, out voltageSlewRate);
if (voltageSlewRate != PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_)
throw new Exception($"Unable to set Voltage Slew Rate. Expected Voltage Slew Rate: {PowerModuleInfoDict[ActivePowerModule].voltageSlewRate_}. Actual: {voltageSlewRate}");
}
}
}
/// <summary>
/// Get error code
/// </summary>
/// <param name=""></param>
/// <returns></returns>
protected override string GetErrorCode(out int errorCode)
{
errorCode = 0;
string rtn = "";
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.READ_ERROR_CODE_CMD + "\n";
string rsp = SendCommandAndGetResponse(command);
string[] stringVec = rsp.Split(',');
Int32.TryParse(stringVec[0], out errorCode);
if (stringVec.Length > 1)
{
rtn = stringVec[1];
}
}
return rtn;
}
/// <summary>
/// Read voltage
/// </summary>
/// <param></param>
/// <returns></returns>
protected override double ReadVoltage()
{
double val = 0.0;
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.READ_VOLTAGE_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
Double.TryParse(rsp, out val);
}
return val;
}
/// <summary>
/// Read current
/// </summary>
/// <param></param>
/// <returns></returns>
protected override double ReadCurrent()
{
double val = 0.0;
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.READ_CURRENT_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
Double.TryParse(rsp, out val);
}
return val;
}
/// <summary>
/// Read protection status
/// </summary>
/// <param></param>
/// <returns></returns>
protected override int ReadProtectionStatus()
{
int val = -1;
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.READ_PROTECTION_STATUS_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
Int32.TryParse(rsp, out val);
}
return val;
}
/// <summary>
/// Determine if module's output is on
/// </summary>
/// <param></param>
/// <returns></returns>
protected override bool IsOutputOn()
{
bool isOn = false;
lock (SyncObj)
{
string command = KeysightPowerSupplyScpiCommands.READ_OUTPUT_STATUS_CMD + " " + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
string rsp = SendCommandAndGetResponse(command);
int status = -1;
Int32.TryParse(rsp, out status);
if (status == 1)
{
isOn = true;
}
}
return isOn;
}
/// <summary>
/// When modules are grouped, they act as one module
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void GroupModules(List<string> moduleList, out bool systemRebooted)
{
// 1. Group the channels
string groupListToDefine = "(@";
string groupListToQuery = "";
string moduleNumber = "";
systemRebooted = false;
for (int i = 0; i < moduleList.Count; i++)
{
moduleNumber = _config.ReadValue(moduleList[i], PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
groupListToDefine += moduleNumber;
groupListToQuery += moduleNumber;
// add a ',' if this is not the final element in the list
if (i < moduleList.Count() - 1)
{
groupListToDefine += ",";
groupListToQuery += ",";
}
else
{
groupListToDefine += ")";
}
}
groupListToQuery = "\"" + groupListToQuery + "\"\n";
// see if channels are grouped
string queryGroupCommand = KeysightPowerSupplyScpiCommands.QUERY_GROUP_CHANNELS + "\n";
for (int i = 1; i <= 2; i++)
{
string respStr = SendCommandAndGetResponse(queryGroupCommand);
// if modules are not grouped
if (respStr != groupListToQuery)
{
groupListToDefine += "\n";
string groupCommand = KeysightPowerSupplyScpiCommands.SET_GROUP_DEFINE_CMD + " " + groupListToDefine;
SendCommand(groupCommand);
}
else if (i == 1)
{
break;
}
else
{
string command = KeysightPowerSupplyScpiCommands.REBOOT_CMD + "\n";
// after grouping the modules, need to reboot system for it to take effect
SendCommand(command);
// wait 20 seconds for reboot
Thread.Sleep(20000);
systemRebooted = true;
}
}
}
/// <summary>
/// When modules are coupled, they turned on and off in unison
/// i.e turn on/off one module, all other coupled modules will automatically turn on/off
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void CoupleModules(List<string> moduleList)
{
string coupleListToDefine = "";
string moduleNumber = "";
for (int i = 0; i < moduleList.Count(); i++)
{
moduleNumber = _config.ReadValue(moduleList[i], PowerSupplyConfigIni.INDEX.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
coupleListToDefine += moduleNumber;
// add a ',' if this is not the final element in the list
if (i < moduleList.Count() - 1)
{
coupleListToDefine += ",";
}
}
coupleListToDefine += "\n";
// see if channels are grouped
string queryCoupleChannelCommand = KeysightPowerSupplyScpiCommands.QUERY_COUPLE_CHANNELS + "\n";
for (int i = 1; i <= 2; i++)
{
string respStr = SendCommandAndGetResponse(queryCoupleChannelCommand);
string queryCoupleStateCommand = KeysightPowerSupplyScpiCommands.QUERY_COUPLE_STATE + "\n";
string respStr2 = SendCommandAndGetResponse(queryCoupleStateCommand);
if (coupleListToDefine != respStr || respStr2 == "0\n")
{
// send command to couple modules
string command = KeysightPowerSupplyScpiCommands.SET_COUPLE_CHANNELS_CMD + " " + coupleListToDefine;
SendCommand(command);
// turn coupling on
command = KeysightPowerSupplyScpiCommands.SET_COUPLE_ON_CMD + "\n";
SendCommand(command);
// output protection on
command = KeysightPowerSupplyScpiCommands.SET_COUPLE_OUTPUT_PROTECT_ON_CMD + "\n";
SendCommand(command);
}
else if (i == 1)
break;
}
}
/// <summary>
/// Reset Power Supply System
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void ResetPowerSupplySystem()
{
// send the command
string command = KeysightPowerSupplyScpiCommands.RESET_CMD + "\n";
SendCommand(command);
}
/// <summary>
/// Send command
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private void SendCommand(string command)
{
lock (SyncObj)
{
byte[] msg = Encoding.ASCII.GetBytes(command);
_tcpClient.Write(msg, (uint)msg.Length);
}
}
/// <summary>
/// Send command and get response
/// </summary>
/// <param name=""></param>
/// <returns></returns>
private string SendCommandAndGetResponse(string command)
{
lock (SyncObj)
{
byte[] readBuf = new byte[100];
_tcpClient.SetReadTimeout(2000);
int bytesRec = 0;
SendCommand(command);
try
{
bytesRec = (int)_tcpClient.Read(ref readBuf);
}
catch (SocketException ex)
{
throw new Exception("SocketException Error Code: " + ex.ErrorCode + $" ({((SocketError)ex.ErrorCode).ToString()})");
}
return Encoding.ASCII.GetString(readBuf, 0, bytesRec);
}
}
}
}

View File

@@ -1,131 +0,0 @@
// 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 Raytheon.Common;
using Raytheon.Instruments.EthernetSockets;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace Raytheon.Instruments.PowerSupplies
{
/// <summary>
/// Class for controlling a Keysightt N6700 Series Power Supply System
/// </summary>
public class KeysightN67xxPowerSupply : PowerSupply
{
private string _iniFilePath;
private static ILogger _logger;
private readonly IConfigurationManager _configurationManager;
private readonly IConfiguration _configuration;
/// <summary>
/// Constructor
/// </summary>
public KeysightN67xxPowerSupply(string deviceInstanceName, IConfigurationManager configurationManager, ILogger logger)
{
Name = deviceInstanceName;
_logger = logger;
_configurationManager = configurationManager;
// configuration obtained from [deviceInstanceName].xml file
_configuration = _configurationManager.GetConfiguration(Name);
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
_iniFilePath = Path.Combine(assemblyFolder, _configuration.GetConfigurationValue(deviceInstanceName, PowerSupplyConfigXml.INI_FILE_PATH.ToString(), $".\\{Raytheon.Common.GeneralConstants.InstrumentConfigFolder}\\{deviceInstanceName}.ini"));
}
/// <summary>
/// Perform shutdown
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override void Shutdown()
{
}
/// <summary>
/// Perform reset
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override void Reset()
{
}
/// <summary>
/// Clear errors
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override bool ClearErrors()
{
return true;
}
/// <summary>
/// Implement Indexer in order to access a specific power module
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override PowerSupplyModule this[object powerDeviceId]
{
get
{
string powerDeviceName = String.Empty;
if (powerDeviceId != null && (powerDeviceId.GetType().IsEnum || powerDeviceId is string))
{
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(powerDeviceName);
return _powerSupplyModule;
}
}
/// <summary>
/// Group or couple modules as specified in config file
/// Gather information for each power module from config file
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override void Initialize()
{
_powerSupplyModule = new KeysightN67xxPowerModule(_iniFilePath, Name);
}
}
}

View File

@@ -1,80 +0,0 @@
/*-------------------------------------------------------------------------
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Raytheon.Instruments.PowerSupplies
{
public static class KeysightPowerSupplyScpiCommands
{
public static string CLEAR_CMD = "*CLS";
public static string RESET_CMD = "*RST";
public static string SELFTEST_CMD = "*TST?";
public static string READ_ERROR_CODE_CMD = "SYST:ERR?";
public static string REBOOT_CMD = "SYST:REB";
// panel disable/enable commands
public static string SET_FRONTPANEL_DISABLE_CMD = "SYST:COMM:RLST RWL";
public static string SET_FRONTPANEL_ENABLE_CMD = "SYST:COMM:RLST REM";
// watchdog commands
public static string SET_WATCHDOGDELAY_CMD = "OUTP:PROT:WDOG:DEL";
public static string SET_WATCHDOGON_CMD = "OUTP:PROT:WDOG ON";
public static string SET_WATCHDOGOFF_CMD = "OUTP:PROT:WDOG OFF";
// coupling commands
public static string SET_COUPLE_CHANNELS_CMD = "OUTP:COUP:CHAN";
public static string SET_COUPLE_ON_CMD = "OUTP:COUP ON";
public static string SET_COUPLE_OUTPUT_PROTECT_ON_CMD = "OUTP:PROT:COUP ON";
public static string QUERY_COUPLE_CHANNELS = "OUTP:COUP:CHAN?";
public static string QUERY_COUPLE_STATE = "OUTP:COUP?";
// Grouping Commands
public static string SET_GROUP_DEFINE_CMD = "SYST:GRO:DEF";
public static string UNGROUP_ALL_CHANNELS_CMD = "SYST:GRO:DEL:ALL";
public static string QUERY_GROUP_CHANNELS = "SYST:GRO:CAT?";
// current commands
public static string SET_OCP_CMD = "CURR:LEV";
public static string SET_OCP_ON_CMD = "CURR:PROT:STAT ON";
public static string READ_CURRENT_CMD = "MEAS:CURR?";
public static string READ_OCP_CMD = "CURR:LEV?";
// voltage commands
public static string SET_OVP_CMD = "VOLT:PROT";
public static string SET_VOLTAGE_SLEW_RATE_CMD = "VOLT:SLEW";
public static string SET_VOLTAGE_SETPOINT_CMD = "VOLT:LEV";
public static string SET_CONSTANT_VOLTAGE_CMD = "STAT:OPER:ENAB 1";
public static string READ_VOLTAGE_CMD = "MEAS:VOLT?";
public static string READ_VOLTAGE_SETPOINT_CMD = "VOLT?";
public static string READ_OVP_CMD = "VOLT:PROT?";
public static string READ_VOLTAGE_SLEW_RATE_CMD = "VOLT:SLEW?";
// set output commands
public static string SET_OUTPUT_DISABLE_CMD = "OUTP OFF";
public static string SET_OUTPUT_ENABLE_CMD = "OUTP ON";
//query status
public static string READ_OUTPUT_STATUS_CMD = "OUTP?";
public static string READ_ERROR_STATUS_CMD = "SYST:ERR?";
public static string READ_PROTECTION_STATUS_CMD = "STAT:QUES:COND?";
}
}

View File

@@ -1,252 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Raytheon.Instruments.PowerSupplies
{
/// <summary>
/// Class to simulate any power supply module
/// </summary>
class PowerSupplyModuleSim : PowerSupplyModule
{
private List<string> _groupedModules;
private List<string> _coupledModules;
private string _powerSupplySystemName;
private bool _frontPanelEnabled = true;
private ILogger _logger;
/// <summary>
/// Constructor
/// </summary>
public PowerSupplyModuleSim(string iniFilePath, string powerSupplySystemName)
{
_logger = LogManager.GetCurrentClassLogger();
_powerSupplySystemName = powerSupplySystemName;
IConfigurationFile config = new ConfigurationFile(iniFilePath);
string moduleDef = config.ReadValue(PowerSupplyConfigIni.GENERAL.ToString(), PowerSupplyConfigIni.MODULE_DEFINITION.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue);
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);
PowerModules = moduleDef.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_coupledModules = coupledModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
_groupedModules = groupedModules.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (_groupedModules.Count() > 1)
{
PowerModules.Clear();
// since modules are grouped, we pick the first module as the representative module
PowerModules.Add(_groupedModules[0]);
}
// build the power module map
string moduleIndex = "";
double ovp = 0.0;
double ocp = 0.0;
double voltageSetPoint = 0.0;
double voltageSlewRate = 0.0;
double minVoltage = 0.0;
double maxVoltage = 0.0;
double minCurrent = 0.0;
double maxCurrent = 0.0;
for (int i = 0; i < PowerModules.Count(); 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);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.OVP.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out ovp);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SETPOINT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSetPoint);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.VOLTAGE_SLEW_RATE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out voltageSlewRate);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minVoltage);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_VOLTAGE.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxVoltage);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MIN_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out minCurrent);
Double.TryParse(config.ReadValue(moduleName, PowerSupplyConfigIni.MAX_CURRENT.ToString(), Raytheon.Common.GeneralConstants.DefaultConfigValue), out maxCurrent);
PowerModuleInfoDict[moduleName] = new Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo(moduleIndex, ocp, ovp, voltageSetPoint, voltageSlewRate, minVoltage, maxVoltage, minCurrent, maxCurrent);
}
}
/// <summary>
/// Enable or Disable Front Panel
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override bool DisplayEnabled
{
set { SemObj?.Release(); }
}
/// <summary>
/// Enable or disable Front Panel
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override bool FrontPanelEnabled
{
set {_frontPanelEnabled = value; SemObj?.Release(); }
}
/// <summary>
/// Turn on power module's output
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override void On()
{
try
{
lock (SyncObj)
{
CheckActivePowerModuleValidity();
if (_coupledModules.Contains(ActivePowerModule))
{
foreach (string module in _coupledModules)
{
PowerModuleInfoDict[module].isOn_ = true;
}
}
else
PowerModuleInfoDict[ActivePowerModule].isOn_ = true;
}
}
finally { SemObj?.Release(); }
}
/// <summary>
/// Turn off power module's output
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public override void Off()
{
try
{
lock (SyncObj)
{
CheckActivePowerModuleValidity();
if (_coupledModules.Contains(ActivePowerModule))
{
foreach (string module in _coupledModules)
{
PowerModuleInfoDict[module].isOn_ = false;
}
}
else
PowerModuleInfoDict[ActivePowerModule].isOn_ = false;
}
}
finally { SemObj?.Release(); };
}
/// <summary>
/// Perform self test
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override SelfTestResult PerformSelfTest()
{
try
{
lock (SyncObj)
{
SelfTestResult = SelfTestResult.Pass;
}
}
finally { SemObj?.Release(); };
return SelfTestResult;
}
/// <summary>
/// Read voltage
/// </summary>
/// <param></param>
/// <returns></returns>
protected override double ReadVoltage()
{
double val = 0.0;
lock (SyncObj)
{
if (PowerModuleInfoDict[ActivePowerModule].isOn_)
val = PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_;
}
return val;
}
/// <summary>
/// Read current
/// </summary>
/// <param></param>
/// <returns></returns>
protected override double ReadCurrent()
{
double val = 0.0;
lock (SyncObj)
{
if (PowerModuleInfoDict[ActivePowerModule].isOn_)
val = (PowerModuleInfoDict[ActivePowerModule].currentLowerLimit_ + PowerModuleInfoDict[ActivePowerModule].currentUpperLimit_) / 2.0;
}
return val;
}
/// <summary>
/// Read protection status
/// </summary>
/// <param></param>
/// <returns></returns>
protected override int ReadProtectionStatus()
{
lock (SyncObj)
{
return 0;
}
}
/// <summary>
/// Get error code
/// </summary>
/// <param name=""></param>
/// <returns></returns>
protected override string GetErrorCode(out int errorCode)
{
lock (SyncObj)
{
errorCode = 0;
return "";
}
}
}
}

View File

@@ -1,125 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Raytheon.Instruments.PowerSupplies
{
/// <summary>
/// Class to simulate any power supply system
/// </summary>
public class PowerSupplySim : PowerSupply
{
private string _iniFilePath;
private static ILogger _logger;
private readonly IConfigurationManager _configurationManager;
private readonly IConfiguration _configuration;
/// <summary>
/// Constructor
/// </summary>
public PowerSupplySim(string deviceInstanceName, IConfigurationManager configurationManager, ILogger logger)
{
Name = deviceInstanceName;
_logger = logger;
_configurationManager = configurationManager;
_configuration = _configurationManager.GetConfiguration(Name);
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
_iniFilePath = Path.Combine(assemblyFolder,_configuration.GetConfigurationValue(deviceInstanceName, "IniFilePath", $".\\{Raytheon.Common.GeneralConstants.InstrumentConfigFolder}\\{deviceInstanceName}.ini"));
}
/// <summary>
/// Perform shutdown
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override void Shutdown()
{
}
/// <summary>
/// Perform reset
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override void Reset()
{
}
/// <summary>
/// Clear errors
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override bool ClearErrors()
{
return true;
}
/// <summary>
/// Group or couple modules as specified in config file
/// Gather information for each power module from config file
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override void Initialize()
{
_powerSupplyModule = new PowerSupplyModuleSim(_iniFilePath, Name);
}
/// <summary>
/// Implement Indexer to obtain a power module
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public override PowerSupplyModule this[object powerDeviceId]
{
get
{
string powerDeviceName = String.Empty;
if (powerDeviceId != null && (powerDeviceId.GetType().IsEnum || powerDeviceId is string))
{
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(powerDeviceName);
return _powerSupplyModule;
}
}
}
}

View File

@@ -1,41 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.PowerSupplies.Simulation</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<Product>Power Supply Simulation</Product>
<Description>Power Supply Simulation</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Company>Raytheon Technologies</Company>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<!-- Dynamic Versioning (Suitable for Release) -->
<!-- <Version>$(Version)$(Suffix)</Version> -->
<!-- Static Versioning (Suitable for Development) -->
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0" />
<PackageReference Include="Raytheon.Configuration" Version="2.6.1" />
<PackageReference Include="Raytheon.Configuration.Contracts" Version="2.3.0" />
<!--
<PackageReference Include="Raytheon.Instruments.PowerSupply.Contracts" Version="1.1.0" />
-->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Interfaces\PowerSupply\PowerSupply.Contracts.csproj" />
<ProjectReference Include="..\..\..\Raytheon.Common\Raytheon.Common.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,114 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Reflection;
namespace Raytheon.Instruments.PowerSupplies
{
[ExportInstrumentFactory(ModelNumber = "PowerSupplySimulationFactory")]
public class PowerSupplySimulationFactory : IInstrumentFactory
{
/// <summary>
/// The supported interfaces
/// </summary>
private readonly List<Type> _supportedInterfaces = new List<Type>();
private static ILogger _logger;
private readonly IConfigurationManager _configurationManager;
private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService";
private static string DefaultPath;
public PowerSupplySimulationFactory(string defaultConfigPath = DefaultConfigPath)
: this(null, defaultConfigPath)
{
}
/// <summary>
/// COECommDeviceInstrumentFactory injection constructor
/// </summary>
/// <param name="configManager"></param>
/// <param name="simEngine"></param>
/// <param name="logger"></param>
[ImportingConstructor]
public PowerSupplySimulationFactory([Import(AllowDefault = false)] IConfigurationManager configManager,
[Import(AllowDefault = true)] string defaultConfigPath = null)
{
DefaultPath = defaultConfigPath;
_logger = LogManager.GetCurrentClassLogger();
if (NLog.LogManager.Configuration == null)
{
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
}
_configurationManager = configManager ?? GetConfigurationManager();
_supportedInterfaces.Add(typeof(PowerSupply));
}
/// <summary>
/// Gets the instrument
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public IInstrument GetInstrument(string name)
{
return null;
}
/// <summary>
/// Gets the instrument
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public object GetInstrument(string name, bool simulateHw)
{
try
{
return new PowerSupplySim(name, _configurationManager, _logger);
}
catch (Exception ex)
{
_logger.Error(ex, $"Unable to construct {name} instrument instance");
return null;
}
}
/// <summary>
/// Gets supported interfaces
/// </summary>
/// <returns></returns>
public ICollection<Type> GetSupportedInterfaces()
{
return _supportedInterfaces.ToArray();
}
/// <summary>
/// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
/// </summary>
/// <returns></returns>
private static IConfigurationManager GetConfigurationManager()
{
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
}
}
}

View File

@@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.CommDevice.Contracts</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<Description>ICommDevice interface definition</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Raytheon Technologies</Company>
<Product>HAL</Product>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Raytheon.Communication.Rpc.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Communication.Ums.Core.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Communication.Ums.Rpc.Attributes" Version="1.*" />
<PackageReference Include="Raytheon.Instruments.Contracts" Version="1.5.0" />
</ItemGroup>
</Project>

View File

@@ -1,63 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Communication;
namespace Raytheon.Instruments
{
/// <summary>
/// An interface to any device that you can write and read to/from
/// </summary>
public interface ICommDevice : IInstrument
{
/// <summary>
/// Close the communication interface
/// </summary>
[UmsCommand("ICommDevice.Close")]
void Close();
/// <summary>
/// Open the communication interface
/// </summary>
[UmsCommand("ICommDevice.Open")]
void Open();
/// <summary>
/// Reads data from a communication device
/// </summary>
/// <param name="dataRead"></param>
/// <returns>number of bytes read</returns>
[UmsCommand("ICommDevice.Read")]
uint Read(ref byte[] dataRead);
/// <summary>
/// Set the timeout on a read
/// </summary>
/// <param name="timeout"></param>
[UmsCommand("ICommDevice.SetReadTimeout")]
void SetReadTimeout(uint timeout);
/// <summary>
/// Writes data to a communication device
/// </summary>
/// <param name="data"></param>
/// <param name="numBytesToWrite"></param>
/// <returns>the number of bytes written</returns>
[UmsCommand("ICommDevice.Write")]
uint Write(byte[] data, uint numBytesToWrite);
}
}

View File

@@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.InstrumentManager.Contracts</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<Company>Raytheon Technologies</Company>
<Product>Raytheon Configuration</Product>
<Description>Instrument Manager Interface</Description>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.7.1.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Raytheon.Communication.Rpc.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Communication.Ums.Core.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Communication.Ums.Rpc.Attributes" Version="1.*" />
<PackageReference Include="Raytheon.Instruments.Contracts" Version="1.5.0" />
</ItemGroup>
</Project>

View File

@@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Instruments.PowerSupply.Contracts</AssemblyName>
<RootNamespace>Raytheon.Instruments</RootNamespace>
<Description>PowerSupply Interface</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Raytheon Technologies</Company>
<Product>HAL</Product>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<Version>1.1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Raytheon.Communication.Rpc.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Communication.Ums.Core.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Communication.Ums.Rpc.Attributes" Version="1.*" />
<PackageReference Include="Raytheon.Instruments.Contracts" Version="1.5.0" />
</ItemGroup>
</Project>

View File

@@ -1,63 +0,0 @@
/*-------------------------------------------------------------------------
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Raytheon.Instruments
{
/// <summary>
/// Base class that defines interface for power supply systems
/// </summary>
public abstract class PowerSupply : Instrument
{
protected PowerSupplyModule _powerSupplyModule;
/// <summary>
/// Implement Indexer in order to access a specific power module
/// </summary>
/// <param></param>
/// <returns></returns>
public virtual PowerSupplyModule this[object i]
{
get { return null; }
}
/// <summary>
/// Get power supply module info dictionary
/// </summary>
/// <param></param>
/// <returns></returns>
public Dictionary<string, PowerSupplies.PowerSupplyModuleInfo> GetPowerSupplyModuleInfoDict()
{
return _powerSupplyModule.PowerModuleInfoDict;
}
/// <summary>
/// Get power supply module names
/// </summary>
/// <param></param>
/// <returns></returns>
public List<string> GetPowerSupplyModuleNames()
{
return _powerSupplyModule.PowerModules;
}
}
}

View File

@@ -1,207 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Instruments.PowerSupplies;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Raytheon.Instruments
{
/// <summary>
/// Base class that defines interface for power supply modules
/// </summary>
public abstract class PowerSupplyModule
{
protected Semaphore SemObj = new System.Threading.Semaphore(initialCount: 1, maximumCount: 1);
protected object SyncObj = new object();
protected string ActivePowerModule;
public List<string> PowerModules { get; protected set; }
public Dictionary<string, PowerSupplyModuleInfo> PowerModuleInfoDict { get; protected set; }
/// <summary>
/// Constructor
/// </summary>
public PowerSupplyModule()
{
PowerModuleInfoDict = new Dictionary<string, PowerSupplyModuleInfo>();
}
/// <summary>
/// DisplayEnabled - some instruments will be no-op, but likely needed on all
/// will shut down any display on the hardware to hide any
/// classified information if visible
/// </summary>
public virtual bool DisplayEnabled
{
get;
set;
}
/// <summary>
/// FrontPanelEnabled - some instruments will be no-op, but likely needed on all
/// has the ability to disable any panel buttons, so that
/// the hardware may not be changed by human touch
/// </summary>
public virtual bool FrontPanelEnabled
{
private get;
set;
}
/// <summary>
/// SelfTestResult - end result of the hardware self test performed
/// </summary>
public SelfTestResult SelfTestResult
{
get;
set;
}
/// <summary>
/// PerformSelfTest - do a hardware self test
/// </summary>
/// <returns>result of the self test</returns>
public abstract SelfTestResult PerformSelfTest();
/// <summary>
/// Set active module
/// </summary>
/// <param></param>
/// <returns></returns>
public void SetActivePowerModule(string activePowerModule)
{
ActivePowerModule = activePowerModule;
}
/// <summary>
/// Check if active module is valid
/// </summary>
/// <param></param>
/// <returns></returns>
protected void CheckActivePowerModuleValidity()
{
if (ActivePowerModule == null || ActivePowerModule.Length == 0)
throw new Exception($"{nameof(ActivePowerModule)} is not set");
if (!PowerModuleInfoDict.ContainsKey(ActivePowerModule))
throw new Exception($"Invalid power module: {ActivePowerModule}");
}
/// <summary>
/// Return semaphore
/// </summary>
/// <param></param>
/// <returns></returns>
public Semaphore GetSemphamore() { return SemObj; }
/// <summary>
/// Turn on power module's output
/// </summary>
/// <param></param>
/// <returns></returns>
public abstract void On();
/// <summary>
/// Turn off power module's output
/// </summary>
/// <param></param>
/// <returns></returns>
public abstract void Off();
/// <summary>
/// Determine if module's output is on
/// </summary>
/// <param></param>
/// <returns></returns>
protected virtual bool IsOutputOn()
{
bool isOn = false;
lock (SyncObj)
{
CheckActivePowerModuleValidity();
isOn = PowerModuleInfoDict[ActivePowerModule].isOn_;
}
return isOn;
}
/// <summary>
/// Read power supply module's data all at once
/// </summary>
/// <param></param>
/// <returns></returns>
public virtual void ReadPowerSupplyData(out double volts, out double current, out double voltSetpoint, out bool isOn, out int faultStatus)
{
volts = 0.0;
current = 0.0;
voltSetpoint = 0.0;
isOn = false;
faultStatus = 0;
try
{
lock (SyncObj)
{
CheckActivePowerModuleValidity();
volts = ReadVoltage();
current = ReadCurrent();
voltSetpoint = PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_;
isOn = IsOutputOn();
faultStatus = ReadProtectionStatus();
}
}
finally { SemObj?.Release(); };
}
/// <summary>
/// Read voltage
/// </summary>
/// <param></param>
/// <returns></returns>
protected abstract double ReadVoltage();
/// <summary>
/// Read current
/// </summary>
/// <param></param>
/// <returns></returns>
protected abstract double ReadCurrent();
/// <summary>
/// Read protection status
/// </summary>
/// <param></param>
/// <returns></returns>
protected abstract int ReadProtectionStatus();
/// <summary>
/// Get error code
/// </summary>
/// <param></param>
/// <returns></returns>
protected abstract string GetErrorCode(out int errorCode);
}
}

View File

@@ -1,143 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using Raytheon.Instruments;
using System;
using System.Collections.Generic;
using NLog;
namespace Raytheon
{
/// <summary>
/// Class for controlling all power supplies
/// </summary>
public class PowerModuleMeasurementManager
{
#region PrivateClassMembers
/// <summary>
/// NLog logger
/// </summary>
private static NLog.ILogger _logger;
private PowerSupply _powerSupply;
private IConfigurationFile _powerOffAndSelfTestConfig;
#endregion
public bool FrontPanelEnabled
{
private get { return false; }
set
{
if (_powerSupply != null)
{
_powerSupply[null].FrontPanelEnabled = value;
}
}
}
/// <summary>
/// constructor
/// </summary>
/// <param></param>
public PowerModuleMeasurementManager(PowerSupply powerSupply, IConfigurationFile powerOffAndSelfTestConfig)
{
_logger = LogManager.GetCurrentClassLogger();
_powerSupply = powerSupply;
_powerOffAndSelfTestConfig = powerOffAndSelfTestConfig;
}
/// <summary>
/// The Finalizer
/// </summary>
~PowerModuleMeasurementManager()
{
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
}
/// <summary>
/// Initialize the instrument(s)
/// </summary>
public void Initialize()
{
_logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
}
/// <summary>
/// Shuts down manager, clears resources
/// </summary>
public void Shutdown()
{
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
_powerSupply.Shutdown();
}
/// <summary>
/// Read various power supply data
/// </summary>
public void ReadPowerSupplyData(object module, out double voltage, out double current, out double voltageSetPoint, out bool isOn, out int faultStatus)
{
_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>
/// <param name="moduleName">The name of the module to enable.</param>
public void OutputEnable(object module)
{
_powerSupply[module].On();
}
/// <summary>
/// Disable the output of the power supply.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public void OutputDisable(object module)
{
_powerSupply[module].ReadPowerSupplyData(out double voltage, out double current, out double voltageSetPoint, out bool isOn, out int faultStatus);
if (isOn)
{
_powerSupply[module].Off();
// save the time of this power off to file
MeasurementManager.PowerSupply.Util.SaveTime(_powerSupply.Name, DateTime.Now.ToString(), null, _powerOffAndSelfTestConfig);
}
}
}
}

View File

@@ -1,223 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using Raytheon.Instruments;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Raytheon
{
/// <summary>
/// Class for controlling all power supplies
/// </summary>
public class PowerSupplyMeasurementManager
{
#region PrivateClassMembers
/// <summary>
/// NLog logger
/// </summary>
private static NLog.ILogger _logger;
private IConfigurationFile _powerOffAndSelfTestConfig;
private IInstrumentManager _instrumentManager;
private Dictionary<string, PowerModuleMeasurementManager> _powerSystemNameToPowerModuleMeasurementManagerDict = new Dictionary<string, PowerModuleMeasurementManager>();
string _powerSystemWithFailedSelfTest = String.Empty;
#endregion
/// <summary>
/// constructor
/// </summary>
/// <param name="stePowerSupplyInstanceName">the name specified in the Instruments.xml file</param>
public PowerSupplyMeasurementManager(IInstrumentManager instrumentManager, string powerSupplySelfTestLogFile)
{
_logger = LogManager.GetCurrentClassLogger();
_powerOffAndSelfTestConfig = new ConfigurationFile(powerSupplySelfTestLogFile);
_instrumentManager = instrumentManager;
}
/// <summary>
/// The Finalizer
/// </summary>
~PowerSupplyMeasurementManager()
{
_logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
}
/// <summary>
/// Implement Indexer to obtain a powermodulemeasurementmanager
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public PowerModuleMeasurementManager this[object powerSystemId]
{
get
{
string powerSystemName;
if (powerSystemId.GetType().IsEnum || powerSystemId is string)
{
powerSystemName = powerSystemId.ToString();
}
else
{
throw new ArgumentException($"{nameof(powerSystemId)} must be an enumerated or string type");
}
if (!_powerSystemNameToPowerModuleMeasurementManagerDict.ContainsKey(powerSystemName))
{
throw new Exception($"Invalid power supply system: {powerSystemName}");
}
return _powerSystemNameToPowerModuleMeasurementManagerDict[powerSystemName];
}
}
/// <summary>
/// Initialize the instrument(s)
/// </summary>
public void Initialize()
{
_logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
PerformSelfTest();
if (_powerSystemWithFailedSelfTest != String.Empty)
{
throw new Exception($"{_powerSystemWithFailedSelfTest}'s self-test failed.");
}
}
/// <summary>
/// Perform self test on power supply system
/// Self test for each power system takes a while, so we don't want to run self test every time we initialize the power system
/// So we only want to run self test under 2 conditions:
/// 1. Certain time has elapsed since last power off
/// 2. Certain time has elapsed since last self test run ( in the absence of power off time)
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
private async void PerformSelfTest()
{
_logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
string errorMsg = String.Empty;
Dictionary<string, Task<SelfTestResult>> powerSystemToSelfTestTaskDict = new Dictionary<string, Task<SelfTestResult>>();
bool allSelfTestsPassed = true;
ICollection<object> psList = _instrumentManager.GetInstruments(typeof(PowerSupply));
foreach (PowerSupply ps in psList)
{
ps.Initialize();
// perform self test on power system
Task<SelfTestResult> task = PerformSelfTestTask(ps);
powerSystemToSelfTestTaskDict[ps.Name] = task;
}
foreach (var item in powerSystemToSelfTestTaskDict)
{
// wait for self test on power system to finish
SelfTestResult result = await item.Value;
if (result == SelfTestResult.Fail && String.IsNullOrEmpty(_powerSystemWithFailedSelfTest))
{
allSelfTestsPassed = false;
_powerSystemWithFailedSelfTest = item.Key;
}
}
if (allSelfTestsPassed)
{
foreach (PowerSupply ps in psList)
{
_powerSystemNameToPowerModuleMeasurementManagerDict[ps.Name] = new PowerModuleMeasurementManager(ps, _powerOffAndSelfTestConfig);
}
}
}
/// <summary>
/// Perform self test on power supply system
/// Self test for each power system takes a while, so we don't want to run self test every time we initialize the power system
/// So we only want to run self test under 2 conditions:
/// 1. Certain time has elapsed since last power off
/// 2. Certain time has elapsed since last self test run ( in the absence of power off time)
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
private Task<SelfTestResult> PerformSelfTestTask(PowerSupply ps)
{
SelfTestResult result = SelfTestResult.Pass;
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {ps.Name} is running...");
try
{
bool performSelfTest = false;
const int HOURS_ELAPSED = 2;
string lastSaveTime = MeasurementManager.PowerSupply.Util.GetLastSavedTime(ps.Name, _powerOffAndSelfTestConfig);
if (DateTime.TryParse(lastSaveTime, out DateTime dt))
{
// if this power supply system has been turn off for a certain number of hours, then we want to perform self test on it
if (DateTime.Now.Subtract(dt).TotalHours >= HOURS_ELAPSED)
{
performSelfTest = true;
}
}
else { performSelfTest = true; }
if (performSelfTest)
{
_logger?.Info($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() executing self-test for {ps.Name}...");
result = ps[null].PerformSelfTest();
if (result == SelfTestResult.Pass)
{
// save the time of this self test to file
MeasurementManager.PowerSupply.Util.SaveTime(ps.Name, null, DateTime.Now.ToString(), _powerOffAndSelfTestConfig);
}
}
else
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() skipping self-test for {ps.Name}...");
}
catch (Exception ex)
{
_logger?.Error(ex.Message + "\n" + ex.StackTrace);
}
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() for {ps.Name} is exiting...");
return Task.FromResult(result);
}
}
}

View File

@@ -1,38 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.InstrumentManagers.PowerSupplyManager</AssemblyName>
<RootNamespace>Raytheon.InstrumentManagers</RootNamespace>
<Product>Power Supply Manager Implementation</Product>
<Description>Provide access to the actual power supplies</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Company>Raytheon Technologies</Company>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<!-- Dynamic Versioning (Suitable for Release) -->
<!-- <Version>$(Version)$(Suffix)</Version> -->
<!-- Static Versioning (Suitable for Development) -->
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0" />
<PackageReference Include="Raytheon.Configuration" Version="2.6.1" />
<PackageReference Include="Raytheon.Configuration.Contracts" Version="2.3.0" />
<PackageReference Include="Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager" Version="1.4.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Interfaces\PowerSupply\PowerSupply.Contracts.csproj" />
<ProjectReference Include="..\..\Raytheon.Common\Raytheon.Common.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,64 +0,0 @@
/*-------------------------------------------------------------------------
// 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 System;
using System.Collections;
using System.IO;
using System.Xml.Serialization;
namespace Raytheon
{
/// <summary>
/// Serialiable class to store self test and power off time to XML
/// and restore info from XML to this class
/// </summary>
[Serializable]
public class PowerSupplySelfTestTime
{
[XmlAttribute("power_system")]
public string _powerSystem { get; set; }
// date and time of last power off of a power module
[XmlAttribute("power_off_time")]
public string _powerOffTime { get; set; }
// date and time of last successful self test
[XmlAttribute("self_test_time")]
public string _selfTestTime { get; set; }
/// <summary>
/// constructor
/// </summary>
public PowerSupplySelfTestTime()
{
_powerOffTime = Raytheon.Common.GeneralConstants.DefaultConfigValue;
_powerSystem = Raytheon.Common.GeneralConstants.DefaultConfigValue;
_selfTestTime = Raytheon.Common.GeneralConstants.DefaultConfigValue;
}
/// <summary>
/// constructor
/// </summary>
public PowerSupplySelfTestTime(string powerSystem, string powerOffTime, string selfTestTime)
{
_powerOffTime = powerOffTime;
_powerSystem = powerSystem;
_selfTestTime = selfTestTime;
}
}
}

View File

@@ -1,115 +0,0 @@
/*-------------------------------------------------------------------------
// 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 Raytheon.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Raytheon.MeasurementManager.PowerSupply
{
/// <summary>
/// Define non-specific constants
/// </summary>
internal static class Util
{
/// <summary>
/// Read from the XML file the time for this power system
/// If time of power off is available, we return this time
/// If time of last self test run is available, we return this time
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static string GetLastSavedTime(string powerSystem, IConfigurationFile powerOffAndSelfTestConfig)
{
string savedTime = "";
string powerOffTime = "";
string selfTestTime = "";
List<PowerSupplySelfTestTime> powerOffEntryListTemp = new List<PowerSupplySelfTestTime>();
List<PowerSupplySelfTestTime> powerOffEntryList = powerOffAndSelfTestConfig.ReadList<PowerSupplySelfTestTime>(nameof(PowerSupplySelfTestTime), nameof(PowerSupplySelfTestTime), powerOffEntryListTemp);
foreach (var powerOffEntry in powerOffEntryList)
{
if (powerOffEntry._powerSystem == powerSystem)
{
if (DateTime.TryParse(powerOffEntry._powerOffTime, out DateTime dt))
powerOffTime = powerOffEntry._powerOffTime;
if (DateTime.TryParse(powerOffEntry._selfTestTime, out dt))
selfTestTime = powerOffEntry._selfTestTime;
}
}
if (String.IsNullOrEmpty(powerOffTime))
savedTime = selfTestTime;
else if (String.IsNullOrEmpty(selfTestTime))
savedTime = powerOffTime;
else if (!String.IsNullOrEmpty(powerOffTime) && !String.IsNullOrEmpty(selfTestTime))
{
if (DateTime.TryParse(powerOffTime, out DateTime powerOffDt) && DateTime.TryParse(selfTestTime, out DateTime selfTestDt))
{
if (DateTime.Compare(powerOffDt, selfTestDt) == 1)
savedTime = powerOffTime;
else
savedTime = selfTestTime;
}
}
return savedTime;
}
/// <summary>
/// Save time of power off or self test event
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static void SaveTime(string powerSystem, string powerOffTime, string selfTestTime, IConfigurationFile powerOffAndSelfTestConfig)
{
List<PowerSupplySelfTestTime> powerOffEntryListTemp = new List<PowerSupplySelfTestTime>();
List<PowerSupplySelfTestTime> powerOffEntryList = powerOffAndSelfTestConfig.ReadList<PowerSupplySelfTestTime>(nameof(PowerSupplySelfTestTime), nameof(PowerSupplySelfTestTime), powerOffEntryListTemp);
var entry = powerOffEntryList.Find(b => b._powerSystem == powerSystem);
if (entry != null)
{
if (!string.IsNullOrEmpty(powerOffTime))
entry._powerOffTime = powerOffTime;
if (!string.IsNullOrEmpty(selfTestTime))
entry._selfTestTime = selfTestTime;
}
else
{
PowerSupplySelfTestTime data = new PowerSupplySelfTestTime(powerSystem, powerOffTime, selfTestTime);
if (string.IsNullOrEmpty(powerOffTime))
data._powerOffTime = Raytheon.Common.GeneralConstants.DefaultConfigValue;
if (string.IsNullOrEmpty(selfTestTime))
data._selfTestTime = Raytheon.Common.GeneralConstants.DefaultConfigValue;
powerOffEntryList.Add(data);
}
powerOffAndSelfTestConfig.WriteList(nameof(PowerSupplySelfTestTime), nameof(PowerSupplySelfTestTime), powerOffEntryList);
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,2 @@
Don't put anything in this folder.
This folder is meant for projects to publish their packages to.

20
Source/Nuget/readme.md Normal file
View File

@@ -0,0 +1,20 @@
# Introduction
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
# Getting Started
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
1. Installation process
2. Software dependencies
3. Latest releases
4. API references
# Build and Test
TODO: Describe and show how to build your code and run the tests.
# Contribute
TODO: Explain how other users and developers can contribute to make your code better.
If you want to learn more about creating good readme files then refer the following [guidelines](https://www.visualstudio.com/en-us/docs/git/create-a-readme). You can also seek inspiration from the below readme files:
- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
- [Chakra Core](https://github.com/Microsoft/ChakraCore)

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Year>$([System.DateTime]::get_now().ToString("yyyy"))</Year>
<Major>$(Year)</Major>
<Minor>$([System.DateTime]::get_now().ToString("MM"))</Minor>
<Build>$([System.DateTime]::get_now().ToString("dd"))</Build>
<Revision>$([MSBuild]::Divide($([System.DateTime]::get_Now().get_TimeOfDay().get_TotalMinutes()), 2).ToString('F0'))</Revision>
<Version>$(Major).$(Minor).$(Build).$(Revision)</Version>
<Suffix></Suffix>
</PropertyGroup>
<Target Name="DeleteStaleFiles" BeforeTargets="Build">
<ItemGroup>
<StaleFiles Include="$(OutDir)..*.nupkg" />
</ItemGroup>
<Message Text="Deleting Stale Files: @(StaleFiles, '%0A')" Condition="'@(StaleFiles-&gt;Count())' &gt; 0" />
<Delete Files="@(StaleFiles)" />
</Target>
<Target Name="PostBuild" AfterTargets="Pack">
<MakeDir Directories="$(SolutionDir)Nuget\SolutionPackages" Condition="!Exists('$(SolutionDir)\Nuget\SolutionPackages')" />
<Exec Command="dotnet nuget push --source &quot;SolutionLocalSource&quot; $(OutDir)..\*.nupkg" />
</Target>
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -15,22 +15,13 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using ProgramLib;
using NLog;
using Raytheon.Common;
using Raytheon.Instruments;
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;
using ProgramGui;
using ProgramGui.Model;
using ProgramGui.View;
using ProgramGui.ViewModel;
using System.Windows;
using Raytheon;
namespace ProgramLib
{
@@ -72,13 +63,13 @@ namespace ProgramLib
if (Program.Instance()._isUutPwrOn)
{
Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].OutputDisable(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V);
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputDisable("STE_PVM_5V");
// enable front panel
Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = true;
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.DisplayEnable("STE_POWER_SUPPLY_SYSTEM");
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Dispatcher.Invoke((Action)delegate
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Dispatcher.Invoke((Action)delegate
{
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Hide();
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Hide();
});
Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON].Reset();
@@ -112,7 +103,7 @@ namespace ProgramLib
Task.Factory.StartNew(() => PerformSttoTask());
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate
{
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Hide();
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Hide();
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].ShowDialog();
});
@@ -123,13 +114,13 @@ namespace ProgramLib
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate
{
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.MAIN].Show();
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Show();
});
Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].OutputEnable(ProgramLib.PowerSupplyConstants.POWER_DEVICE.STE_PVM_5V);
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.OutputEnable("STE_PVM_5V");
// disable front panel
Program.Instance().GetPowerSupplyMeasurementManager()[PowerSupplyConstants.POWER_DEVICE.STE_POWER_SUPPLY_SYSTEM].FrontPanelEnabled = false;
Program.Instance().MalMeasurementLibManager.PowerSupplyMeasurementManager.DisplayDisable("STE_POWER_SUPPLY_SYSTEM");
Program.Instance()._eventManager[EventManager.Events.UUT_POWER_OFF].Reset();
Program.Instance()._eventManager[EventManager.Events.UUT_POWER_ON].Set();
@@ -166,7 +157,7 @@ namespace ProgramLib
string measurementStatus = "PASSED";
ImpedanceCheckWindowViewModel.Images passFailImage = ImpedanceCheckWindowViewModel.Images.PASS_CHECK;
impedanceCheckWindow._viewModel.ClearData();
impedanceCheckWindow.ViewModel.ClearData();
int MAX_ITERATION = 15;
int cableNum = 17;
int cablePin1 = 5;
@@ -184,7 +175,7 @@ namespace ProgramLib
_sttoSuccess = false;
}
impedanceDataModel.PassFailImagePath = impedanceCheckWindow._viewModel._imageToResourcePathDict[passFailImage];
impedanceDataModel.PassFailImagePath = impedanceCheckWindow.ViewModel.ImageToResourcePathDict[passFailImage];
impedanceDataModel.Description = $"{measurementName} Measured {measurement} Range [0,50]";
if (Program.Instance()._testStandSeqContext != null)
@@ -192,7 +183,7 @@ namespace ProgramLib
Program.Instance()._testStandSeqContext.Step.AdditionalResults.CustomResults.Insert($"\"{measurementName}\"", $"\"Measured: {measurement++} Range [0,50] - {measurementStatus}\"");
}
impedanceCheckWindow._viewModel.AddData(impedanceDataModel);
impedanceCheckWindow.ViewModel.AddData(impedanceDataModel);
if (!_sttoSuccess)
{

View File

@@ -0,0 +1,37 @@
/*-------------------------------------------------------------------------
// 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 System;
using ProgramLib;
using Raytheon.Common;
namespace ProgramLib
{
internal abstract class BasicTest
{
protected abstract void CheckPrerequisite();
protected abstract void ExecuteTest();
public void RunTest()
{
CheckPrerequisite();
ExecuteTest();
}
}
}

View File

@@ -29,6 +29,7 @@ namespace ProgramLib
internal static class GeneralConstants
{
public const string ProgramConfigFilename = "config.ini";
public const string DefaultConfigValue = "NOTSET";
public const string TestMethodConfigFolderName = "TestMethodConfig";
public const string TestMethodConfigFileName = "Test_Method_Configuration.ini";
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Raytheon.Instruments.PowerSupply;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,7 +14,7 @@ namespace ProgramLib
{
public double _voltage;
public double _current;
public Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo _powerSupplyModuleInfo;
public PowerSupplyModuleInfo _powerSupplyModuleInfo;
public bool _initialized;
/// <summary>

View File

@@ -1,4 +1,5 @@
using System;
using Raytheon.Instruments.PowerSupply;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -18,7 +19,7 @@ namespace ProgramLib
/// <summary>
/// Set data for a power supply module
/// </summary>
public void SetData(string moduleName, double voltage, double current, Raytheon.Instruments.PowerSupplies.PowerSupplyModuleInfo powerSupplyModuleInfo)
public void SetData(string moduleName, double voltage, double current, PowerSupplyModuleInfo powerSupplyModuleInfo)
{
lock (syncObj)
{
@@ -28,7 +29,7 @@ namespace ProgramLib
syncObjDict[moduleName] = new object();
}
}
lock (syncObjDict[moduleName])
{
if (!_powerSupplyDataDict.ContainsKey(moduleName))

View File

@@ -0,0 +1,206 @@
/*-------------------------------------------------------------------------
// 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 ProgramLib.GUI.Model;
using ProgramLib.GUI.View;
using ProgramLib.GUI.ViewModel;
using Raytheon.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using static MeasurementManagerLib.SwitchMeasurementManager;
namespace ProgramLib
{
/// <summary>
/// GMA/AUR TRD GMA_ATP_001 - UUT STTO
/// </summary>
internal class GMA_ATP_001_UUT_STTO : BasicTest
{
private readonly Dictionary<string, DMMResistanceMeasurementFields> _dmmResistanceMeasurements = new Dictionary<string, DMMResistanceMeasurementFields>(StringComparer.InvariantCultureIgnoreCase);
private List<string> _relayExclusionList;
private static NLog.ILogger _logger;
private bool _sttoSuccess = false;
private string fatalErrorMsg;
public GMA_ATP_001_UUT_STTO()
{
_logger = LogManager.GetCurrentClassLogger();
ParseMeasurementDef();
}
/// <summary>
/// Execute Test
/// </summary>
protected override void ExecuteTest()
{
Task.Factory.StartNew(() => PerformSttoTask());
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].Dispatcher.Invoke((Action)delegate
{
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.LIVE_DATA].Hide();
ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK].ShowDialog();
});
Program.Instance().SttoSuccess = _sttoSuccess;
if (!_sttoSuccess)
{
throw new Exception(fatalErrorMsg);
}
}
/// <summary>
/// Check Pre Conditions
/// </summary>
protected override void CheckPrerequisite()
{
// add pre req checks as needed
}
/// <summary>
/// Perform Safe-to-turn-on checks
/// </summary>
private void PerformSttoTask()
{
ImpedanceDataModel impedanceDataModel;
ImpedanceCheckWindow impedanceCheckWindow = (ImpedanceCheckWindow)ProgramLib.Program.Instance().GetGuiManager()[ProgramGuiManager.WINDOWS.IMPEDANCE_CHECK];
try
{
_logger?.Debug($"{this.GetType().Name}::PerformSttoTask() running...");
_sttoSuccess = true;
string measurementStatus = "PASSED";
ImpedanceCheckWindowViewModel.Images passFailImage = ImpedanceCheckWindowViewModel.Images.PASS_CHECK;
impedanceCheckWindow.ViewModel.ClearData();
foreach (KeyValuePair<string, DMMResistanceMeasurementFields> measurement in _dmmResistanceMeasurements)
{
impedanceDataModel = new ImpedanceDataModel();
double testResult = Program.Instance().MalMeasurementLibManager.SwitchMeasurementManager.DmmReadResistance(measurement.Key);
if (testResult < measurement.Value._lowerLimit || testResult > measurement.Value._upperLimit)
{
passFailImage = ImpedanceCheckWindowViewModel.Images.FAIL_CHECK;
measurementStatus = "FAILED";
_sttoSuccess = false;
}
impedanceDataModel.PassFailImagePath = impedanceCheckWindow.ViewModel.ImageToResourcePathDict[passFailImage];
impedanceDataModel.Description = $"{measurement.Value._cableAndPinId} Measured {testResult.ToString("0.00")} Range [{measurement.Value._lowerLimit},{measurement.Value._upperLimit}]";
if (Program.Instance()._testStandSeqContext != null)
{
Program.Instance()._testStandSeqContext.Step.AdditionalResults.CustomResults.Insert($"\"{measurement.Value._cableAndPinId}\"", $"\"Measured: {testResult.ToString("0.00")} Range [{measurement.Value._lowerLimit},{measurement.Value._upperLimit}] - {measurementStatus}\"");
}
impedanceCheckWindow.ViewModel.AddData(impedanceDataModel);
if (!_sttoSuccess)
{
fatalErrorMsg = impedanceDataModel.Description;
}
}
}
catch (Exception ex)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
}
finally
{
if (!_sttoSuccess)
{
impedanceCheckWindow.Dispatcher.Invoke((Action)delegate
{
impedanceCheckWindow.btnClose.Visibility = Visibility.Visible;
});
}
else
{
impedanceCheckWindow.Dispatcher.Invoke((Action)delegate
{
impedanceCheckWindow.Hide();
});
}
_logger?.Debug($"{this.GetType().Name}::PerformSttoTask() exiting...");
}
}
/// <summary>
/// Parses the ini file for measurement definitions
/// Populates the Dictionaries with the enum names and ini file data
/// </summary>
private void ParseMeasurementDef()
{
const string MAIN_SECTION_NAME = "GMA_ATP_001_UUT_STTO";
const string DMM_RESISTANCE_SECTION_NAME = $"{MAIN_SECTION_NAME}.DMM_RESISTANCE_MEASUREMENTS";
const string RELAY_EXCLUSION_SECTION_NAME = $"{MAIN_SECTION_NAME}.RELAY_EXCLUSION_LIST";
const string EXCLUSION_LIST_KEY = "EXCLUSION_LIST";
ConfigurationFile configurationFile = new ConfigurationFile(Program.Instance()._testMethodConfigFilePath);
const char COMMA_DELIM = ',';
// read in relay exclusion list
string relayExclusions = configurationFile.ReadValue<string>(RELAY_EXCLUSION_SECTION_NAME, EXCLUSION_LIST_KEY);
_relayExclusionList = relayExclusions.Split(COMMA_DELIM).ToList();
for (int i = 0; i < _relayExclusionList.Count; ++i)
{
_relayExclusionList[i] = _relayExclusionList[i].TrimEnd(' ');
_relayExclusionList[i] = _relayExclusionList[i].TrimStart(' ');
}
List<string> keys = configurationFile.ReadAllKeys(DMM_RESISTANCE_SECTION_NAME);
foreach (string key in keys)
{
List<string> valueList = configurationFile.ReadList<string>(DMM_RESISTANCE_SECTION_NAME, key);
int index = 0;
string pcode = valueList[index++];
double range = Convert.ToDouble(valueList[index++]);
double res = Convert.ToDouble(valueList[index++]);
int delay = Convert.ToInt32(valueList[index++]);
double scaleFactor = Convert.ToDouble(valueList[index++]);
List<string> relayList = valueList[index++].Split(COMMA_DELIM).ToList();
for (int i = 0; i < relayList.Count; ++i)
{
relayList[i] = relayList[i].Trim();
}
string resistanceTypeStr = valueList[index++].Trim();
DMMResistanceType type = (DMMResistanceType)Enum.Parse(typeof(DMMResistanceType), resistanceTypeStr, true);
string cableAndPinId = valueList[index++];
double lowerLimit = Convert.ToDouble(valueList[index++]);
double upperLimit = Convert.ToDouble(valueList[index++]);
_dmmResistanceMeasurements.Add(key.ToUpper(), new DMMResistanceMeasurementFields(pcode, range, res, delay, scaleFactor, relayList, type, cableAndPinId, lowerLimit, upperLimit));
}
Program.Instance().MalMeasurementLibManager.SwitchMeasurementManager.DmmResistanceMeasurements = _dmmResistanceMeasurements;
Program.Instance().MalMeasurementLibManager.SwitchMeasurementManager.RelayExclusionList = _relayExclusionList;
}
}
}

View File

@@ -1,8 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace ProgramGui.Model
namespace ProgramLib.GUI.Model
{
public partial class ImpedanceDataModel : ObservableObject
internal partial class ImpedanceDataModel : ObservableObject
{
[ObservableProperty]
private string passFailImagePath;

View File

@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProgramGui.Model
namespace ProgramLib.GUI.Model
{
public partial class PassthroughData
internal partial class PassthroughData
{
private struct VariableInfo
{

View File

@@ -6,9 +6,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProgramGui.Model
namespace ProgramLib.GUI.Model
{
public partial class PassthroughData
internal partial class PassthroughData
{
private int _datagridColumnCount = 0;
// this dictionary stores variable and the info needed to locate it in the passthroughdatamodel dictionary which contains a 2-d array

View File

@@ -1,8 +1,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace ProgramGui.Model
namespace ProgramLib.GUI.Model
{
public partial class PowerModuleDataModel : ObservableObject
internal partial class PowerModuleDataModel : ObservableObject
{
[ObservableProperty]
private string expectedVoltage;

View File

@@ -1,17 +1,15 @@
using NLog;
using ProgramGui.View;
using ProgramLib.GUI.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
namespace ProgramGui
namespace ProgramLib
{
public class ProgramGuiManager : IDisposable
internal class ProgramGuiManager : IDisposable
{
#region Private Members
private Thread _guiManagerThread;
@@ -24,7 +22,7 @@ namespace ProgramGui
#region Public Members
public enum WINDOWS
{
MAIN,
LIVE_DATA,
IMPEDANCE_CHECK
}
#endregion
@@ -68,7 +66,7 @@ namespace ProgramGui
_logger?.Debug($"{this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() is running...");
// instantiate all the windows here
_windowDict[WINDOWS.MAIN] = new MainWindow();
_windowDict[WINDOWS.LIVE_DATA] = new LiveDataWindow();
_windowDict[WINDOWS.IMPEDANCE_CHECK] = new ImpedanceCheckWindow();
_allGuiInitializedEvent.Set();

View File

@@ -1,9 +1,10 @@
<Window x:Class="ProgramGui.View.ImpedanceCheckWindow"
<Window x:Class="ProgramLib.GUI.View.ImpedanceCheckWindow"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProgramGui.View"
xmlns:local="clr-namespace:ProgramLib.GUI.View"
mc:Ignorable="d"
Title="Impedance Check"
WindowStyle="None"
@@ -28,7 +29,7 @@
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
<Setter TargetName="bdr_main2" Property="Content">
<Setter.Value>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
</Setter.Value>
</Setter>
</Trigger>
@@ -53,12 +54,12 @@
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
<Grid>
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
<Image x:Name="imgAppIcon" Source="pack://application:,,,/ProgramGui;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
<TextBlock x:Name="txtBlockAppTitle">Impedance Check</TextBlock>
</WrapPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0">
<Button x:FieldModifier="public" Style="{StaticResource TitleBarCloseButtonStyle}" x:Name="btnClose" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnClose_Click">
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
</Button>
</StackPanel>
</Grid>

View File

@@ -1,26 +1,23 @@
using ProgramGui.ViewModel;
using ProgramLib.GUI.ViewModel;
using System;
using System.Collections.Specialized;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
namespace ProgramGui.View
namespace ProgramLib.GUI.View
{
/// <summary>
/// Interaction logic for ImpedanceCheckWindow.xaml
/// </summary>
public partial class ImpedanceCheckWindow : Window
internal partial class ImpedanceCheckWindow : Window
{
public ImpedanceCheckWindowViewModel _viewModel;
internal ImpedanceCheckWindowViewModel ViewModel { get; set; }
public ImpedanceCheckWindow()
{
InitializeComponent();
Uri iconUri = new Uri("pack://application:,,,/ProgramGui;component/Resources/Icons/app.ico");
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
this.Icon = BitmapFrame.Create(iconUri);
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
@@ -29,8 +26,8 @@ namespace ProgramGui.View
((INotifyCollectionChanged)lvImpedanceCheck.Items).CollectionChanged += ListView_CollectionChanged;
_viewModel = new ImpedanceCheckWindowViewModel(this);
DataContext = _viewModel;
ViewModel = new ImpedanceCheckWindowViewModel(this);
DataContext = ViewModel;
}
protected override void OnContentRendered(EventArgs e)

View File

@@ -1,9 +1,10 @@
<Window x:Class="ProgramGui.MainWindow"
<Window x:Class="ProgramLib.GUI.View.LiveDataWindow"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProgramGui"
xmlns:local="clr-namespace:ProgramLib.GUI.View"
mc:Ignorable="d"
Title="Missile Test Set"
WindowStyle="None"
@@ -30,7 +31,7 @@
<Setter TargetName="bdr_main" Property="BorderBrush" Value="#ba1245"/>
<Setter TargetName="bdr_main2" Property="Content">
<Setter.Value>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_white.png" Width="20" Height="20" />
</Setter.Value>
</Setter>
</Trigger>
@@ -70,7 +71,7 @@
<!-- Define all image paths here for images that are binded to data model -->
<!-- Images that are binded to data models are not displayed at design time -->
<!-- So we use these images to display at design time -->
<BitmapImage x:Key="DesignSourceBlackLed" UriSource="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png"/>
<BitmapImage x:Key="DesignSourceBlackLed" UriSource="pack://application:,,,/Program;component/Resources/Images/black-led.png"/>
<!-- Style for the Menu control -->
<!-- There are multiple styles for the Menu control which are generated from built-in Menu style templte -->
@@ -391,18 +392,18 @@
<!-- Title bar which has the app icon, app title, minimize button, maximize button and close button -->
<Grid>
<WrapPanel HorizontalAlignment="left" VerticalAlignment="Center">
<Image x:Name="imgAppIcon" Source="pack://application:,,,/ProgramGui;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
<Image x:Name="imgAppIcon" Source="pack://application:,,,/Program;component/Resources/Images/missile.png" Width="20" Height="20" Margin="10,0,10,0"/>
<TextBlock x:Name="txtBlockAppTitle">[App Title Here]</TextBlock>
</WrapPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="0">
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMin" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMin_Click">
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/Title_Bar_Buttons/minimize.png" Width="12" Height="12"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/minimize.png" Width="12" Height="12"/>
</Button>
<Button Style="{StaticResource TitleBarButtonStyle}" x:Name="btnMax" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnMax_Click">
<Image x:Name="imgMax" Source="pack://application:,,,/ProgramGui;component/Resources/Images/Title_Bar_Buttons/maximize.png" Width="13" Height="13"/>
<Image x:Name="imgMax" Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/maximize.png" Width="13" Height="13"/>
</Button>
<Button Style="{StaticResource TitleBarCloseButtonStyle}" x:Name="btnClose" Width="44" Background="Transparent" BorderBrush="Transparent" Click="btnClose_Click">
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/Title_Bar_Buttons/close_black.png" Width="20" Height="20"/>
</Button>
</StackPanel>
</Grid>
@@ -522,41 +523,41 @@
<StackPanel Orientation="Horizontal">
<StackPanel Margin="0,0,35,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="IDA" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,35,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="SIC ADC" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,35,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="VIP Versal" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="80" Content="VIP I2C Board" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="VIP PolarFire FPGA" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/yellow-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/yellow-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="MCC DSP" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel>
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="80" Content="MCC Board" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,20,0,0">
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="CAS ACU DSP" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/red-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/red-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,35,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="50" Content="CAS ACU" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
</StackPanel>
</StackPanel>
</StackPanel>
@@ -598,11 +599,11 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Indicator 2" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="100" Content="Indicator 3" HorizontalAlignment="Left" VerticalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
</StackPanel>
</Border>
@@ -652,47 +653,47 @@
<StackPanel Margin="5,0,0,0" Orientation="Horizontal">
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J1" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J2" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J3" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J4" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J5" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J6" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J7" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/green-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J8" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J9" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel Margin="0,0,15,0">
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J10" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
<StackPanel>
<Label FontSize="10" FontWeight="Bold" Padding="0" Width="20" Content="J11" HorizontalContentAlignment="Center" BorderThickness="0" BorderBrush="#bdbcbd"/>
<Image Source="pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" Width="15" Height="15"/>
<Image Source="pack://application:,,,/Program;component/Resources/Images/black-led.png" Width="15" Height="15"/>
</StackPanel>
</StackPanel>
</Border>

View File

@@ -1,40 +1,28 @@
using ProgramGui.Model;
using ProgramGui.View;
using ProgramGui.ViewModel;
using ProgramLib.GUI.ViewModel;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
namespace ProgramGui
namespace ProgramLib.GUI.View
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
internal partial class LiveDataWindow : Window
{
public MainWindowViewModel _mainWindowViewModel;
internal LiveDataWindowViewModel LiveDataWindowViewModel { get; set; }
public ImpedanceCheckWindow _impedanceCheckWindow;
public MainWindow()
public LiveDataWindow()
{
InitializeComponent();
Uri iconUri = new Uri("pack://application:,,,/ProgramGui;component/Resources/Icons/app.ico");
Uri iconUri = new Uri("pack://application:,,,/Program;component/Resources/Icons/app.ico");
this.Icon = BitmapFrame.Create(iconUri);
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
_mainWindowViewModel = new MainWindowViewModel(this);
DataContext = _mainWindowViewModel;
LiveDataWindowViewModel = new LiveDataWindowViewModel(this);
DataContext = LiveDataWindowViewModel;
}
private void btnClose_Click(object sender, RoutedEventArgs e)

View File

@@ -1,14 +1,14 @@
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramGui.Model;
using ProgramLib.GUI.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Threading;
namespace ProgramGui.ViewModel
namespace ProgramLib.GUI.ViewModel
{
public class ImpedanceCheckWindowViewModel : ObservableObject
internal class ImpedanceCheckWindowViewModel : ObservableObject
{
private Window _window;
public enum Images
@@ -17,10 +17,20 @@ namespace ProgramGui.ViewModel
FAIL_CHECK
}
public Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
public Dictionary<Images, string> ImageToResourcePathDict
{
get
{
return _imageToResourcePathDict;
}
private set { }
}
private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.PASS_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-check-mark.png" },
{Images.FAIL_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/red-cross-mark.png" }
{Images.PASS_CHECK, @"pack://application:,,,/Program;component/Resources/Images/green-check-mark.png" },
{Images.FAIL_CHECK, @"pack://application:,,,/Program;component/Resources/Images/red-cross-mark.png" }
};
#region Data Bindings

View File

@@ -1,5 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using ProgramGui.Model;
using ProgramLib.GUI.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -8,9 +8,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProgramGui.ViewModel
namespace ProgramLib.GUI.ViewModel
{
public partial class MainWindowViewModel : ObservableObject
internal partial class LiveDataWindowViewModel : ObservableObject
{
public enum Images
{
@@ -20,7 +20,17 @@ namespace ProgramGui.ViewModel
private Window _window;
public Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
public Dictionary<Images, string> ImageToResourcePathDict
{
get
{
return _imageToResourcePathDict;
}
private set { }
}
private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
{
{Images.LED_ON, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-led.png" },
{Images.LED_OFF, @"pack://application:,,,/ProgramGui;component/Resources/Images/black-led.png" }
@@ -42,7 +52,7 @@ namespace ProgramGui.ViewModel
#endregion Data Bindings
public MainWindowViewModel(Window window)
public LiveDataWindowViewModel(Window window)
{
_window = window;
_dataGridPowerDatatems = new ObservableCollection<PowerModuleDataModel>();

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="Parts">
<key name="Location" value="C:\Program Files (x86)\Raytheon\RINSS\Parts" />
</section>
</IniConfiguration>
<XmlConfigurations>
<XmlConfiguration name="Instruments">
<Instrument>
<Name>TCP_CLIENT_1</Name>
<Factory>EthernetSocketsTcpClientFactory</Factory>
</Instrument>
<Instrument>
<Name>STE_POWER_SUPPLY_SYSTEM</Name>
<Factory>PowerSupplyKeysightN67xxFactory</Factory>
</Instrument>
</XmlConfiguration>
</XmlConfigurations>
</Configurations>

View File

@@ -1,59 +0,0 @@
[GENERAL]
ETHERNET_ADDRESS = localhost
ETHERNET_PORT = 5025
MODULE_DEFINITION = UUT_REF_3_3V, STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V
; 0 means no coupled modules.
; couple means turning on/off any one of the module, turns on/off the others
COUPLED_MODULES = STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V
; 0 means no grouped modules.
; group means turning combining 2 or more modules thus acting as one module
GROUPED_MODULES = 0
INTERFACE = ETHERNET
; GU | KW | KWSIM | SELFTEST | ZERO VOLTAGE
[UUT_REF_3_3V]
INDEX = 1
OCP = 2.0
OVP = 4.0
VOLTAGE_SETPOINT = 3.3
MIN_VOLTAGE = 3.0
MAX_VOLTAGE = 3.75
MAX_CURRENT = 2.0
MIN_CURRENT = -0.25
[STE_PVM_5V]
INDEX = 2
OCP = 2.0
OVP = 8.0
VOLTAGE_SETPOINT = 5.0
; STE Power (PVM and peripherals) supply settings
MIN_VOLTAGE = 4.0
MAX_VOLTAGE = 5.5
MAX_CURRENT = 1.5
MIN_CURRENT = -.25
[STE_GU_INTERFACE_RELAYS_25V]
INDEX = 3
OCP = 3.0
OVP = 34.0
VOLTAGE_SETPOINT = 25.0
; STE Power (GU interface and Relays) Supply settings
MIN_VOLTAGE = 22.0
MAX_VOLTAGE = 30.0
MAX_CURRENT = 3.0
MIN_CURRENT = -0.25
[STE_GU_INTERFACE_RF_INTERFACE_5V]
INDEX = 4
OCP = 5.0
OVP = 6.5
VOLTAGE_SETPOINT = 5.0
; STE Power (PVM and peripherals) supply settings
MIN_VOLTAGE = 4.0
MAX_VOLTAGE = 6.3
MAX_CURRENT = 4.5
MIN_CURRENT = -.25

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="ADVANTECH_DIO_1">
<key name="DIO_MODULE_DEF_FILEPATH" value=".\InstrumentConfig\DIO_MODULES.ini" />
</section>
</IniConfiguration>
<XmlConfigurations />
</Configurations>

View File

@@ -0,0 +1,45 @@
; ===============================================================================================================
; This name must match the name specified in the Instrument.xml for an instrument of type DIO
[PICKERING_DIO_1]
PXI_CARD_SLOT_INDEX = 0
SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION = false
; number channels per port
NUM_CHANNELS_PER_PORT=8
; either 0 or 1 as the starting channel index
CHANNEL_START_INDEX=0
NUM_OUTPUT_CHANNELS = 32
NUM_INPUT_CHANNELS = 32
;format is <signal_name> = <Channel Number>|<Initial State>
;<Initial State> is either 0 or 1 or 2(Logic Z)
[PICKERING_DIO_1.OUTPUT_SIGNALS]
SIGNAL_1 = 0|1
SIGNAL_2 = 1|0
;format is <signal_name> = <Channel Number>
[PICKERING_DIO_1.INPUT_SIGNALS]
SIGNAL_3 = 0
SIGNAL_4 = 0
; ===============================================================================================================
; This name must match the name specified in the Instrument.xml for an instrument of type DIO
[ADVANTECH_DIO_1]
DEVICE_NUMBER = 0
SHALL_WE_DRIVE_OUTPUT_UPON_INITIALIZATION = false
; number channels per port
NUM_CHANNELS_PER_PORT=8
; either 0 or 1 as the starting channel index
CHANNEL_START_INDEX=0
NUM_OUTPUT_CHANNELS = 32
NUM_INPUT_CHANNELS = 32
;format is <signal_name> = <Channel Number>|<Initial State>
;<Initial State> is either 0 or 1 or 2(Logic Z)
[ADVANTECH_DIO_1.OUTPUT_SIGNALS]
SIGNAL_5 = 0|1
SIGNAL_6 = 1|0
;format is <signal_name> = <Channel Number>
[ADVANTECH_DIO_1.INPUT_SIGNALS]
SIGNAL_7 = 0
SIGNAL_8 = 0

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="Parts">
<key name="Location" value="C:\Program Files (x86)\Raytheon\RINSS\Parts" />
</section>
</IniConfiguration>
<XmlConfigurations>
<XmlConfiguration name="Instruments">
<Instrument>
<Name>STE_POWER_SUPPLY_SYSTEM</Name>
<Factory>PowerSupplySystemKeysightFactory</Factory>
</Instrument>
<Instrument>
<Name>UUT_POWER_SUPPLY_SYSTEM</Name>
<Factory>PowerSupplySystemKeysightFactory</Factory>
</Instrument>
<Instrument>
<Name>PICKERING_DIO_1</Name>
<Factory>DIOPickering40xFactory</Factory>
</Instrument>
<Instrument>
<Name>ADVANTECH_DIO_1</Name>
<Factory>DIOAdvantechFactory</Factory>
</Instrument>
<Instrument>
<Name>PICKERING_SWITCH_1</Name>
<Factory>SwitchPickeringPipx40Factory</Factory>
</Instrument>
<Instrument>
<Name>KEYSIGHT_DMM_1</Name>
<Factory>DMMKeysightScpiFactory</Factory>
</Instrument>
</XmlConfiguration>
</XmlConfigurations>
</Configurations>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="KEYSIGHT_DMM_1">
</section>
</IniConfiguration>
<XmlConfigurations />
</Configurations>

View File

@@ -0,0 +1,56 @@
[SYSTEM]
;system commands
CLEAR_CMD = *CLS
RESET_CMD = *RST
SELFTEST_CMD = *TST?
READ_ERROR_CODE_CMD = SYST:ERR?
REBOOT_CMD = SYST:REB
;panel disable/enable commands
SET_FRONTPANEL_DISABLE_CMD = SYST:COMM:RLST RWL
SET_FRONTPANEL_ENABLE_CMD = SYST:COMM:RLST REM
;watchdog commands
SET_WATCHDOGDELAY_CMD = OUTP:PROT:WDOG:DEL
SET_WATCHDOGON_CMD = OUTP:PROT:WDOG ON
SET_WATCHDOGOFF_CMD = OUTP:PROT:WDOG OFF
;coupling commands
SET_COUPLE_CHANNELS_CMD = OUTP:COUP:CHAN
SET_COUPLE_ON_CMD = OUTP:COUP ON
SET_COUPLE_OUTPUT_PROTECT_ON_CMD = OUTP:PROT:COUP ON
QUERY_COUPLE_CHANNELS = OUTP:COUP:CHAN?
QUERY_COUPLE_STATE = OUTP:COUP?
; Grouping Commands
SET_GROUP_DEFINE_CMD = SYST:GRO:DEF
UNGROUP_ALL_CHANNELS_CMD = SYST:GRO:DEL:ALL
QUERY_GROUP_CHANNELS = SYST:GRO:CAT?
[MODULE]
; current commands
SET_INRUSH_DELAY_CMD = CURR:PROT:DEL
READ_INRUSH_DELAY_CMD = CURR:PROT:DEL?
READ_CURRENT_CMD = MEAS:CURR?
SET_OCP_CMD = CURR:LEV
READ_OCP_CMD = CURR:LEV?
SET_OCP_ON_CMD = CURR:PROT:STAT ON
; voltage commands
SET_OVP_CMD = VOLT:PROT
SET_VOLTAGE_SLEW_CMD = VOLT:SLEW
SET_VOLTAGE_SETPOINT_CMD = VOLT:LEV
SET_CONSTANT_VOLTAGE_CMD = STAT:OPER:ENAB 1
READ_VOLTAGE_CMD = MEAS:VOLT?
READ_VOLTAGE_SETPOINT_CMD = VOLT?
READ_OVP_CMD = VOLT:PROT?
READ_VOLTAGE_SLEW_CMD = VOLT:SLEW?
; set output commands
SET_OUTPUT_DISABLE_CMD = OUTP OFF
SET_OUTPUT_ENABLE_CMD = OUTP ON
; query status
READ_OUTPUT_STATUS_CMD = OUTP?
READ_ERROR_STATUS_CMD = SYST:ERR?
READ_PROTECTION_STATUS_CMD = STAT:QUES:COND?

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="PICKERING_DIO_1">
<key name="DIO_MODULE_DEF_FILEPATH" value=".\InstrumentConfig\DIO_MODULES.ini" />
</section>
</IniConfiguration>
<XmlConfigurations />
</Configurations>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="PICKERING_SWITCH_1">
</section>
</IniConfiguration>
<XmlConfigurations />
</Configurations>

View File

@@ -0,0 +1,95 @@
; ===============================================================================================================
; This name must match the name specified in the Instrument.xml that is associated with the power supply system
[STE_POWER_SUPPLY_SYSTEM]
SCPI_DEF_FILEPATH = .\InstrumentConfig\KEYSIGHT_SCPI_DEF.ini
ETHERNET_ADDRESS = localhost
ETHERNET_PORT = 5025
MODULE_DEFINITION = UUT_REF_3_3V, STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V
; 0 means no coupled modules.
; couple means turning on/off any one of the module, turns on/off the others
COUPLED_MODULES = STE_PVM_5V, STE_GU_INTERFACE_RELAYS_25V, STE_GU_INTERFACE_RF_INTERFACE_5V
; 0 means no grouped modules.
; group means turning combining 2 or more modules thus acting as one module
GROUPED_MODULES = 0
INTERFACE = ETHERNET
[STE_POWER_SUPPLY_SYSTEM.UUT_REF_3_3V]
INDEX = 1
OCP = 2.0
OVP = 4.0
VOLTAGE_SETPOINT = 3.3
MIN_VOLTAGE = 3.0
MAX_VOLTAGE = 3.75
MAX_CURRENT = 2.0
MIN_CURRENT = -0.25
[STE_POWER_SUPPLY_SYSTEM.STE_PVM_5V]
INDEX = 2
OCP = 2.0
OVP = 8.0
VOLTAGE_SETPOINT = 5.0
MIN_VOLTAGE = 4.0
MAX_VOLTAGE = 5.5
MAX_CURRENT = 1.5
MIN_CURRENT = -.25
[STE_POWER_SUPPLY_SYSTEM.STE_GU_INTERFACE_RELAYS_25V]
INDEX = 3
OCP = 3.0
OVP = 34.0
VOLTAGE_SETPOINT = 25.0
MIN_VOLTAGE = 22.0
MAX_VOLTAGE = 30.0
MAX_CURRENT = 3.0
MIN_CURRENT = -0.25
[STE_POWER_SUPPLY_SYSTEM.STE_GU_INTERFACE_RF_INTERFACE_5V]
INDEX = 4
OCP = 5.0
OVP = 6.5
VOLTAGE_SETPOINT = 5.0
MIN_VOLTAGE = 4.0
MAX_VOLTAGE = 6.3
MAX_CURRENT = 4.5
MIN_CURRENT = -.25
; ===============================================================================================================
; This name must match the name specified in the Instrument.xml that is associated with the power supply system
[UUT_POWER_SUPPLY_SYSTEM]
SCPI_DEF_FILEPATH = .\InstrumentConfig\KEYSIGHT_SCPI_DEF.ini
ETHERNET_ADDRESS = localhost
ETHERNET_PORT = 5026
MODULE_DEFINITION = UUT_P20V, UUT_N20V
; 0 means no coupled modules.
; couple means turning on/off any one of the module, turns on/off the others
COUPLED_MODULES = 0
; 0 means no grouped modules.
; group means turning combining 2 or more modules thus acting as one module
GROUPED_MODULES = 0
INTERFACE = ETHERNET
[UUT_POWER_SUPPLY_SYSTEM.UUT_P20V]
INDEX = 1
OCP = 1.5
OVP = 22.0
VOLTAGE_SETPOINT = 20.0
MIN_VOLTAGE = 19.0
MAX_VOLTAGE = 22.75
MAX_CURRENT = 2.3
MIN_CURRENT = -0.25
[UUT_POWER_SUPPLY_SYSTEM.UUT_N20V]
INDEX = 2
OCP = 1.8
OVP = 22.5
VOLTAGE_SETPOINT = 20.0
MIN_VOLTAGE = 18.0
MAX_VOLTAGE = 23.0
MAX_CURRENT = 2.5
MIN_CURRENT = -.25

View File

@@ -2,7 +2,7 @@
<Configurations>
<IniConfiguration>
<section name="STE_POWER_SUPPLY_SYSTEM">
<key name="INI_FILE_PATH" value=".\InstrumentConfig\STE_POWER_SUPPLY_SYSTEM.ini" />
<key name="POWER_SUPPLY_SYSTEM_DEF_FILEPATH" value=".\InstrumentConfig\POWER_SUPPLY_SYSTEMS.ini" />
</section>
</IniConfiguration>
<XmlConfigurations />

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Configurations>
<IniConfiguration>
<section name="UUT_POWER_SUPPLY_SYSTEM">
<key name="POWER_SUPPLY_SYSTEM_DEF_FILEPATH" value=".\InstrumentConfig\POWER_SUPPLY_SYSTEMS.ini" />
</section>
</IniConfiguration>
<XmlConfigurations />
</Configurations>

View File

@@ -15,7 +15,7 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using ProgramGui;
using ProgramLib;
using Raytheon.Instruments;
using System;
using System.Collections.Generic;
@@ -27,13 +27,10 @@ using System.Threading.Tasks;
namespace ProgramLib
{
/// <summary>
/// Methods to call into actions
/// </summary>
/// Partial class that define all the actions that can be executed
/// </summary>
public partial class Program
{
/// <summary>
/// Power on UUT
/// </summary>
public void UutPowerOn()
{
try
@@ -47,17 +44,12 @@ namespace ProgramLib
}
catch (Exception ex)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
}
}
/// <summary>
/// Power off UUT
/// </summary>
public void UutPowerOff()
{
try
@@ -71,8 +63,6 @@ namespace ProgramLib
}
catch (Exception ex)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);

View File

@@ -0,0 +1,46 @@
/*-------------------------------------------------------------------------
// 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 System;
namespace ProgramLib
{
/// <summary>
/// Partial class that define all the Functional Tests for all the Functional Test Requirements in the TRD
/// </summary>
public partial class Program
{
/// <summary>
/// GMA_ATP_001 - Perform UUT Safe-to-turn-on
/// </summary>
public void Perform_GMA_ATP_001_UUT_STTO()
{
try
{
BasicTest test = new GMA_ATP_001_UUT_STTO();
test.RunTest();
}
catch (Exception ex)
{
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
}
}
}
}

View File

@@ -26,9 +26,10 @@ using Raytheon.Instruments;
using Raytheon.Common;
using NLog;
using System.Windows.Interop;
using ProgramGui;
using ProgramLib;
using NationalInstruments.TestStand.Interop.API;
using System.Runtime.ExceptionServices;
using MeasurementManagerLib;
namespace ProgramLib
{
@@ -37,8 +38,6 @@ namespace ProgramLib
/// </summary>
public partial class Program
{
// Declare all the instrument managers here
private PowerSupplyMeasurementManager _psManager = null;
private ProgramGuiManager _guiManager = null;
internal bool _isUutPwrOn = false;
@@ -53,13 +52,48 @@ namespace ProgramLib
{
try
{
_psManager = new PowerSupplyMeasurementManager(_instrumentManager, _fileAndFolderManager.getFile(FileAndFolderManager.Files.POWER_SUPPLY_SELF_TEST_DATETIME));
_psManager.Initialize();
MalMeasurementLibManager.InitializePowerSupplyMeasurementManager();
}
catch (Exception ex)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
}
}
/// <summary>
/// Initialize DIO measurement manager
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public void InitializeDioMeasurementManager()
{
try
{
MalMeasurementLibManager.InitializeDioMeasurementManager(); ;
}
catch (Exception ex)
{
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
}
}
/// <summary>
/// Initialize switch measurement manager
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public void InitializeSwitchMeasurementManager()
{
try
{
MalMeasurementLibManager.InitializeSwitchMeasurementManager();
}
catch (Exception ex)
{
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
@@ -80,8 +114,6 @@ namespace ProgramLib
}
catch (Exception ex)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
@@ -104,11 +136,11 @@ namespace ProgramLib
_threadList.Add(new FailureMonitorThread());
_threadList.Last().Start();
ICollection<object> psList = _instrumentManager.GetInstruments(typeof(PowerSupply));
ICollection<object> powerSystemList = _instrumentManager.GetInstruments(typeof(IPowerSupplySystem));
foreach (PowerSupply ps in psList)
foreach (IPowerSupplySystem powerSystem in powerSystemList)
{
_threadList.Add(new PowerSupplyReadThread(ps.Name));
_threadList.Add(new PowerSupplyReadThread(powerSystem.Name));
_threadList.Last().Start();
}
@@ -121,33 +153,18 @@ namespace ProgramLib
}
catch (Exception ex)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
// DO NOT THROW in this block
// this function will handle the error accordingly since we could be calling this from third-party test executive like TestStand
TerminateTestOnMainThreadError(ex);
}
}
/// <summary>
/// Get power supply manager object
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public PowerSupplyMeasurementManager GetPowerSupplyMeasurementManager()
{
if (_psManager == null)
InitializePowerSupplyMeasurementManager();
return _psManager;
}
/// <summary>
/// Get Gui manager object
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public ProgramGuiManager GetGuiManager()
internal ProgramGuiManager GetGuiManager()
{
if (_guiManager == null)
InitializeGuiManager();

View File

@@ -15,15 +15,17 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using NationalInstruments.TestStand.Interop.API;
using NLog;
using Raytheon.Instruments;
using System;
using System.IO;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using NationalInstruments.TestStand.Interop.API;
using NLog;
using Raytheon.Instruments;
using Raytheon.Common;
using MeasurementManagerLib;
namespace ProgramLib
{
@@ -31,7 +33,6 @@ namespace ProgramLib
/// Class for interfacing with any Test Executive such as third party test executive such as Test Stand
/// DO NOT implement IDisposable interface for this class. If there are unmanaged resources that need to be freed,
/// do it in the destructor.
///
/// </summary>
public partial class Program
{
@@ -65,15 +66,19 @@ namespace ProgramLib
internal EventManager _eventManager = new EventManager();
internal FileAndFolderManager _fileAndFolderManager;
internal IConfigurationFile _programConfig { get; private set; }
internal MalMeasurementLibManager MalMeasurementLibManager { get; private set; }
internal string _testMethodConfigFilePath;
internal bool SttoSuccess { get; set; }
/// <summary>
/// Create an instance of this class. Only one instance is allowed
/// </summary>
/// <param name="partNumber">The UUT part number</param>
/// <param name="serialNumber">The UUT serial number</param>
/// <param name="isThereHardware">false for simulation</param>
/// <returns></returns>
public static Program Instance(string partNumber = "", string serialNumber = "", bool isThereHardware = true, object testStandSeqContext = null)
/// Create an instance of this class. Only one instance is allowed
/// </summary>
/// <param name="partNumber">The UUT part number</param>
/// <param name="serialNumber">The UUT serial number</param>
/// <param name="isThereHardware">false for simulation</param>
/// <returns></returns>
public static Program Instance(string partNumber = "", string serialNumber = "", bool isThereHardware = true, object testStandSeqContext = null)
{
if (_program == null)
{
@@ -130,6 +135,8 @@ namespace ProgramLib
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
_programConfig = new ConfigurationFile(Path.Combine(assemblyFolder, GeneralConstants.ProgramConfigFilename));
_testMethodConfigFilePath = Path.Combine(assemblyFolder, GeneralConstants.TestMethodConfigFolderName, GeneralConstants.TestMethodConfigFileName);
_fileAndFolderManager = new FileAndFolderManager(_programConfig);
if (testStandSeqContext != null)
@@ -152,17 +159,22 @@ namespace ProgramLib
_serialNumber = serialNumber;
_isThereHardware = isThereHardware;
SttoSuccess = false;
// Initialze all other configuration that the program needs
_uutInfo = new UutInfo(_partNumber, _serialNumber);
try
{
var configFolder = Path.Combine(assemblyFolder, Raytheon.Common.GeneralConstants.InstrumentConfigFolder);
var configFolder = Path.Combine(assemblyFolder, Raytheon.Common.Constants.InstrumentConfigFolder);
_instrumentManager = new GeneralInstrumentManager(assemblyFolder, configFolder, _isThereHardware);
_instrumentManager.Initialize();
MalMeasurementLibManager = new MalMeasurementLibManager(_instrumentManager);
}
catch (Exception)
{
throw;
}
}
@@ -211,6 +223,8 @@ namespace ProgramLib
{
if (_testStandSeqContext != null)
{
_logger.Error(ex.Message + "\n" + ex.StackTrace);
lock (_terminateTestSyncObj)
{
if (!_terminateTestInitiated)

View File

@@ -1,73 +1,86 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Program</AssemblyName>
<UseWPF>true</UseWPF>
<Description>Program DLL serves as starting test point</Description>
<Company>Raytheon Technologies</Company>
<Product>NGSRI Program</Product>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!-- Dynamic Versioning (Suitable for Release) -->
<!-- <Version>$(Version)$(Suffix)</Version> -->
<Import Project="$(SolutionDir)Solution.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Program</AssemblyName>
<UseWPF>true</UseWPF>
<Description>NGSRI Program</Description>
<Product>NGSRI Program GUI</Product>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Static Versioning (Suitable for Development) -->
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
<!-- Static versioning (Suitable for Development) -->
<!-- Disable the line below for dynamic versioning -->
<Version>1.0.0</Version>
<ApplicationIcon>Resources\Icons\app.ico</ApplicationIcon>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Raytheon.Configuration" Version="*" />
<PackageReference Include="Raytheon.Configuration.Contracts" Version="*" />
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0" />
<PackageReference Include="Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager" Version="1.4.1" />
<!--
<PackageReference Include="NGSRI" Version="1.0.0" />
-->
</ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageReference Include="Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager" Version="1.5.0" />
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
<PackageReference Include="Raytheon.Instruments.Implementation" Version="1.0.0" />
<PackageReference Include="Raytheon.MAL" Version="1.0.0" />
</ItemGroup>
<!-- Copy pdb files for DLLs in nuget packages to output directory-->
<Target Name="IncludeSymbolFiles" AfterTargets="ResolveAssemblyReferences" Condition="@(ReferenceCopyLocalPaths) != ''">
<ItemGroup>
<ReferenceCopyLocalPaths Include="%(ReferenceCopyLocalPaths.RelativeDir)%(ReferenceCopyLocalPaths.Filename).pdb" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="!Exists('%(FullPath)')" />
</ItemGroup>
</Target>
<ItemGroup>
<ProjectReference Include="..\Instruments\PowerSupplies\Keysight67XX\KeysightN67XX.csproj" />
<ProjectReference Include="..\MeasurementManagers\PowerSupplyMeasurementManager\PowerSupplyMeasurementManager.csproj" />
<ProjectReference Include="..\ProgramGUI\ProgramGui.csproj" />
<ProjectReference Include="..\Raytheon.Common\Raytheon.Common.csproj" />
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="NationalInstruments.TestStand.Interop.API">
<HintPath>..\ProgramLib\Dependencies\NationalInstruments.TestStand.Interop.API.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
</ItemGroup>
<Reference Include="System.Windows" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\app.ico" />
<Resource Include="Resources\Images\black-led.png" />
<Resource Include="Resources\Images\green-check-mark.png" />
<Resource Include="Resources\Images\green-led.png" />
<Resource Include="Resources\Images\missile.png" />
<Resource Include="Resources\Images\red-cross-mark.png" />
<Resource Include="Resources\Images\red-led.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\close_black.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\close_white.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\maximize.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\minimize.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\restore.png" />
<Resource Include="Resources\Images\yellow-led.png" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Target Name="CopyFiles" AfterTargets="AfterBuild">
<ItemGroup>
<FILES_1 Include="Dependencies\*.*" />
<FILES_2 Include="InstrumentConfigFile\*.*" />
<FILES_3 Include="Dependencies\RINSS\*.*" />
<FILES_2 Include="InstrumentConfigFiles\*.*" />
<FILES_3 Include="TestMethodConfigFiles\*.*" />
<FILES_4 Include="Dependencies\RINSS\*.*" />
</ItemGroup>
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(OutDir)InstrumentConfig" />
<Copy SourceFiles="@(FILES_3)" DestinationFolder="$(OutDir)RINSS" />
<Copy SourceFiles="ProgramConfigFile\config.ini" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="MiscConfigFile\NLog.config" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="@(FILES_3)" DestinationFolder="$(OutDir)TestMethodConfig" />
<Copy SourceFiles="@(FILES_4)" DestinationFolder="$(OutDir)RINSS" />
<Copy SourceFiles="ProgramConfigFiles\config.ini" DestinationFolder="$(OutDir)" />
<Copy SourceFiles="MiscConfigFiles\NLog.config" DestinationFolder="$(OutDir)" />
</Target>
<Target Name="ProjClean" AfterTargets="AfterClean">
<RemoveDir Directories="$(OutDir)InstrumentConfig" />
<RemoveDir Directories="$(OutDir)TestMethodConfig" />
<RemoveDir Directories="$(OutDir)RINSS" />
<Delete Files="$(OutDir)config.ini" />
<Delete Files="$(OutDir)NLog.config" />

View File

@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProgramGui.Properties {
namespace ProgramLib.Properties {
using System;

View File

@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProgramGui.Properties {
namespace Program.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]

View File

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 371 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

View File

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 100 B

View File

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 934 B

After

Width:  |  Height:  |  Size: 934 B

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,73 @@
[GMA_ATP_001_UUT_STTO]
PLACEHOLDER = PLACEHOLDER
;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit
;Type is TWO or FOUR for two wire and four wire measurements
;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#]
; [Card_Name] - must match the name of the switch card defined in the Instrument.xml
;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id]
[GMA_ATP_001_UUT_STTO.DMM_RESISTANCE_MEASUREMENTS]
R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0
R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0
; a list of relays that the software will reject if commanded..
; cannot be empty, put "NONE" if there are no exclusions
[GMA_ATP_001_UUT_STTO.RELAY_EXCLUSION_LIST]
EXCLUSION_LIST = NONE
;=====================================================================================================================
[GMA_ATP_002_UUT_CI]
PLACEHOLDER = PLACEHOLDER
;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit
;Type is TWO or FOUR for two wire and four wire measurements
;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#]
; [Card_Name] - must match the name of the switch card defined in the Instrument.xml
;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id]
[GMA_ATP_002_UUT_CI.DMM_RESISTANCE_MEASUREMENTS]
R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0
R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0
; a list of relays that the software will reject if commanded..
; cannot be empty, put "NONE" if there are no exclusions
[GMA_ATP_002_UUT_CI.RELAY_EXCLUSION_LIST]
EXCLUSION_LIST = NONE
;=====================================================================================================================
[AUR_ATP_001_UUT_STTO]
PLACEHOLDER = PLACEHOLDER
;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit
;Type is TWO or FOUR for two wire and four wire measurements
;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#]
; [Card_Name] - must match the name of the switch card defined in the Instrument.xml
;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id]
[AUR_ATP_001_UUT_STTO.DMM_RESISTANCE_MEASUREMENTS]
R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1:-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0
R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0
; a list of relays that the software will reject if commanded..
; cannot be empty, put "NONE" if there are no exclusions
[AUR_ATP_001_UUT_STTO.RELAY_EXCLUSION_LIST]
EXCLUSION_LIST = NONE
;=====================================================================================================================
[AUR_ATP_002_UUT_CI]
PLACEHOLDER = PLACEHOLDER
;format is name = range|resolution|delay(ms)|scale factor|relays|type|cable and pin id|lower_limit|upper_limit
;Type is TWO or FOUR for two wire and four wire measurements
;Relay Format: [Card_Name]-[Relay_Channel#],[Card_Name]-[Relay_Channel#]-[Relay_Channel#]
; [Card_Name] - must match the name of the switch card defined in the Instrument.xml
;Cable and Pin Id Format: [Cable_Id]_[Pin_Id]_[Cable_Id]_[Pin_Id]
[AUR_ATP_002_UUT_CI.DMM_RESISTANCE_MEASUREMENTS]
R1 = PCODE1|-1|0.001|100|1|PICKERING_SWITCH_1:-56,PICKERING_SWITCH_1-57|TWO|J1_P1_J1_P2|1.0|2.0
R2 = PCODE2|-1|0.001|100|1|PICKERING_SWITCH_1-58,PICKERING_SWITCH_1-59|TWO|J1_P3_J1_P4|1.0|2.0
; a list of relays that the software will reject if commanded..
; cannot be empty, put "NONE" if there are no exclusions
[AUR_ATP_002_UUT_CI.RELAY_EXCLUSION_LIST]
EXCLUSION_LIST = NONE

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)
{

View File

@@ -1,68 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>ProgramGui</AssemblyName>
<UseWPF>true</UseWPF>
<Description>NGSRI Program GUI</Description>
<Company>Raytheonn Technologies</Company>
<Product>NGSRI Program GUI</Product>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!-- Prevent Git Commit Hash to be appended to Version information -->
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<!-- Dynamic Versioning -->
<!--<Version>$(Version)$(Suffix)</Version>-->
<!-- Static Versioning -->
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
<ApplicationIcon>Resources\Icons\app.ico</ApplicationIcon>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\Icons\Thumbs.db" />
<None Remove="Resources\Images\red-led.png" />
<None Remove="Resources\Images\Title_Bar_Buttons\Thumbs.db" />
<None Remove="Resources\Images\yellow-led.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
</ItemGroup>
<!-- Copy pdb files for DLLs in nuget packages to output directory-->
<Target Name="IncludeSymbolFiles" AfterTargets="ResolveAssemblyReferences" Condition="@(ReferenceCopyLocalPaths) != ''">
<ItemGroup>
<ReferenceCopyLocalPaths Include="%(ReferenceCopyLocalPaths.RelativeDir)%(ReferenceCopyLocalPaths.Filename).pdb" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="!Exists('%(FullPath)')" />
</ItemGroup>
</Target>
<ItemGroup>
<Reference Include="System.Windows" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\app.ico" />
<Resource Include="Resources\Images\black-led.png" />
<Resource Include="Resources\Images\green-check-mark.png" />
<Resource Include="Resources\Images\green-led.png" />
<Resource Include="Resources\Images\missile.png" />
<Resource Include="Resources\Images\red-cross-mark.png" />
<Resource Include="Resources\Images\red-led.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\close_black.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\close_white.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\maximize.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\minimize.png" />
<Resource Include="Resources\Images\Title_Bar_Buttons\restore.png" />
<Resource Include="Resources\Images\yellow-led.png" />
</ItemGroup>
</Project>

View File

@@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Program.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>Raytheon.Common</AssemblyName>
<Company>Raytheon Technologies</Company>
<Product>Raytheon Common Library</Product>
<Description>Raytheon Common Library</Description>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!-- Dynamic Versioning (Suitable for Release) -->
<!-- <Version>$(Version)$(Suffix)</Version> -->
<!-- Static Versioning (Suitable for Development) -->
<Version>1.0.0</Version>
<Configurations>Debug;Release;Deploy</Configurations>
</PropertyGroup>
</Project>

57
Source/Solution.props Normal file
View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Year>$([System.DateTime]::get_now().ToString("yyyy"))</Year>
<Major>$(Year)</Major>
<Minor>$([System.DateTime]::get_now().ToString("MM"))</Minor>
<Build>$([System.DateTime]::get_now().ToString("dd"))</Build>
<Revision>$([MSBuild]::Divide($([System.DateTime]::get_Now().get_TimeOfDay().get_TotalMinutes()), 2).ToString('F0'))</Revision>
<Version>$(Major).$(Minor).$(Build).$(Revision)</Version>
<Company>Raytheon Technologies</Company>
<Authors>TEEC</Authors>
<Copyright>Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Configurations>Debug;Release;Deploy</Configurations>
<!-- Append Git Commit Hash to Product Version -->
<IncludeSourceRevisionInInformationalVersion>true</IncludeSourceRevisionInInformationalVersion>
<!-- Add Repo URL and Commit # to the *.nuspec file -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<HalTempFolder>$(SolutionDir)HalTempFolder</HalTempFolder>
</PropertyGroup>
<!-- Copy pdb files in nuget packages to output directory-->
<Target Name="IncludeSymbolFiles" AfterTargets="ResolveAssemblyReferences" Condition="@(ReferenceCopyLocalPaths) != ''">
<ItemGroup>
<ReferenceCopyLocalPaths Include="%(ReferenceCopyLocalPaths.RelativeDir)%(ReferenceCopyLocalPaths.Filename).pdb" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="!Exists('%(FullPath)')" />
</ItemGroup>
</Target>
<ItemGroup>
<None Include="$(SolutionDir)Nuget\readme.md" Pack="true" PackagePath="\">
<Link>_Project_Items\readme.md</Link>
</None>
</ItemGroup>
<Target Name="DeleteStaleFiles" BeforeTargets="BeforeBuild">
<ItemGroup>
<StaleFiles Include="$(OutDir)..\*.nupkg" />
</ItemGroup>
<Delete Files="@(StaleFiles)" />
</Target>
<Target Name="PublishPackageDebug" AfterTargets="Pack" Condition="'$(Configuration)' == 'Debug'">
<Exec Command="dotnet nuget push --source &quot;SolutionLocalSource&quot; $(OutDir)..\*.nupkg" />
</Target>
</Project>

View File

@@ -0,0 +1,192 @@
// **********************************************************************************************************
// AutomationMessage.cs
// 1/8/2024
// NGI - Next Generation Interceptor
//
// Contract No. HQ0856-21-C-0003/1022000209
//
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
//
// 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.
//
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
//
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
//
// CONTROLLED BY: MISSILE DEFENSE AGENCY
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
// CUI CATEGORY: CTI
// DISTRIBUTION/DISSEMINATION CONTROL: F
// POC: Alex Kravchenko (1118268)
// **********************************************************************************************************
using System;
namespace Raytheon.Common
{
/// <summary>
/// An abstract base class for AutomationMessages that go between the client and server
/// </summary>
public abstract class AutomationMessage : ICloneable
{
#region PrivateClassMembers
private string _description;
protected AutomationMessageHeader _header;
#endregion
#region PrivateClassFunctions
/// <summary>
/// The constructor
/// </summary>
/// <param name="AutomationMessageId">The AutomationMessage id</param>
/// <param name="description">The AutomationMessage description</param>
/// <param name="messageId">The number of bytes in the payload of the AutomationMessage. (The number of bytes in the child class)</param>
protected AutomationMessage(uint messageId, string description, uint messageLength)
{
_description = description;
_header = new AutomationMessageHeader(messageId, messageLength);
}
/// <summary>
/// Copy Constructor
/// </summary>
/// <param name="message">The AutomationMessage to copy from</param>
protected AutomationMessage(AutomationMessage message)
{
_header = new AutomationMessageHeader(message._header);
_description = message._description;
}
/// <summary>
/// Sets the number of bytes in the entire AutomationMessage, including header.
/// Some times when receiving a AutomationMessage, you must instantiate the object before you know how many bytes the AutomationMessage is
/// </summary>
/// <param name="messageLength">The number of bytes in the entire AutomationMessage</param>
protected void SetMessageLen(uint messageLength)
{
_header.SetMessageLen(messageLength);
}
/// <summary>
/// abstract function for children to implement a clone of their object
/// </summary>
/// <returns></returns>
protected abstract object CloneSelf();
/// <summary>
/// abstract function for children to implement the function that they serve
/// </summary>
public abstract void ExecuteMsg();
/// <summary>
/// abstract function for children to implement the formatting of their parameters
/// </summary>
/// <param name="pData"></param>
protected abstract void FormatData(IntPtr pData);
/// <summary>
/// abstract function for children to implement the parsing of their parameters
/// </summary>
/// <param name="pData"></param>
protected abstract void ParseData(IntPtr pData);
#endregion
#region PublicClassFunctions
/// <summary>
/// Get a copy of the AutomationMessage object
/// </summary>
/// <returns></returns>
public object Clone()
{
// tell the child to clone itself
return this.CloneSelf();
}
/// <summary>
/// Encode the AutomationMessage into a byte array for sending
/// </summary>
/// <param name="pData">The buffer to put the AutomationMessage items</param>
public void Format(IntPtr pData)
{
_header.Format(pData);
IntPtr pPayload = IntPtr.Add(pData, (int)GetHeaderLength());
// ask child class to format its data
FormatData(pPayload);
}
/// <summary>
/// Getter
/// </summary>
/// <returns>The description</returns>
public string GetDescription()
{
return _description;
}
/// <summary>
/// Getter
/// </summary>
/// <returns>The number of bytes in the AutomationMessage, including header</returns>
public uint GetEntireMsgLength()
{
return _header.GetEntireMsgLength();
}
/// <summary>
/// getter
/// </summary>
/// <returns>The id</returns>
public uint GetMessageId()
{
return _header.GetMessageId();
}
/// <summary>
/// getter
/// </summary>
/// <returns>The number of bytes in the head</returns>
public uint GetHeaderLength()
{
return _header.GetHeaderLength();
}
/// <summary>
/// Takes an array of bytes and populates the AutomationMessage object
/// </summary>
/// <param name="pData">The AutomationMessage in byte form</param>
public void Parse(IntPtr pData)
{
_header.Parse(pData);
IntPtr pPayLoad = IntPtr.Add(pData, (int)GetHeaderLength());
ParseData(pPayLoad);
}
/// <summary>
/// Convert this AutomationMessage into string form
/// </summary>
/// <returns>The AutomationMessage in string form</returns>
public override string ToString()
{
return "Description: " + GetDescription() + "\n" + _header.ToString();
}
#endregion
}
}

View File

@@ -0,0 +1,160 @@
// **********************************************************************************************************
// AutomationMessageHeader.cs
// 1/8/2024
// NGI - Next Generation Interceptor
//
// Contract No. HQ0856-21-C-0003/1022000209
//
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
//
// 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.
//
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
//
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
//
// CONTROLLED BY: MISSILE DEFENSE AGENCY
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
// CUI CATEGORY: CTI
// DISTRIBUTION/DISSEMINATION CONTROL: F
// POC: Alex Kravchenko (1118268)
// **********************************************************************************************************
using System;
using System.Runtime.InteropServices;
namespace Raytheon.Common
{
/// <summary>
/// The header for all messages
/// </summary>
public class AutomationMessageHeader
{
#region PublicClassMembers
public const int HEADER_EXPECTED_SIZE = 8;
#endregion
#region PrivateClassMembers
[StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct HeaderStruct
{
public uint messageId;
public uint messageLength;// total msg size in bytes..Including the header.
};
private HeaderStruct _headerStruct;
#endregion
#region PublicClassFunctions
/// <summary>
/// Copy constructor
/// </summary>
/// <param name="header">The header to copy</param>
public AutomationMessageHeader(AutomationMessageHeader header)
{
_headerStruct = new HeaderStruct();
_headerStruct = header._headerStruct;
}
/// <summary>
/// Constructor for when receiving data.
/// Use this constructor and then parse to populate it
/// </summary>
public AutomationMessageHeader()
{
_headerStruct = new HeaderStruct();
}
/// <summary>
/// Constructor for sending
/// </summary>
/// <param name="msgId">the message id</param>
/// <param name="messageLength">The number of bytes in the message, not including the header</param>
public AutomationMessageHeader(uint msgId, uint messageLength)
{
_headerStruct = new HeaderStruct
{
messageId = msgId,
messageLength = messageLength + GetHeaderLength()
};
}
/// <summary>
/// Encode the header into a byte array for sending
/// </summary>
/// <param name="pData">The buffer to put the message items</param>
public void Format(IntPtr pData)
{
Marshal.StructureToPtr(_headerStruct, pData, true);
}
/// <summary>
/// Getter
/// </summary>
/// <returns>The number of bytes in the message, including header</returns>
public uint GetEntireMsgLength()
{
return _headerStruct.messageLength;
}
/// <summary>
/// getter
/// </summary>
/// <returns>The id</returns>
public uint GetMessageId()
{
return _headerStruct.messageId;
}
/// <summary>
/// getter
/// </summary>
/// <returns>The header length in bytes</returns>
public uint GetHeaderLength()
{
return (uint)Marshal.SizeOf(_headerStruct);
}
/// <summary>
/// Takes an array of bytes and populates the header object
/// </summary>
/// <param name="pData">The header in byte form</param>
public void Parse(IntPtr pData)
{
_headerStruct = (HeaderStruct)Marshal.PtrToStructure(pData, typeof(HeaderStruct));
}
/// <summary>
///
/// </summary>
/// <param name="messageLength"></param>
public void SetMessageLen(uint messageLength)
{
_headerStruct.messageLength = messageLength + GetHeaderLength();
}
/// <summary>
/// Creates a string version of the header members
/// </summary>
/// <returns>A string containing the header data</returns>
public override string ToString()
{
string msg = "Header Data:\r\n";
msg += "msg id: " + Convert.ToString(_headerStruct.messageId) + "\r\n";
msg += "msg len: " + Convert.ToString(_headerStruct.messageLength) + "\r\n";
return msg;
}
#endregion
}
}

View File

@@ -0,0 +1,198 @@
// ******************************************************************************//
// 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.
//
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
// PENALTIES.
//
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
// RECONSTRUCTION OF THE DOCUMENT.
// ****************************************************************************//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
namespace Raytheon.Common
{
/// <summary>
/// Implementation of the IConfigurationFile interface for Json file format
/// </summary>
public class JsonConfigurationFile : ConfigurationFileBase
{
private Dictionary<string, Dictionary<string, string>> _data;
/// <summary>
/// constructor
/// </summary>
/// <param name="fileName"></param>
/// <exception cref="ArgumentException"></exception>
public JsonConfigurationFile(string fileName)
: base(fileName)
{
if (_configurationType != ConfigurationFileType.JSON)
{
throw new ArgumentException("Expecting JSON file configuration type");
}
if (!_fileInfo.Exists)
{
using (File.Create(_fileInfo.FullName)) { }
}
}
/// <summary>
/// reads all available keys from given section from current configuration file
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
public override List<string> ReadAllKeys(string section)
{
string json = File.ReadAllText(_fileName);
if (!string.IsNullOrEmpty(json))
{
_data = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(json);
}
else
{
_data = new Dictionary<string, Dictionary<string, string>>();
}
return _data.ContainsKey(section) ? _data[section].Keys.ToList() : new List<string>();
}
/// <summary>
/// reads all available sections from current configuration file
/// </summary>
/// <returns>list of sections</returns>
public override List<string> ReadAllSections()
{
string json = File.ReadAllText(_fileName);
if (!string.IsNullOrEmpty(json))
{
_data = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(json);
}
else
{
_data = new Dictionary<string, Dictionary<string, string>>();
}
return _data.Keys.ToList();
}
public override List<T> ReadList<T>(string section, string key, IList<T> defList = null)
{
return ReadValue(section, key, defList).ToList();
}
/// <summary>
/// reads a single value in json format
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="defValue"></param>
/// <returns>configuration value</returns>
/// <exception cref="NotImplementedException"></exception>
public override T ReadValue<T>(string section, string key, T defValue = default)
{
string json = File.ReadAllText(_fileName);
if (!string.IsNullOrEmpty(json))
{
_data = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(json);
}
else
{
_data = new Dictionary<string, Dictionary<string, string>>();
}
if (_data.ContainsKey(section) && _data[section].ContainsKey(key))
{
return JsonConvert.DeserializeObject<T>(_data[section][key]);
}
else
{
WriteValue(section, key, defValue);
return defValue;
}
}
/// <summary>
/// reads a single value in json format
/// </summary>
/// <param name="section"></param>
/// <param name="key"></param>
/// <returns>configuration value</returns>
/// <exception cref="NotImplementedException"></exception>
public override string ReadValue(string section, string key)
{
throw new NotImplementedException();
}
/// <summary>
/// writes a list of values of any generic type
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="listToWrite"></param>
public override void WriteList<T>(string section, string key, IList<T> listToWrite)
{
WriteValue(section, key, listToWrite);
}
/// <summary>
/// writes a single value
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="lineToWrite"></param>
public override void WriteValue<T>(string section, string key, T lineToWrite)
{
string json = File.ReadAllText(_fileName);
if (!string.IsNullOrEmpty(json))
{
_data = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(json);
}
else
{
_data = new Dictionary<string, Dictionary<string, string>>();
}
if (!_data.ContainsKey(section))
{
_data[section] = new Dictionary<string, string>();
}
_data[section][key] = JsonConvert.SerializeObject(lineToWrite);
using (StreamWriter writer = new StreamWriter(_fileName, false))
{
writer.WriteLine(JsonConvert.SerializeObject(_data));
}
}
}
}

View File

@@ -0,0 +1,139 @@
// ******************************************************************************//
// 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.
//
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
// PENALTIES.
//
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
// RECONSTRUCTION OF THE DOCUMENT.
// ****************************************************************************//
// Ignore Spelling: Yaml
using System;
using System.Collections.Generic;
using System.IO;
namespace Raytheon.Common
{
public class YamlConfigurationFile : ConfigurationFileBase
{
//private Dictionary<string, Dictionary<string, string>> _data;
/// <summary>
/// constructor
/// </summary>
/// <param name="fileName"></param>
/// <exception cref="ArgumentException"></exception>
public YamlConfigurationFile(string fileName)
: base(fileName)
{
if (_configurationType != ConfigurationFileType.OTHER)
{
throw new ArgumentException("Expecting YAML file configuration type");
}
if (!_fileInfo.Exists)
{
using (File.Create(_fileInfo.FullName)) { }
}
}
/// <summary>
/// reads all available keys from given section from current configuration file
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
public override List<string> ReadAllKeys(string section)
{
throw new NotImplementedException();
}
/// <summary>
/// reads all available sections from current configuration file
/// </summary>
/// <returns>list of sections</returns>
public override List<string> ReadAllSections()
{
throw new NotImplementedException();
}
public override List<T> ReadList<T>(string section, string key, IList<T> defList = null)
{
throw new NotImplementedException();
}
/// <summary>
/// reads a single value in yaml format
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="defValue"></param>
/// <returns>configuration value</returns>
/// <exception cref="NotImplementedException"></exception>
public override T ReadValue<T>(string section, string key, T defValue = default)
{
throw new NotImplementedException();
}
/// <summary>
/// reads a single value in json format
/// </summary>
/// <param name="section"></param>
/// <param name="key"></param>
/// <returns>configuration value</returns>
/// <exception cref="NotImplementedException"></exception>
public override string ReadValue(string section, string key)
{
throw new NotImplementedException();
}
/// <summary>
/// writes a list of values of any generic type
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="listToWrite"></param>
public override void WriteList<T>(string section, string key, IList<T> listToWrite)
{
throw new NotImplementedException();
}
/// <summary>
/// writes a single value
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="lineToWrite"></param>
public override void WriteValue<T>(string section, string key, T lineToWrite)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Raytheon.Common
{
public class YamlConfigurationFileFactory : ConfigurationFileFactoryBase
{
/// <summary>
///
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public override IConfigurationFile CreateConfigurationFile(string fileName)
{
return new YamlConfigurationFile(fileName);
}
}
}

View File

@@ -0,0 +1,197 @@
// ******************************************************************************//
// 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.
//
// WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE
// EXPORT OR DISCLOSURE TO NON-U.S. PERSONS, WHEREVER LOCATED, IS RESTRICTED
// BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R. SECTION
// 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS (EAR) (15 C.F.R. SECTION
// 730-774). THIS DOCUMENT CANNOT BE EXPORTED (E.G., PROVIDED TO A SUPPLIER
// OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S. PERSON, WHEREVER
// LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS
// BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S. GOVERNMENT
// APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL
// PENALTIES.
//
// DOD 5220.22-M, INDUSTRIAL SECURITY MANUAL, CHAPTER 5, SECTION 1 THROUGH 9 :
// FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN OR DOD 5200.1-R,
// INFORMATION SECURITY PROGRAM, CHAPTER 6. FOR UNCLASSIFIED, LIMITED DOCUMENTS
// DESTROY BY ANY METHOD THAT WILL PREVENT DISCLOSURE OF CONTENTS OR
// RECONSTRUCTION OF THE DOCUMENT.
// ****************************************************************************//
using System;
using System.Collections.Generic;
namespace Raytheon.Common
{
/// <summary>
/// main class to be instantiated when working with configuration files
/// </summary>
public class ConfigurationFile : ConfigurationFileBase
{
/// <summary>
/// concrete implementation reference
/// </summary>
protected IConfigurationFile _configurationFile;
/// <summary>
/// Raytheon.Configuration will support INI and XML file formats.
/// For other formats have to use designated constructor
/// </summary>
/// <param name="fileName"></param>
/// <exception cref="InvalidOperationException"></exception>
public ConfigurationFile(string fileName)
: base(fileName)
{
if (!_fileInfo.Exists)
{
throw new Exception($"Can't find file: {fileName}");
}
var factory = GetFactory();
_configurationFile = factory.GetConfigurationFile(fileName);
}
/// <summary>
/// extension constructor, for other types based on the provided factory
/// </summary>
/// <param name="fileName"></param>
/// <param name="factory"></param>
public ConfigurationFile(string fileName, ConfigurationFileFactoryBase factory)
: base(fileName)
{
if (!_fileInfo.Exists)
{
throw new Exception($"Can't find file: {fileName}");
}
_configurationFile = factory.GetConfigurationFile(fileName);
}
/// <summary>
/// extension constructor, for other types based on provided type
/// </summary>
/// <param name="fileName"></param>
/// <param name="type"></param>
public ConfigurationFile(string fileName, string type)
: base(fileName)
{
if (!_fileInfo.Exists)
{
throw new Exception($"Can't find file: {fileName}");
}
ConfigurationFileFactory factory = new(type);
_configurationFile = factory.GetConfigurationFile(fileName);
}
/// <summary>
/// returns a factory based on file extension
/// </summary>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
private static ConfigurationFileFactoryBase GetFactory()
{
ConfigurationFileType configurationType = ConfigurationTypeFromFileExtension(_fileInfo.Extension);
ConfigurationFileFactoryBase factory = configurationType switch
{
ConfigurationFileType.INI => new IniConfigurationFileFactory(),
ConfigurationFileType.XML => new XmlConfigurationFileFactory(),
ConfigurationFileType.JSON => new JsonConfigurationFileFactory(),
ConfigurationFileType.TOML => new TomlConfigurationFileFactory(),
_ => throw new ArgumentException($"Configuration Type ({configurationType}) not supported by Configuration Manager"),
};
return factory;
}
/// <summary>
/// Reads all keys from a section of an ini file.
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
public override List<string> ReadAllKeys(string section)
{
return _configurationFile.ReadAllKeys(section);
}
/// <summary>
/// Returns a list of all of the sections in the ini file.
/// </summary>
/// <returns></returns>
public override List<string> ReadAllSections()
{
return _configurationFile.ReadAllSections();
}
/// <summary>
/// reads a list of values from configuration file
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="defList"></param>
/// <returns></returns>
public override List<T> ReadList<T>(string section, string key, IList<T> defList = null)
{
return _configurationFile.ReadList<T>(section, key, defList);
}
/// <summary>
/// reads a value from configuration file
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="defValue"></param>
/// <returns></returns>
public override T ReadValue<T>(string section, string key, T defValue = default)
{
return _configurationFile.ReadValue<T>(section, key, defValue);
}
/// <summary>
/// reads a single value in json format
/// </summary>
/// <param name="section"></param>
/// <param name="key"></param>
/// <returns>configuration value</returns>
/// <exception cref="NotImplementedException"></exception>
public override string ReadValue(string section, string key)
{
return _configurationFile.ReadValue(section, key);
}
/// <summary>
/// writes a list of values to configuration file
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="listToWrite"></param>
public override void WriteList<T>(string section, string key, IList<T> listToWrite)
{
_configurationFile.WriteList<T>(section, key, listToWrite);
}
/// <summary>
/// Write string value
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="section"></param>
/// <param name="key"></param>
/// <param name="lineToWrite"></param>
public override void WriteValue<T>(string section, string key, T lineToWrite)
{
_configurationFile.WriteValue(section, key, lineToWrite);
}
}
}

Some files were not shown because too many files have changed in this diff Show More