Big changes

This commit is contained in:
Duc
2025-03-13 12:04:22 -07:00
parent c689fcb7f9
commit ffa9905494
748 changed files with 199255 additions and 3743 deletions

View File

@@ -0,0 +1,188 @@
// *******************************************************************************************
// ** **
// ** DCPwrSentry.cs
// ** 4/14/2023
// ** **
// ** 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 2023.
// ** **
// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE **
// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED **
// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION **
// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION **
// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER **
// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER **
// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS **
// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT **
// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL **
// ** PENALTIES. **
// ** **
// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED **
// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE **
// ** PROJECTS/PROGRAMS. **
// ** **
// *******************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raytheon.Communication;
namespace Raytheon.Instruments
{
/// <summary>
/// SHUTS DOWN ALL SUPPLIES WHEN AN OVER CURRENT OR VOLTAGE OCCURS
/// This interface will define instruments that watch DCPwr supplies
/// and monitor their over current and voltage limits, when one of the power supplies
/// trips, the others will be shutdown.
/// </summary>
[UmsContract]
public sealed class DCPwrSentry
{
#region Private Fields
private HashSet<IDCPwr> _Supplies = new HashSet<IDCPwr>();
private volatile object _SupplyLock = new object();
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="DCPwrSentry"/> class.
/// </summary>
public DCPwrSentry()
{
}
#endregion
#region Public Methods
/// <summary>
/// Adds the specified supply to monitor and be shut down if the
/// other supplies over current or over voltage
/// </summary>
/// <param name="supply">The supply.</param>
[UmsCommand("IDCPwrSentry.Add")]
public void Add(IDCPwr supply)
{
if (null != supply && !_Supplies.Contains(supply))
{
lock (_SupplyLock)
{
_Supplies.Add(supply);
supply.OverCurrent += new EventHandler<OverCurrentEventArgs>(supply_OverCurrent);
supply.OverVoltage += new EventHandler<OverVoltageEventArgs>(supply_OverVoltage);
}
}
}
/// <summary>
/// Removes the specified supply to monitor and be shut down if the
/// other supplies over current or over voltage
/// </summary>
/// <param name="supply">The supply.</param>
[UmsCommand("IDCPwrSentry.Remove")]
public void Remove(IDCPwr supply)
{
if (null != supply && _Supplies.Contains(supply))
{
lock (_SupplyLock)
{
_Supplies.Remove(supply);
supply.OverVoltage -= this.supply_OverVoltage;
supply.OverCurrent -= this.supply_OverCurrent;
}
}
}
#endregion
#region Public Events
/// <summary>
/// Occurs when any of the supplies over current.
/// </summary>
[UmsEvent("IDCPwrSentry.OverCurrent")]
public event EventHandler<OverCurrentEventArgs> OverCurrent;
/// <summary>
/// Occurs when any of the supplies over voltage.
/// </summary>
[UmsEvent("IDCPwrSentry.OverVoltage")]
public event EventHandler<OverVoltageEventArgs> OverVoltage;
#endregion
#region Private Event Handlers From Supplies
private void supply_OverCurrent(object sender, OverCurrentEventArgs e)
{
//lock our supply list, no changing mid event handling
lock (_SupplyLock)
{
//turn off all supplies
ShutdownSupplies();
//notify listeners
if (null != OverCurrent)
{
OverCurrent(this, new OverCurrentEventArgs(_Supplies));
}
}
}
private void supply_OverVoltage(object sender, OverVoltageEventArgs e)
{
//lock our supply list, no changing mid event handling
lock (_SupplyLock)
{
//turn off all supplies
ShutdownSupplies();
//notify listeners
if (null != OverVoltage)
{
OverVoltage(this, new OverVoltageEventArgs(_Supplies));
}
}
}
private void ShutdownSupplies()
{
//lock our supply list, no changing mid event handling
lock (_SupplyLock)
{
//turn off all supplies
foreach (var supply in _Supplies)
{
try
{
supply.Enabled = false;
}
catch (InstrumentException)
{
//catch the instrument exceptions on the supplies we are
//trying to shut down that have over current or voltaged
}
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,206 @@
// *******************************************************************************************
// ** **
// ** IDCPwr.cs
// ** 4/14/2023
// ** **
// ** 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 2023.
// ** **
// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE **
// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED **
// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION **
// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION **
// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER **
// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER **
// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS **
// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT **
// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL **
// ** PENALTIES. **
// ** **
// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED **
// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE **
// ** PROJECTS/PROGRAMS. **
// ** **
// *******************************************************************************************
using System;
using Raytheon.Communication;
using Raytheon.Units;
namespace Raytheon.Instruments
{
/// <summary>
/// IDCPwr - simple dc power supply interface
/// </summary>
[UmsContract]
public interface IDCPwr : IInstrument
{
/// <summary>
/// Gets or sets the current limit.
/// </summary>
/// <value>
/// The current limit.
/// </value>
Current CurrentLimit
{
[UmsCommand("IDCPwr.GetCurrentLimit")]
get;
[UmsCommand("IDCPwr.SetCurrentLimit")]
set;
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="IDCPwr"/> is enabled.
/// </summary>
/// <value>
/// <c>true</c> if enabled; otherwise, <c>false</c>.
/// </value>
bool Enabled
{
[UmsCommand("IDCPwr.GetEnabled")]
get;
[UmsCommand("IDCPwr.SetEnabled")]
set;
}
/// <summary>
/// Measures the current.
/// </summary>
/// <returns>current within <see cref="Current"/></returns>
[UmsCommand("IDCPwr.MeasureCurrent")]
Current MeasureCurrent();
/// <summary>
/// Measures the voltage.
/// </summary>
/// <returns>voltage within <see cref="Voltage"/></returns>
[UmsCommand("IDCPwr.MeasureVoltage")]
Voltage MeasureVoltage();
/// <summary>
/// Gets or sets the output voltage.
/// </summary>
/// <value>
/// The output voltage within <see cref="Voltage"/>
/// </value>
Voltage OutputVoltage
{
[UmsCommand("IDCPwr.GetOutputVoltage")]
get;
[UmsCommand("IDCPwr.SetOutputVoltage")]
set;
}
/// <summary>
/// Gets or sets the over voltage protection.
/// </summary>
/// <value>
/// The over voltage protection within <see cref="Voltage"/>
/// </value>
Voltage OverVoltageProtection
{
[UmsCommand("IDCPwr.GetOverVoltageProtection")]
get;
[UmsCommand("IDCPwr.SetOverVoltageProtection")]
set;
}
/// <summary>
/// Gets or sets a value indicating whether [over voltage protection enabled].
/// </summary>
/// <value>
/// <c>true</c> if [over voltage protection enabled]; otherwise, <c>false</c>.
/// </value>
bool OverVoltageProtectionEnabled
{
[UmsCommand("IDCPwr.GetOverVoltageProtectionEnabled")]
get;
[UmsCommand("IDCPwr.SetOverVoltageProtectionEnabled")]
set;
}
/// <summary>
/// Gets or sets the voltage soft limit.
/// </summary>
/// <value>
/// The voltage soft limit within <see cref="Voltage"/>
/// </value>
Voltage VoltageSoftLimit
{
[UmsCommand("IDCPwr.GetVoltageSoftLimit")]
get;
[UmsCommand("IDCPwr.SetVoltageSoftLimit")]
set;
}
/// <summary>
/// Gets or sets a value indicating whether the power supplies inhibit is enabled.
/// </summary>
/// <value>
/// <c>true</c> if [inhibit enabled]; otherwise, <c>false</c>.
/// </value>
bool InhibitEnabled
{
[UmsCommand("IDCPwr.GetInhibitEnabled")]
get;
[UmsCommand("IDCPwr.SetInhibitEnabled")]
set;
}
/// <summary>
/// Occurs when the supply over currents.
/// </summary>
[UmsEvent("IDCPwr.OverCurrent")]
event EventHandler<OverCurrentEventArgs> OverCurrent;
/// <summary>
/// Occurs when the supply over voltages.
/// </summary>
[UmsEvent("IDCPwr.OverVoltage")]
event EventHandler<OverVoltageEventArgs> OverVoltage;
/// <summary>
/// reads protection status (fault register) of the power supply
/// </summary>
/// <returns></returns>
[UmsCommand("IDCPwr.ReadProtectionStatus")]
int ReadProtectionStatus();
/// <summary>
/// Control the power supply internal mechanical relay state
/// </summary>
/// <param name="shallWeConnect">True to connect, false to disconnect</param>
[UmsCommand( "IDCPwr.MechanicalRelayOutputControl" )]
void MechanicalRelayOutputControl(bool shallWeConnect);
//*** possible future enhancements
//SetVoltageTriggerSource(…);
//SetVoltageTriggerLevels(…);
//InitiateVoltageTrigger();
//TriggerVoltage();
//SetMeasurementTriggerSource(…);
//InitiateMeasurementTrigger(…);
//TriggerMeasurement();
//AbortMeasurement();
}
}

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)Solution.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<AssemblyName>Raytheon.Instruments.DCPwr.Contracts</AssemblyName>
<Description>IDCPwr Instrument Interface</Description>
<Product>HAL</Product>
<!-- Static versioning (Suitable for Development) -->
<!-- Disable the line below for dynamic versioning -->
<Version>2.7.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Raytheon.Instruments.Contracts" Version="1.*" />
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,77 @@
// *******************************************************************************************
// ** **
// ** OverCurrentEventArgs.cs
// ** 4/14/2023
// ** **
// ** 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 2023.
// ** **
// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE **
// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED **
// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION **
// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION **
// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER **
// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER **
// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS **
// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT **
// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL **
// ** PENALTIES. **
// ** **
// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED **
// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE **
// ** PROJECTS/PROGRAMS. **
// ** **
// *******************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Raytheon.Communication;
using System.Runtime.Serialization;
namespace Raytheon.Instruments
{
/// <summary>
/// Over current event notifier
/// </summary>
[Serializable]
[DataContract]
public class OverCurrentEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="OverCurrentEventArgs"/> class.
/// with the affected power supplies
/// </summary>
public OverCurrentEventArgs(ICollection<IDCPwr> supplies)
{
List<String> namedSupplies = new List<string>();
if (null != supplies)
{
foreach (var sup in supplies)
{
namedSupplies.Add(sup.Name);
}
}
Supplies = new ReadOnlyCollection<string>(namedSupplies);
}
/// <summary>
/// Gets the affected power supplies.
/// </summary>
[DataMember(Order = 0, Name = "Supplies")]
public ReadOnlyCollection<String> Supplies { get; private set; }
}
}

View File

@@ -0,0 +1,78 @@
// *******************************************************************************************
// ** **
// ** OverVoltageEventArgs.cs
// ** 4/14/2023
// ** **
// ** 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 2023.
// ** **
// ** WARNING: THIS DOCUMENT CONTAINS TECHNICAL DATA AND / OR TECHNOLOGY WHOSE **
// ** EXPORT OR DISCLOSURE TO NON-U.S.PERSONS, WHEREVER LOCATED, IS RESTRICTED **
// ** BY THE INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) (22 C.F.R.SECTION **
// ** 120-130) OR THE EXPORT ADMINISTRATION REGULATIONS(EAR) (15 C.F.R.SECTION **
// ** 730-774). THIS DOCUMENT CANNOT BE EXPORTED(E.G., PROVIDED TO A SUPPLIER **
// ** OUTSIDE OF THE UNITED STATES) OR DISCLOSED TO A NON-U.S.PERSON, WHEREVER **
// ** LOCATED, UNTIL A FINAL JURISDICTION AND CLASSIFICATION DETERMINATION HAS **
// ** BEEN COMPLETED AND APPROVED BY RAYTHEON, AND ANY REQUIRED U.S.GOVERNMENT **
// ** APPROVALS HAVE BEEN OBTAINED. VIOLATIONS ARE SUBJECT TO SEVERE CRIMINAL **
// ** PENALTIES. **
// ** **
// ** CAPITAL EQUIPMENT/SOFTWARE: THIS TECHNICAL DATA WAS DEVELOPED OR ACQUIRED **
// ** EXCLUSIVELY AT CONTRACTOR EXPENSE AND IS INTENDED FOR USE ON MULTIPLE **
// ** PROJECTS/PROGRAMS. **
// ** **
// *******************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Raytheon.Communication;
using System.Runtime.Serialization;
namespace Raytheon.Instruments
{
/// <summary>
/// Over voltage event notifier
/// </summary>
[Serializable]
[DataContract]
public class OverVoltageEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="OverVoltageEventArgs"/> class.
/// with the affected power supplies
/// </summary>
public OverVoltageEventArgs(ICollection<IDCPwr> supplies)
{
List<String> namedSupplies = new List<string>();
if (null != supplies)
{
foreach (var sup in supplies)
{
namedSupplies.Add(sup.Name);
}
}
Supplies = new ReadOnlyCollection<string>(namedSupplies);
}
/// <summary>
/// Gets the supplies that are affected
/// </summary>
[DataMember(Order = 0, Name = "Supplies")]
public ReadOnlyCollection<String> Supplies { get; private set; }
}
}