Major upgrade
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
@@ -0,0 +1,9 @@
|
||||
;format is signal_name = range|resolution|delay(ms)|scale factor|relays|type|cable, connector and pin id|lower_limit|upper_limit
|
||||
;Type is TWO or FOUR for two wire and four wire measurements
|
||||
;Relay Format: [Card_Name]:[Path]
|
||||
; [Card_Name] - Must match the name of the switch card defined in the Instrument.xml
|
||||
; [Path] - [subUnit#].[channel_x1].[channel_y1],[subUnit#].[channel_x2].[channel_y2]
|
||||
; x1 is routed to y1, x2 is routed to y2, y1 goes to DMM + input, y2 goes to DMM - input
|
||||
;Cable and Pin Id Format: [Cable_Id]_[Connecto_Id]_[Pin_Id]_[Cable_Id]_[Connector_Id]_[Pin_Id]
|
||||
[DmmReadResistance]
|
||||
W3_AUD_GDNC_FILTER = NO_PCODE|-1|0.001|100|1|PICKERING_SWITCH_MATRIX_64X4:0.17.1,0.16.2|TWO|W1_P3_52_W1_P4_4|0.0|5.0
|
||||
@@ -0,0 +1 @@
|
||||
Pickering Matrix Switch 40-585A-001
|
||||
@@ -0,0 +1,347 @@
|
||||
// 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 NLog;
|
||||
using Pickering.Lxi.Piplx;
|
||||
using Raytheon.Common;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
/// <summary>
|
||||
/// A Pickering implementation of the IRelaySwitch interface
|
||||
/// </summary>
|
||||
public class SwitchMatrixPickering40x : ISwitch
|
||||
{
|
||||
#region PrivateMemberVariables
|
||||
private string _name;
|
||||
private string _lxiIpAddress;
|
||||
private int _deviceNum;
|
||||
private int _busNum;
|
||||
private PiplxCard _switchMatrixCard;
|
||||
private State _state;
|
||||
private SelfTestResult _selfTestResult;
|
||||
private object _syncObj = new Object();
|
||||
PiplxManager _piplxManager;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PrivateFunctions
|
||||
|
||||
/// <summary>
|
||||
/// Close/open relay pair defined in the path
|
||||
/// </summary>
|
||||
/// <param name="relay">The relay to close</param>
|
||||
private void OperateRelays(string path, bool state)
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
// split path into 2 items. Each item contains channel information
|
||||
string[] channelArray = path.Split(',');
|
||||
|
||||
if (channelArray.Length != 2)
|
||||
{
|
||||
throw new Exception($"Invalid path: {path}. Expected format: [subunit].[channel_x].[channel_y],[subunit].[channel_x].[channel_y]");
|
||||
}
|
||||
|
||||
for (int i = 0; i < channelArray.Length; i++)
|
||||
{
|
||||
string[] itemArray = channelArray[i].Split('.');
|
||||
|
||||
if (itemArray.Length != 3)
|
||||
{
|
||||
throw new Exception($"Invalid path: {path}. Expected format: [subunit].[channel_x].[channel_y]");
|
||||
}
|
||||
|
||||
int itemIndex = 0;
|
||||
if (int.TryParse(itemArray[itemIndex++], out int subUnitIndex) && int.TryParse(itemArray[itemIndex++], out int xIndex) && int.TryParse(itemArray[itemIndex++], out int yIndex))
|
||||
{
|
||||
MatrixSubunit subUnit = (MatrixSubunit)_switchMatrixCard.Subunits[subUnitIndex];
|
||||
|
||||
subUnit.OperateCrosspoint(yIndex, xIndex, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Invalid path: {channelArray[i]}. Expected format: [subunit].[channel_x].[channel_y]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens all relays on the card
|
||||
/// </summary>
|
||||
private void RelayOpenAll()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
for (int i = 0; i < _switchMatrixCard.Subunits.Count; i++)
|
||||
{
|
||||
MatrixSubunit subUnit = (MatrixSubunit)_switchMatrixCard.Subunits[i];
|
||||
subUnit.ClearSubunit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PublicFunctions
|
||||
|
||||
/// <summary>
|
||||
/// SwitchMatrixPickering40x factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public SwitchMatrixPickering40x(string deviceName, IConfigurationManager configurationManager)
|
||||
{
|
||||
Name = deviceName;
|
||||
|
||||
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
|
||||
|
||||
_configurationManager = configurationManager;
|
||||
_configuration = _configurationManager.GetConfiguration(Name);
|
||||
|
||||
_lxiIpAddress = _configuration.GetConfigurationValue(Name, "LXI_IP_ADDRESS");
|
||||
Int32.TryParse(_configuration.GetConfigurationValue(Name, "DEVICE_NUMBER"), out _deviceNum);
|
||||
Int32.TryParse(_configuration.GetConfigurationValue(Name, "BUS_NUMBER"), out _busNum);
|
||||
|
||||
_state = State.Uninitialized;
|
||||
_selfTestResult = SelfTestResult.Unknown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~SwitchMatrixPickering40x()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ClearErrors()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void Connect(string path)
|
||||
{
|
||||
OperateRelays(path, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
public void Disconnect(string path)
|
||||
{
|
||||
OperateRelays(path, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void DisconnectAll()
|
||||
{
|
||||
RelayOpenAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DetailedStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return "This is a Pickering Switch";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool DisplayEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool FrontPanelEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public InstrumentMetadata Info
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
if (_state == State.Uninitialized)
|
||||
{
|
||||
_piplxManager = new PiplxManager(_lxiIpAddress);
|
||||
|
||||
foreach (PiplxCard card in _piplxManager.Cards)
|
||||
{
|
||||
PiplxCardInfo info = (PiplxCardInfo)card.Info;
|
||||
|
||||
if (info.Device == _deviceNum && info.Bus == _busNum)
|
||||
{
|
||||
_switchMatrixCard = card;
|
||||
|
||||
_switchMatrixCard.Open();
|
||||
|
||||
RelayOpenAll();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_switchMatrixCard == null)
|
||||
{
|
||||
throw new Exception($"No switch matrix card exists in LXI chassis with DEVICE_NUMBER={_deviceNum} and BUS_NUMBER={_busNum}");
|
||||
}
|
||||
|
||||
_state = State.Ready;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Expected the state to be Uninitialized, state was: " + _state.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsDebounced
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SelfTestResult PerformSelfTest()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SelfTestResult SelfTestResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selfTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public State Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
if (_state == State.Ready)
|
||||
{
|
||||
if (_switchMatrixCard != null && _switchMatrixCard.IsOpen())
|
||||
{
|
||||
RelayOpenAll();
|
||||
_switchMatrixCard.Close();
|
||||
}
|
||||
|
||||
if (_piplxManager != null && _piplxManager.Connected)
|
||||
_piplxManager.Disconnect();
|
||||
|
||||
_state = State.Uninitialized;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>Raytheon.Instruments.SwitchMatrixPickering40x</AssemblyName>
|
||||
<Product>Switch Matrix Pickering 40x implementation</Product>
|
||||
<Description>Switch Matrix Pickering 40x implementation</Description>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
<!-- Static versioning (Suitable for Development) -->
|
||||
<!-- Disable the line below for dynamic versioning -->
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="5.0.0" />
|
||||
<PackageReference Include="Raytheon.Common" Version="1.0.0" />
|
||||
<PackageReference Include="Raytheon.Instruments.Switch.Contracts" Version="1.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SwitchSim\SwitchSim.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Pickering.Lxi.Communication">
|
||||
<HintPath>..\..\Common\COTS\Pickering\Pickering.Lxi.Communication.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Pickering.Lxi.Piplx">
|
||||
<HintPath>..\..\Common\COTS\Pickering\Pickering.Lxi.Piplx.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Copy all *.dlls and *.pdb in the output folder to a temp folder -->
|
||||
<Target Name="CopyFiles" AfterTargets="AfterBuild">
|
||||
<ItemGroup>
|
||||
<FILES_1 Include="$(OutDir)*.dll" />
|
||||
<FILES_2 Include="$(OutDir)*.pdb" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(FILES_1)" DestinationFolder="$(HalTempFolder)" />
|
||||
<Copy SourceFiles="@(FILES_2)" DestinationFolder="$(HalTempFolder)" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,131 @@
|
||||
// **********************************************************************************************************
|
||||
// SwitchMatrixPickering40xFactory.cs
|
||||
// 2/20/2023
|
||||
// NGI - Next Generation Interceptor
|
||||
//
|
||||
// Contract No. HQ0856-21-C-0003/1022000209
|
||||
//
|
||||
// THIS DOCUMENT DOES NOT CONTAIN TECHNOLOGY OR TECHNICAL DATA CONTROLLED UNDER EITHER THE U.S.
|
||||
// INTERNATIONAL TRAFFIC IN ARMS REGULATIONS OR THE U.S. EXPORT ADMINISTRATION REGULATIONS.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
||||
//
|
||||
// DESTRUCTION NOTICE: FOR CLASSIFIED DOCUMENTS FOLLOW THE PROCEDURES IN DOD 5220.22-M,
|
||||
// NATIONAL INDUSTRIAL SECURITY PROGRAM OPERATING MANUAL, FEBRUARY 2006,
|
||||
// INCORPORATING CHANGE 1, MARCH 28, 2013, CHAPTER 5, SECTION 7, OR DODM 5200.01-VOLUME 3,
|
||||
// DOD INFORMATION SECURITY PROGRAM: PROTECTION OF CLASSIFIED INFORMATION, ENCLOSURE 3,
|
||||
// SECTION 17. FOR CONTROLLED UNCLASSIFIED INFORMATION FOLLOW THE PROCEDURES IN DODM 5200.01-VOLUME 4,
|
||||
// INFORMATION SECURITY PROGRAM: CONTROLLED UNCLASSIFIED INFORMATION.
|
||||
//
|
||||
// CONTROLLED BY: MISSILE DEFENSE AGENCY
|
||||
// CONTROLLED BY: GROUND-BASED MIDCOURSE DEFENSE PROGRAM OFFICE
|
||||
// CUI CATEGORY: CTI
|
||||
// DISTRIBUTION/DISSEMINATION CONTROL: F
|
||||
// POC: Alex Kravchenko (1118268)
|
||||
// **********************************************************************************************************
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using NLog;
|
||||
using Raytheon.Common;
|
||||
|
||||
namespace Raytheon.Instruments
|
||||
{
|
||||
[ExportInstrumentFactory(ModelNumber = "SwitchMatrixPickering40xFactory")]
|
||||
public class SwitchMatrixPickering40xFactory : IInstrumentFactory
|
||||
{
|
||||
private readonly List<Type> _supportedInterfaces = new List<Type>();
|
||||
|
||||
private readonly IConfigurationManager _configurationManager;
|
||||
private const string DefaultConfigPath = @"C:\ProgramData\Raytheon\InstrumentManagerService";
|
||||
private static string DefaultPath;
|
||||
|
||||
public SwitchMatrixPickering40xFactory(string defaultConfigPath = DefaultConfigPath)
|
||||
: this(null, defaultConfigPath)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SwitchMatrixPickering40xFactory injection constructor
|
||||
/// </summary>
|
||||
[ImportingConstructor]
|
||||
public SwitchMatrixPickering40xFactory([Import(AllowDefault = false)] IConfigurationManager configManager,
|
||||
[Import(AllowDefault = true)] string defaultConfigPath = null)
|
||||
{
|
||||
DefaultPath = defaultConfigPath;
|
||||
|
||||
if (LogManager.Configuration == null)
|
||||
{
|
||||
var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\nlog.config");
|
||||
}
|
||||
|
||||
_configurationManager = configManager ?? GetConfigurationManager();
|
||||
_supportedInterfaces.Add(typeof(ISwitch));
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public IInstrument GetInstrument(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new SwitchMatrixPickering40x(name, _configurationManager);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instrument
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public object GetInstrument(string name, bool simulateHw)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (simulateHw)
|
||||
return new SwitchSim(name, _configurationManager);
|
||||
else
|
||||
return new SwitchMatrixPickering40x(name, _configurationManager);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets supported interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ICollection<Type> GetSupportedInterfaces()
|
||||
{
|
||||
return _supportedInterfaces.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns configuration based on the predefined path or default path c:/ProgramData/Raytheon/InstrumentManagerService
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static IConfigurationManager GetConfigurationManager()
|
||||
{
|
||||
return string.IsNullOrEmpty(DefaultPath) ? new RaytheonConfigurationManager() : new RaytheonConfigurationManager(DefaultPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user