Initial check-in
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// 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.Drawing;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_powerSupply != null)
|
||||
{
|
||||
return _powerSupply[null].FrontPanelEnabled;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_powerSupply != null)
|
||||
{
|
||||
_powerSupply[null].FrontPanelEnabled = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="stePowerSupplyInstanceName">the name specified in the Instruments.xml file</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>
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user