Initial check-in
This commit is contained in:
25
Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj
Normal file
25
Source/Interfaces/PowerSupply/PowerSupply.Contracts.csproj
Normal file
@@ -0,0 +1,25 @@
|
||||
<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>
|
||||
53
Source/Interfaces/PowerSupply/PowerSupply.cs
Normal file
53
Source/Interfaces/PowerSupply/PowerSupply.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Source/Interfaces/PowerSupply/PowerSupplyConfigIni.cs
Normal file
47
Source/Interfaces/PowerSupply/PowerSupplyConfigIni.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// 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 enum PowerSupplyConfigIni
|
||||
{
|
||||
// list all the sections here
|
||||
GENERAL,
|
||||
|
||||
// list all the keys here
|
||||
ETHERNET_ADDRESS,
|
||||
ETHERNET_PORT,
|
||||
MODULE_DEFINITION,
|
||||
COUPLED_MODULES,
|
||||
GROUPED_MODULES,
|
||||
INDEX,
|
||||
OCP,
|
||||
OVP,
|
||||
VOLTAGE_SETPOINT,
|
||||
VOLTAGE_SLEW_RATE,
|
||||
MIN_VOLTAGE,
|
||||
MAX_VOLTAGE,
|
||||
MIN_CURRENT,
|
||||
MAX_CURRENT
|
||||
}
|
||||
}
|
||||
31
Source/Interfaces/PowerSupply/PowerSupplyConfigXml.cs
Normal file
31
Source/Interfaces/PowerSupply/PowerSupplyConfigXml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// 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 enum PowerSupplyConfigXml
|
||||
{
|
||||
// list all the keys here
|
||||
INI_FILE_PATH
|
||||
}
|
||||
}
|
||||
205
Source/Interfaces/PowerSupply/PowerSupplyModule.cs
Normal file
205
Source/Interfaces/PowerSupply/PowerSupplyModule.cs
Normal file
@@ -0,0 +1,205 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// 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 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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
70
Source/Interfaces/PowerSupply/PowerSupplyModuleInfo.cs
Normal file
70
Source/Interfaces/PowerSupply/PowerSupplyModuleInfo.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
// 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 class PowerSupplyModuleInfo
|
||||
{
|
||||
public PowerSupplyModuleInfo()
|
||||
{
|
||||
overCurrentProtection_ = -1.0;
|
||||
overVoltageProtection_ = -1.0;
|
||||
voltageSetpoint_ = -1.0;
|
||||
voltageSlewRate_ = -1.0;
|
||||
lowerVoltageLimit_ = -1.0;
|
||||
upperVoltageLimit_ = -1.0;
|
||||
lowerCurrentLimit_ = -1.0;
|
||||
upperCurrentLimit_ = -1.0;
|
||||
isOn_ = false;
|
||||
faultStatus = -1;
|
||||
}
|
||||
|
||||
public PowerSupplyModuleInfo(string moduleIndex, double overCurrentProtection, double overVoltageProtection, double voltageSetpoint, double voltageSlewRate, double minVoltage, double maxVoltage, double minCurrent, double maxCurrent)
|
||||
{
|
||||
overCurrentProtection_ = overCurrentProtection;
|
||||
overVoltageProtection_ = overVoltageProtection;
|
||||
voltageSetpoint_ = voltageSetpoint;
|
||||
voltageSlewRate_ = voltageSlewRate;
|
||||
lowerVoltageLimit_ = minVoltage;
|
||||
upperVoltageLimit_ = maxVoltage;
|
||||
lowerCurrentLimit_ = minCurrent;
|
||||
upperCurrentLimit_ = maxCurrent;
|
||||
isOn_ = false;
|
||||
faultStatus = -1;
|
||||
|
||||
moduleNameFormat = "(@" + moduleIndex + ")";
|
||||
}
|
||||
|
||||
public string moduleNameFormat;
|
||||
public double overCurrentProtection_;
|
||||
public double overVoltageProtection_;
|
||||
public double lowerVoltageLimit_;
|
||||
public double upperVoltageLimit_;
|
||||
public double lowerCurrentLimit_;
|
||||
public double upperCurrentLimit_;
|
||||
public double voltageSetpoint_;
|
||||
public double voltageSlewRate_;
|
||||
public bool isOn_;
|
||||
public int faultStatus;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user