Files
GenericTeProgramLibrary/Source/Instruments/PowerSupplies/Keysight67XX/KeysightN67xxPowerSupply.cs

132 lines
4.2 KiB
C#

// 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);
}
}
}