diff --git a/.gitignore b/.gitignore
index bf72415..1fcd98b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
\ No newline at end of file
+FodyWeavers.xsd
+
+!**/HAL/Implementations/BIT/COEComm/build/**
\ No newline at end of file
diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.cs b/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.cs
deleted file mode 100644
index e8f6fbf..0000000
--- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class for controlling a TCP client communication device
- ///
- 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;
-
- ///
- /// NLog logger
- ///
- private static ILogger _logger;
- ///
- /// Raytheon configuration
- ///
- 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
-
- ///
- /// CommDevice factory constructor
- ///
- ///
- ///
- 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;
- }
- }
-
- ///
- /// Constructor
- ///
- ///
- ///
- public TcpClient(string remoteAddress, int remotePort)
- {
- _remoteAddress = remoteAddress;
- _remotePort = remotePort;
- }
-
- ///
- /// initialize instrument
- ///
- 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);
- }
-
- ///
- /// Connect to remote host
- ///
- ///
- 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; }
- }
- }
-
- ///
- /// Disconnect from remote host
- ///
- ///
- public void Disconnect()
- {
- lock (_syncObj)
- {
- if (_sock.Connected)
- {
- _sock.Shutdown(SocketShutdown.Both);
- _sock.Disconnect(true);
- _sock.Close();
- }
- }
- }
-
- ///
- /// Ping if remote host is alive
- ///
- /// true/false
- 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;
- }
-
- ///
- /// Read data from the device.
- ///
- ///
- ///
- /// The number of bytes read
- public uint Read(ref byte[] dataBuf)
- {
- int bytesRec = 0;
- lock (_syncObj)
- {
- try
- {
- bytesRec = _sock.Receive(dataBuf);
- }
- catch (SocketException)
- {
- bytesRec = 0;
- }
- }
-
- return (uint)bytesRec;
- }
-
- ///
- /// Sets the read timeout
- ///
- ///
- public void SetReadTimeout(uint timeoutMs)
- {
- _sock.ReceiveTimeout = (int)timeoutMs;
- }
-
- ///
- /// Write data to device.
- ///
- ///
- /// The number of bytes written
- 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
- }
-}
diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.csproj b/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.csproj
deleted file mode 100644
index fb157c4..0000000
--- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClient.csproj
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- net472
- Library
- Raytheon.Instruments.EthernetSockets.TcpClient
- Raytheon.Instruments
- CommDevice TCP implementation
- CommDevice TCP implementation
- true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
- Raytheon Technologies
- TEEC
- Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))
-
-
-
-
-
- 1.0.0
- Debug;Release;Deploy
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientFactory.cs b/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientFactory.cs
deleted file mode 100644
index 74411ff..0000000
--- a/Source/Instruments/EthernetSockets/CommDeviceTcpClient/TcpClientFactory.cs
+++ /dev/null
@@ -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
- {
- ///
- /// The supported interfaces
- ///
- private readonly List _supportedInterfaces = new List();
- 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)
- {
- }
-
- ///
- /// COECommDeviceInstrumentFactory injection constructor
- ///
- ///
- ///
- ///
- [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));
- }
-
- ///
- /// Gets the instrument
- ///
- ///
- ///
- 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;
- }
- }
-
- ///
- /// Gets the instrument
- ///
- ///
- ///
- 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;
- }
- }
-
- ///
- /// Gets supported interfaces
- ///
- ///
- public ICollection GetSupportedInterfaces()
- {
- return _supportedInterfaces.ToArray();
- }
-
- ///
- /// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
- ///
- ///
- private static IConfigurationManager GetConfigurationManager()
- {
- return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
- }
- }
-}
\ No newline at end of file
diff --git a/Source/Instruments/GeneralIntsrumentManager/GeneralIntsrumentManager.csproj b/Source/Instruments/GeneralIntsrumentManager/GeneralIntsrumentManager.csproj
deleted file mode 100644
index 304b978..0000000
--- a/Source/Instruments/GeneralIntsrumentManager/GeneralIntsrumentManager.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
- net472
- Library
- Raytheon.Instruments.InstrumentManager.GeneralInstrumentManager
- Raytheon.Instruments
- true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
- Raytheon Technologies
- General Instrument Manager
- TEEC
- Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))
- Instrument Manager that works with RINSS or without RINSS
-
- 1.4.1
- Debug;Release;Deploy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67XX.csproj b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67XX.csproj
deleted file mode 100644
index eadf81c..0000000
--- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67XX.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
- net472
- Library
- Raytheon.Instruments.PowerSupplies.Keysight67XX
- Raytheon.Instruments
- Keysight 67XX Series Power Supply
- Keysight 67XX Series Power Supply
- true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
- Raytheon Technologies
- TEEC
- Copyright © Raytheon Technologies $(Year)
-
-
-
-
-
- 1.0.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerFactory.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerFactory.cs
deleted file mode 100644
index f5cbe95..0000000
--- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerFactory.cs
+++ /dev/null
@@ -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
- {
- ///
- /// The supported interfaces
- ///
- private readonly List _supportedInterfaces = new List();
- 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)
- {
- }
-
- ///
- /// COECommDeviceInstrumentFactory injection constructor
- ///
- ///
- ///
- ///
- [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));
- }
-
- ///
- /// Gets the instrument
- ///
- ///
- ///
- public IInstrument GetInstrument(string name)
- {
- return null;
- }
-
- ///
- /// Gets the instrument
- ///
- ///
- ///
- 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;
- }
- }
-
- ///
- /// Gets supported interfaces
- ///
- ///
- public ICollection GetSupportedInterfaces()
- {
- return _supportedInterfaces.ToArray();
- }
-
- ///
- /// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
- ///
- ///
- private static IConfigurationManager GetConfigurationManager()
- {
- return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
- }
- }
-}
\ No newline at end of file
diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerModule.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerModule.cs
deleted file mode 100644
index 752b47c..0000000
--- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerModule.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class to simulate any power supply module
- ///
- class KeysightN67xxPowerModule : PowerSupplyModule
- {
- private List _groupedModules;
- private List _coupledModules;
- private string _powerSupplySystemName;
- private EthernetSockets.TcpClient _tcpClient;
- IConfigurationFile _config;
-
- private ILogger _logger;
-
- ///
- /// Constructor
- ///
- 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();
- }
- }
-
- ///
- /// Enable or Disable Front Panel
- ///
- ///
- ///
- public override bool DisplayEnabled
- {
- set
- {
- SemObj?.Release();
- }
- }
-
- ///
- /// Enable or disable Front Panel
- ///
- ///
- ///
- 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(); }
- }
- }
-
- ///
- /// Turn on power module's output
- ///
- ///
- ///
- public override void On()
- {
- try
- {
- lock (SyncObj)
- {
- CheckActivePowerModuleValidity();
-
- string command = KeysightPowerSupplyScpiCommands.SET_OUTPUT_ENABLE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
-
- SendCommand(command);
- }
- }
- finally { SemObj?.Release(); }
- }
-
- ///
- /// Turn off power module's output
- ///
- ///
- ///
- public override void Off()
- {
- try
- {
- lock (SyncObj)
- {
- CheckActivePowerModuleValidity();
-
- string command = KeysightPowerSupplyScpiCommands.SET_OUTPUT_DISABLE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
-
- SendCommand(command);
- }
- }
- finally { SemObj?.Release(); }
- }
-
- ///
- /// Perform self test
- ///
- ///
- ///
- 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;
- }
-
- ///
- /// Set constant voltage mode
- ///
- ///
- ///
- private void SetConstantVoltageMode()
- {
- lock (SyncObj)
- {
- string command = KeysightPowerSupplyScpiCommands.SET_CONSTANT_VOLTAGE_CMD + "," + PowerModuleInfoDict[ActivePowerModule].moduleNameFormat + "\n";
-
- SendCommand(command);
- }
- }
-
- ///
- /// Set and Confirm OVP
- ///
- ///
- ///
- 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}");
- }
- }
-
- ///
- /// Set and Confirm OCP
- ///
- ///
- ///
- 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}");
- }
- }
-
- ///
- /// Set and Confirm Voltage Setpoint
- ///
- ///
- ///
- 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}");
- }
- }
-
- ///
- /// Set and Confirm Slew Rate
- ///
- ///
- ///
- 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}");
- }
- }
- }
-
- ///
- /// Get error code
- ///
- ///
- ///
- 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;
- }
-
- ///
- /// Read voltage
- ///
- ///
- ///
- 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;
- }
-
- ///
- /// Read current
- ///
- ///
- ///
- 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;
-
- }
-
- ///
- /// Read protection status
- ///
- ///
- ///
- 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;
- }
-
- ///
- /// Determine if module's output is on
- ///
- ///
- ///
- 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;
- }
-
- ///
- /// When modules are grouped, they act as one module
- ///
- ///
- ///
- private void GroupModules(List 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;
- }
- }
- }
-
- ///
- /// 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
- ///
- ///
- ///
- private void CoupleModules(List 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;
- }
- }
-
- ///
- /// Reset Power Supply System
- ///
- ///
- ///
- private void ResetPowerSupplySystem()
- {
- // send the command
- string command = KeysightPowerSupplyScpiCommands.RESET_CMD + "\n";
- SendCommand(command);
- }
-
- ///
- /// Send command
- ///
- ///
- ///
- private void SendCommand(string command)
- {
- lock (SyncObj)
- {
- byte[] msg = Encoding.ASCII.GetBytes(command);
-
- _tcpClient.Write(msg, (uint)msg.Length);
- }
- }
-
- ///
- /// Send command and get response
- ///
- ///
- ///
- 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);
- }
- }
- }
-}
diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs
deleted file mode 100644
index 7a4b607..0000000
--- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class for controlling a Keysightt N6700 Series Power Supply System
- ///
- public class KeysightN67xxPowerSupply : PowerSupply
- {
- private string _iniFilePath;
-
- private static ILogger _logger;
- private readonly IConfigurationManager _configurationManager;
- private readonly IConfiguration _configuration;
-
- ///
- /// Constructor
- ///
- 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"));
- }
-
- ///
- /// Perform shutdown
- ///
- ///
- ///
- public override void Shutdown()
- {
- }
-
- ///
- /// Perform reset
- ///
- ///
- ///
- public override void Reset()
- {
- }
-
- ///
- /// Clear errors
- ///
- ///
- ///
- public override bool ClearErrors()
- {
- return true;
- }
-
- ///
- /// Implement Indexer in order to access a specific power module
- ///
- ///
- ///
- 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;
- }
- }
-
- ///
- /// Group or couple modules as specified in config file
- /// Gather information for each power module from config file
- ///
- ///
- ///
- public override void Initialize()
- {
- _powerSupplyModule = new KeysightN67xxPowerModule(_iniFilePath, Name);
- }
- }
-}
diff --git a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightPowerSupplyScpiCommands.cs b/Source/Instruments/PowerSupplies/Keysight67XX/KeysightPowerSupplyScpiCommands.cs
deleted file mode 100644
index 12694dd..0000000
--- a/Source/Instruments/PowerSupplies/Keysight67XX/KeysightPowerSupplyScpiCommands.cs
+++ /dev/null
@@ -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?";
- }
-}
diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplyModuleSim.cs b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplyModuleSim.cs
deleted file mode 100644
index 595ea3f..0000000
--- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplyModuleSim.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class to simulate any power supply module
- ///
- class PowerSupplyModuleSim : PowerSupplyModule
- {
- private List _groupedModules;
- private List _coupledModules;
- private string _powerSupplySystemName;
- private bool _frontPanelEnabled = true;
-
- private ILogger _logger;
-
- ///
- /// Constructor
- ///
- 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);
- }
- }
-
- ///
- /// Enable or Disable Front Panel
- ///
- ///
- ///
- public override bool DisplayEnabled
- {
- set { SemObj?.Release(); }
- }
-
- ///
- /// Enable or disable Front Panel
- ///
- ///
- ///
- public override bool FrontPanelEnabled
- {
- set {_frontPanelEnabled = value; SemObj?.Release(); }
- }
-
- ///
- /// Turn on power module's output
- ///
- ///
- ///
- 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(); }
- }
-
- ///
- /// Turn off power module's output
- ///
- ///
- ///
- 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(); };
- }
-
- ///
- /// Perform self test
- ///
- ///
- ///
- public override SelfTestResult PerformSelfTest()
- {
- try
- {
- lock (SyncObj)
- {
- SelfTestResult = SelfTestResult.Pass;
- }
- }
- finally { SemObj?.Release(); };
-
- return SelfTestResult;
- }
-
- ///
- /// Read voltage
- ///
- ///
- ///
- protected override double ReadVoltage()
- {
- double val = 0.0;
-
- lock (SyncObj)
- {
- if (PowerModuleInfoDict[ActivePowerModule].isOn_)
- val = PowerModuleInfoDict[ActivePowerModule].voltageSetpoint_;
- }
-
- return val;
- }
-
- ///
- /// Read current
- ///
- ///
- ///
- 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;
- }
-
- ///
- /// Read protection status
- ///
- ///
- ///
- protected override int ReadProtectionStatus()
- {
- lock (SyncObj)
- {
- return 0;
- }
- }
-
- ///
- /// Get error code
- ///
- ///
- ///
- protected override string GetErrorCode(out int errorCode)
- {
- lock (SyncObj)
- {
- errorCode = 0;
- return "";
- }
- }
-
- }
-}
diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.cs b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.cs
deleted file mode 100644
index 5504d21..0000000
--- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class to simulate any power supply system
- ///
- public class PowerSupplySim : PowerSupply
- {
- private string _iniFilePath;
-
- private static ILogger _logger;
- private readonly IConfigurationManager _configurationManager;
- private readonly IConfiguration _configuration;
-
- ///
- /// Constructor
- ///
- 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"));
- }
-
- ///
- /// Perform shutdown
- ///
- ///
- ///
- public override void Shutdown()
- {
- }
-
- ///
- /// Perform reset
- ///
- ///
- ///
- public override void Reset()
- {
- }
-
- ///
- /// Clear errors
- ///
- ///
- ///
- public override bool ClearErrors()
- {
- return true;
- }
-
- ///
- /// Group or couple modules as specified in config file
- /// Gather information for each power module from config file
- ///
- ///
- ///
- public override void Initialize()
- {
- _powerSupplyModule = new PowerSupplyModuleSim(_iniFilePath, Name);
- }
-
- ///
- /// Implement Indexer to obtain a power module
- ///
- ///
- ///
- 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;
- }
- }
- }
-}
diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.csproj b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.csproj
deleted file mode 100644
index 64384fc..0000000
--- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySim.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
- net472
- Library
- Raytheon.Instruments.PowerSupplies.Simulation
- Raytheon.Instruments
- Power Supply Simulation
- Power Supply Simulation
- true
- $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
- Raytheon Technologies
- TEEC
- Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))
-
-
-
-
-
- 1.0.0
- Debug;Release;Deploy
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySimFactory.cs b/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySimFactory.cs
deleted file mode 100644
index fae00d2..0000000
--- a/Source/Instruments/PowerSupplies/PowerSupplySim/PowerSupplySimFactory.cs
+++ /dev/null
@@ -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
- {
- ///
- /// The supported interfaces
- ///
- private readonly List _supportedInterfaces = new List();
- 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)
- {
- }
-
- ///
- /// COECommDeviceInstrumentFactory injection constructor
- ///
- ///
- ///
- ///
- [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));
- }
-
- ///
- /// Gets the instrument
- ///
- ///
- ///
- public IInstrument GetInstrument(string name)
- {
- return null;
- }
-
- ///
- /// Gets the instrument
- ///
- ///
- ///
- 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;
- }
- }
-
- ///
- /// Gets supported interfaces
- ///
- ///
- public ICollection GetSupportedInterfaces()
- {
- return _supportedInterfaces.ToArray();
- }
-
- ///
- /// returns confiuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
- ///
- ///
- private static IConfigurationManager GetConfigurationManager()
- {
- return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
- }
- }
-}
\ No newline at end of file
diff --git a/Source/Interfaces/ICommDevice/CommDevice.Contracts.csproj b/Source/Interfaces/ICommDevice/CommDevice.Contracts.csproj
deleted file mode 100644
index d3d1df5..0000000
--- a/Source/Interfaces/ICommDevice/CommDevice.Contracts.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- net472
- Library
- Raytheon.Instruments.CommDevice.Contracts
- Raytheon.Instruments
- ICommDevice interface definition
- true
- Raytheon Technologies
- HAL
- TEEC
- Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))
-
- 1.0.0
- Debug;Release;Deploy
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Interfaces/ICommDevice/ICommDevice.cs b/Source/Interfaces/ICommDevice/ICommDevice.cs
deleted file mode 100644
index e85c655..0000000
--- a/Source/Interfaces/ICommDevice/ICommDevice.cs
+++ /dev/null
@@ -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
-{
- ///
- /// An interface to any device that you can write and read to/from
- ///
- public interface ICommDevice : IInstrument
- {
- ///
- /// Close the communication interface
- ///
- [UmsCommand("ICommDevice.Close")]
- void Close();
-
- ///
- /// Open the communication interface
- ///
- [UmsCommand("ICommDevice.Open")]
- void Open();
-
- ///
- /// Reads data from a communication device
- ///
- ///
- /// number of bytes read
- [UmsCommand("ICommDevice.Read")]
- uint Read(ref byte[] dataRead);
-
- ///
- /// Set the timeout on a read
- ///
- ///
- [UmsCommand("ICommDevice.SetReadTimeout")]
- void SetReadTimeout(uint timeout);
-
- ///
- /// Writes data to a communication device
- ///
- ///
- ///
- /// the number of bytes written
- [UmsCommand("ICommDevice.Write")]
- uint Write(byte[] data, uint numBytesToWrite);
- }
-}
diff --git a/Source/Interfaces/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj b/Source/Interfaces/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj
deleted file mode 100644
index da6120c..0000000
--- a/Source/Interfaces/IInstrumentManager/Instruments.InstrumentManager.Contracts.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- net472
- Library
- Raytheon.Instruments.InstrumentManager.Contracts
- Raytheon.Instruments
- Raytheon Technologies
- Raytheon Configuration
- Instrument Manager Interface
- TEEC
- Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))
- True
-
- 1.7.1.0
- Debug;Release;Deploy
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj b/Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj
deleted file mode 100644
index ecc1000..0000000
--- a/Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- net472
- Library
- Raytheon.Instruments.PowerSupply.Contracts
- Raytheon.Instruments
- PowerSupply Interface
- true
- Raytheon Technologies
- HAL
- TEEC
- Copyright © Raytheon Technologies $([System.DateTime]::get_now().ToString("yyyy"))
- 1.1.0.0
- Debug;Release;Deploy
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Interfaces/PowerSupply/PowerSupply.cs b/Source/Interfaces/PowerSupply/PowerSupply.cs
deleted file mode 100644
index 960964b..0000000
--- a/Source/Interfaces/PowerSupply/PowerSupply.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Base class that defines interface for power supply systems
- ///
- public abstract class PowerSupply : Instrument
- {
- protected PowerSupplyModule _powerSupplyModule;
-
- ///
- /// Implement Indexer in order to access a specific power module
- ///
- ///
- ///
- public virtual PowerSupplyModule this[object i]
- {
- get { return null; }
- }
-
- ///
- /// Get power supply module info dictionary
- ///
- ///
- ///
- public Dictionary GetPowerSupplyModuleInfoDict()
- {
- return _powerSupplyModule.PowerModuleInfoDict;
- }
-
- ///
- /// Get power supply module names
- ///
- ///
- ///
- public List GetPowerSupplyModuleNames()
- {
- return _powerSupplyModule.PowerModules;
- }
- }
-}
diff --git a/Source/Interfaces/PowerSupply/PowerSupplyModule.cs b/Source/Interfaces/PowerSupply/PowerSupplyModule.cs
deleted file mode 100644
index 178fbd8..0000000
--- a/Source/Interfaces/PowerSupply/PowerSupplyModule.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Base class that defines interface for power supply modules
- ///
- 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 PowerModules { get; protected set; }
-
- public Dictionary PowerModuleInfoDict { get; protected set; }
-
- ///
- /// Constructor
- ///
- public PowerSupplyModule()
- {
- PowerModuleInfoDict = new Dictionary();
- }
-
- ///
- /// 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
- ///
- public virtual bool DisplayEnabled
- {
- get;
- set;
- }
-
- ///
- /// 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
- ///
- public virtual bool FrontPanelEnabled
- {
- private get;
- set;
- }
-
- ///
- /// SelfTestResult - end result of the hardware self test performed
- ///
- public SelfTestResult SelfTestResult
- {
- get;
- set;
- }
-
- ///
- /// PerformSelfTest - do a hardware self test
- ///
- /// result of the self test
- public abstract SelfTestResult PerformSelfTest();
-
- ///
- /// Set active module
- ///
- ///
- ///
- public void SetActivePowerModule(string activePowerModule)
- {
- ActivePowerModule = activePowerModule;
- }
-
- ///
- /// Check if active module is valid
- ///
- ///
- ///
- 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}");
- }
-
- ///
- /// Return semaphore
- ///
- ///
- ///
- public Semaphore GetSemphamore() { return SemObj; }
-
- ///
- /// Turn on power module's output
- ///
- ///
- ///
- public abstract void On();
-
- ///
- /// Turn off power module's output
- ///
- ///
- ///
- public abstract void Off();
-
- ///
- /// Determine if module's output is on
- ///
- ///
- ///
- protected virtual bool IsOutputOn()
- {
- bool isOn = false;
-
- lock (SyncObj)
- {
- CheckActivePowerModuleValidity();
-
- isOn = PowerModuleInfoDict[ActivePowerModule].isOn_;
- }
-
- return isOn;
- }
-
- ///
- /// Read power supply module's data all at once
- ///
- ///
- ///
- 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(); };
- }
-
- ///
- /// Read voltage
- ///
- ///
- ///
- protected abstract double ReadVoltage();
-
- ///
- /// Read current
- ///
- ///
- ///
- protected abstract double ReadCurrent();
-
- ///
- /// Read protection status
- ///
- ///
- ///
- protected abstract int ReadProtectionStatus();
-
- ///
- /// Get error code
- ///
- ///
- ///
- protected abstract string GetErrorCode(out int errorCode);
- }
-}
diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerModuleMeasurementManager.cs b/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerModuleMeasurementManager.cs
deleted file mode 100644
index 1636769..0000000
--- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerModuleMeasurementManager.cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class for controlling all power supplies
- ///
- public class PowerModuleMeasurementManager
- {
- #region PrivateClassMembers
- ///
- /// NLog logger
- ///
- 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;
- }
- }
- }
-
- ///
- /// constructor
- ///
- ///
- public PowerModuleMeasurementManager(PowerSupply powerSupply, IConfigurationFile powerOffAndSelfTestConfig)
- {
- _logger = LogManager.GetCurrentClassLogger();
-
- _powerSupply = powerSupply;
- _powerOffAndSelfTestConfig = powerOffAndSelfTestConfig;
- }
-
- ///
- /// The Finalizer
- ///
- ~PowerModuleMeasurementManager()
- {
- _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
- }
-
- ///
- /// Initialize the instrument(s)
- ///
- public void Initialize()
- {
- _logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
- }
-
- ///
- /// Shuts down manager, clears resources
- ///
- public void Shutdown()
- {
- _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
- _powerSupply.Shutdown();
- }
-
- ///
- /// Read various power supply data
- ///
- 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);
- }
-
- ///
- /// Get all the names of modules in the power system
- ///
- public List GetModuleNames()
- {
- return _powerSupply.GetPowerSupplyModuleNames();
- }
-
- ///
- /// Get all the configuration information for each module
- ///
- public Dictionary GetPowerSupplyModuleInfoDict()
- {
- return _powerSupply.GetPowerSupplyModuleInfoDict();
- }
-
- ///
- /// Enable the output of the power supply.
- ///
- /// The name of the module to enable.
- public void OutputEnable(object module)
- {
- _powerSupply[module].On();
- }
-
- ///
- /// Disable the output of the power supply.
- ///
- ///
- ///
- 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);
- }
- }
- }
-}
diff --git a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager .cs b/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager .cs
deleted file mode 100644
index b4e5869..0000000
--- a/Source/MeasurementManagers/PowerSupplyMeasurementManager/PowerSupplyMeasurementManager .cs
+++ /dev/null
@@ -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
-{
- ///
- /// Class for controlling all power supplies
- ///
- public class PowerSupplyMeasurementManager
- {
- #region PrivateClassMembers
- ///
- /// NLog logger
- ///
- private static NLog.ILogger _logger;
-
- private IConfigurationFile _powerOffAndSelfTestConfig;
-
- private IInstrumentManager _instrumentManager;
-
- private Dictionary _powerSystemNameToPowerModuleMeasurementManagerDict = new Dictionary();
-
- string _powerSystemWithFailedSelfTest = String.Empty;
-
- #endregion
-
- ///
- /// constructor
- ///
- /// the name specified in the Instruments.xml file
- public PowerSupplyMeasurementManager(IInstrumentManager instrumentManager, string powerSupplySelfTestLogFile)
- {
- _logger = LogManager.GetCurrentClassLogger();
-
- _powerOffAndSelfTestConfig = new ConfigurationFile(powerSupplySelfTestLogFile);
-
- _instrumentManager = instrumentManager;
- }
-
- ///
- /// The Finalizer
- ///
- ~PowerSupplyMeasurementManager()
- {
- _logger?.Debug($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() ...");
- }
-
- ///
- /// Implement Indexer to obtain a powermodulemeasurementmanager
- ///
- ///
- ///
- 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];
- }
- }
-
- ///
- /// Initialize the instrument(s)
- ///
- 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.");
- }
- }
-
- ///
- /// 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)
- ///
- ///
- ///
- private async void PerformSelfTest()
- {
- _logger.Trace($"Entering {this.GetType().Name}::{System.Reflection.MethodBase.GetCurrentMethod().Name}() method...");
-
- string errorMsg = String.Empty;
-
- Dictionary> powerSystemToSelfTestTaskDict = new Dictionary>();
-
- bool allSelfTestsPassed = true;
-
- ICollection