Major upgrade
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 319 KiB |
@@ -0,0 +1,24 @@
|
||||
;format is signal_name = range|resolution|min_delay(ms)|max_delay(ms)|scale factor|relays|type|cable, connector and pin id|lower_limit|upper_limit
|
||||
;Range format for Raptor Squib Meter:
|
||||
; Refer to 101-SQB-RAK Meter Customer Command Set Verion 1.0.8.pdf, page 13 on range setting
|
||||
; There is no auto range
|
||||
; Possible ranges:
|
||||
; 0 No Range
|
||||
; 1 DIODE Range
|
||||
; 2 20 Ohm
|
||||
; 3 200 Ohm
|
||||
; 4 2K Ohm
|
||||
; 5 20K Ohm
|
||||
; 6 200K Ohm
|
||||
; 7 2M Ohm
|
||||
;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] - [card#].[channel#],[card#].[channel#]
|
||||
; If card# = 0, then all cards are treated as 1 virtual card.
|
||||
; That means the number of channels = # of cards x 96 (channels)
|
||||
; If card# > 0, then each card is treated as individual card.
|
||||
; The number of channels = 96
|
||||
;Cable and Pin Id Format: [Cable_Id]_[Connecto_Id]_[Pin_Id]_[Cable_Id]_[Connector_Id]_[Pin_Id]
|
||||
[DmmReadResistance]
|
||||
SIGNAL_1 = NO_PCODE|7|0.001|100|1|PICKERING_SWITCH_MULTIPLEXER_96X4:0.1,0.96|FOUR|W1_P3_52_W1_P4_4|0.0|5.0
|
||||
@@ -0,0 +1,2 @@
|
||||
Pickering LXI Chassis 65-200-002
|
||||
Pickering LXI Multiplexer 65-260-901
|
||||
@@ -0,0 +1,510 @@
|
||||
// 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 SwitchMultiplexerPickering60x : ISwitch
|
||||
{
|
||||
enum SubUnit
|
||||
{
|
||||
HiMux,
|
||||
LoMux,
|
||||
Switch,
|
||||
Matrix
|
||||
}
|
||||
|
||||
#region PrivateMemberVariables
|
||||
private string _name;
|
||||
private string _lxiIpAddress;
|
||||
private bool _isSingleCardMode;
|
||||
private int _cardNumWithConnectedDmm;
|
||||
private int _cardStartingIndex = 0;
|
||||
private int _virtualCardCount = 1;
|
||||
private int _numBusSelectPerCard = 0;
|
||||
// Only used to route a closed channel from one card to another card that is connected to DMM to make measurement
|
||||
// There's no use case for us to be switching between the bus select channels, so we pick one channel to route signals from one card to another
|
||||
static private int _busSelectMatrixChanNum = 1;
|
||||
private State _state;
|
||||
private SelfTestResult _selfTestResult;
|
||||
private object _syncObj = new Object();
|
||||
private 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 open</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: [Card_Index].[Switch_Chan_Num],[Card_Index].[Switch_Chan_Num]");
|
||||
}
|
||||
|
||||
string channelInfo;
|
||||
int hiChannelNum = 0;
|
||||
int loChannelNum = 0;
|
||||
int hiCardNum = 0;
|
||||
int loCardNum = 0;
|
||||
for (int i = 0; i < channelArray.Length; i++)
|
||||
{
|
||||
channelInfo = channelArray[i].Trim();
|
||||
|
||||
string[] itemArray = channelInfo.Split('.');
|
||||
|
||||
int itemIndex = 0;
|
||||
if (int.TryParse(itemArray[itemIndex++], out int cardIndex) && int.TryParse(itemArray[itemIndex++], out int channelNum))
|
||||
{
|
||||
if (_isSingleCardMode)
|
||||
{
|
||||
if (cardIndex != _cardStartingIndex)
|
||||
throw new Exception($"Invalid card index: {cardIndex}. Card index can only be 0 when operating in single card mode");
|
||||
}
|
||||
else if (cardIndex < _cardStartingIndex || cardIndex >= _piplxManager.CardsCount)
|
||||
{
|
||||
throw new Exception($"Invalid card index: {cardIndex}. Card index can only be between {_cardStartingIndex} and {_piplxManager.CardsCount - 1} when operating in individual card mode");
|
||||
}
|
||||
|
||||
// close/open the channel relay
|
||||
GetSwitchSubUnit(cardIndex).OperateBit(channelNum, state);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
// close/open Hi mux relay
|
||||
GetHiMuxSubUnit(cardIndex).OperateBit(channelNum, state);
|
||||
hiCardNum = cardIndex;
|
||||
hiChannelNum = channelNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
// close/open Lo mux relay
|
||||
GetLoMuxSubUnit(cardIndex).OperateBit(channelNum, state);
|
||||
loCardNum = cardIndex;
|
||||
loChannelNum = channelNum;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Invalid channel information: {channelInfo}. Expected format: [Card_Index].[Switch_Chan_Num]");
|
||||
}
|
||||
}
|
||||
|
||||
if (hiChannelNum > 0 && loChannelNum > 0)
|
||||
{
|
||||
if (_isSingleCardMode)
|
||||
{
|
||||
// calculate physical number of switching channels per physical card
|
||||
int phyNumChanPerCard = GetSwitchSubUnit(_cardStartingIndex).BitsCount / (_piplxManager.CardsCount - 1);
|
||||
|
||||
// calculate physical card number for Hi side
|
||||
int phyHiCardNum = (int)Math.Ceiling((double)hiChannelNum / (double)phyNumChanPerCard);
|
||||
|
||||
// calculate physical card number for Lo side
|
||||
int phyLoCardNum = (int)Math.Ceiling((double)loChannelNum / (double)phyNumChanPerCard);
|
||||
|
||||
if (phyHiCardNum != _cardNumWithConnectedDmm)
|
||||
{
|
||||
// calculate virtual bus select matrix channel on the card that is being switched
|
||||
int virtualBusSelectMatrixChanNum = (phyHiCardNum * _numBusSelectPerCard) + (_busSelectMatrixChanNum - _numBusSelectPerCard);
|
||||
|
||||
// open/close the bus select channel so we can route the Hi channel from this card to the card connected to the DMM
|
||||
GetMatrixSubUnit(_cardStartingIndex).OperateCrosspoint(1, virtualBusSelectMatrixChanNum, state);
|
||||
}
|
||||
|
||||
if (phyLoCardNum != _cardNumWithConnectedDmm)
|
||||
{
|
||||
// calculate virtual bus select matrix channel on the card that is being switched
|
||||
int virtualBusSelectMatrixChanNum = (phyLoCardNum * _numBusSelectPerCard) + (_busSelectMatrixChanNum - _numBusSelectPerCard);
|
||||
|
||||
// open/close the bus select channel so we can route the Lo channel from this card to the card connected to the DMM
|
||||
GetMatrixSubUnit(_cardStartingIndex).OperateCrosspoint(2, virtualBusSelectMatrixChanNum, state);
|
||||
}
|
||||
}
|
||||
else if (hiCardNum > 0 && loCardNum > 0)
|
||||
{
|
||||
if (hiCardNum != _cardNumWithConnectedDmm)
|
||||
{
|
||||
// open/close the bus select channel so we can route the Hi channel from this card to the card connected to the DMM
|
||||
GetMatrixSubUnit(hiCardNum).OperateCrosspoint(1, _busSelectMatrixChanNum, state);
|
||||
}
|
||||
|
||||
if (loCardNum != _cardNumWithConnectedDmm)
|
||||
{
|
||||
// open/close the bus select channel so we can route the Lo channel from this card to the card connected to the DMM
|
||||
GetMatrixSubUnit(loCardNum).OperateCrosspoint(2, _busSelectMatrixChanNum, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens all relays on the card
|
||||
/// </summary>
|
||||
private void RelayOpenAll()
|
||||
{
|
||||
lock (_syncObj)
|
||||
{
|
||||
for (int i = _cardStartingIndex; i < _virtualCardCount; i++)
|
||||
{
|
||||
if (_piplxManager.Cards[i].IsOpen())
|
||||
{
|
||||
GetHiMuxSubUnit(i).ClearSubunit();
|
||||
GetLoMuxSubUnit(i).ClearSubunit();
|
||||
GetSwitchSubUnit(i).ClearSubunit();
|
||||
GetMatrixSubUnit(i).ClearSubunit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Hi Mux Sub Unit
|
||||
/// </summary>
|
||||
private MultiplexerSubunit GetHiMuxSubUnit(int cardIndex)
|
||||
{
|
||||
return (MultiplexerSubunit)((PiplxCard)_piplxManager.Cards[cardIndex]).OutputSubunits[(int)SubUnit.HiMux];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Low Mux Sub Unit
|
||||
/// </summary>
|
||||
private MultiplexerSubunit GetLoMuxSubUnit(int cardIndex)
|
||||
{
|
||||
return (MultiplexerSubunit)((PiplxCard)_piplxManager.Cards[cardIndex]).OutputSubunits[(int)SubUnit.LoMux];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Switch Sub Unit
|
||||
/// </summary>
|
||||
private SwitchSubunit GetSwitchSubUnit(int cardIndex)
|
||||
{
|
||||
return (SwitchSubunit)((PiplxCard)_piplxManager.Cards[cardIndex]).OutputSubunits[(int)SubUnit.Switch];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Matrix Sub Unit
|
||||
/// </summary>
|
||||
private MatrixSubunit GetMatrixSubUnit(int cardIndex)
|
||||
{
|
||||
return (MatrixSubunit)((PiplxCard)_piplxManager.Cards[cardIndex]).OutputSubunits[(int)SubUnit.Matrix];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PublicFunctions
|
||||
|
||||
/// <summary>
|
||||
/// SwitchMultiplexerPickering60x factory constructor
|
||||
/// </summary>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <param name="configurationManager"></param>
|
||||
public SwitchMultiplexerPickering60x(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");
|
||||
bool.TryParse(_configuration.GetConfigurationValue(Name, "IS_SINGLE_CARD_MODE"), out _isSingleCardMode);
|
||||
Int32.TryParse(_configuration.GetConfigurationValue(Name, "CARD_NUMBER_WITH_CONNECTED_DMM"), out _cardNumWithConnectedDmm);
|
||||
Int32.TryParse(_configuration.GetConfigurationValue(Name, "BUS_SELECT_MATRIX_CHANNEL_NUMBER"), out _busSelectMatrixChanNum);
|
||||
|
||||
_state = State.Uninitialized;
|
||||
_selfTestResult = SelfTestResult.Unknown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Finalizer
|
||||
/// </summary>
|
||||
~SwitchMultiplexerPickering60x()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <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);
|
||||
|
||||
if (!_isSingleCardMode)
|
||||
{
|
||||
_cardStartingIndex = 1;
|
||||
_virtualCardCount = _piplxManager.CardsCount;
|
||||
_numBusSelectPerCard = GetMatrixSubUnit(_cardStartingIndex).BitsCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
// calculate number of bus select channels per card
|
||||
_numBusSelectPerCard = (GetMatrixSubUnit(_cardStartingIndex).BitsCount / (_piplxManager.CardsCount - 1)) / 2;
|
||||
}
|
||||
|
||||
if (_busSelectMatrixChanNum < 1 || _busSelectMatrixChanNum > _numBusSelectPerCard)
|
||||
{
|
||||
throw new Exception($"Invalid bus select channel: {_busSelectMatrixChanNum}. Number must be between 1 and {_numBusSelectPerCard}");
|
||||
}
|
||||
|
||||
if (_cardNumWithConnectedDmm < 1 || _cardNumWithConnectedDmm >= _piplxManager.CardsCount)
|
||||
{
|
||||
throw new Exception($"Invalid card number: {_cardNumWithConnectedDmm} for the card that is connected to DMM. Number must be between 1 and {_piplxManager.CardsCount - 1}");
|
||||
}
|
||||
|
||||
for (int i = _cardStartingIndex; i < _virtualCardCount; i++)
|
||||
{
|
||||
_piplxManager.Cards[i].Open();
|
||||
|
||||
GetHiMuxSubUnit(i).ClearSubunit();
|
||||
GetLoMuxSubUnit(i).ClearSubunit();
|
||||
GetSwitchSubUnit(i).ClearSubunit();
|
||||
GetMatrixSubUnit(i).ClearSubunit();
|
||||
}
|
||||
|
||||
if (_isSingleCardMode)
|
||||
{
|
||||
// calculate virtual bus select matrix channel on the card that's connected to the DMM
|
||||
int virtualBusSelectMatrixChanNum = (_cardNumWithConnectedDmm * _numBusSelectPerCard) + (_busSelectMatrixChanNum - _numBusSelectPerCard);
|
||||
|
||||
// close the bus select relay on the card that is connected to DMM
|
||||
// so we can route channels on other cards to this card in order to make DMM measurements
|
||||
// close the Hi channel
|
||||
GetMatrixSubUnit(_cardStartingIndex).OperateCrosspoint(1, virtualBusSelectMatrixChanNum, true);
|
||||
// close the Lo channel
|
||||
GetMatrixSubUnit(_cardStartingIndex).OperateCrosspoint(2, virtualBusSelectMatrixChanNum, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// close the bus select relay on the card that is connected to DMM
|
||||
// so we can route channels on other cards to this card in order to make DMM measurements
|
||||
// close the Hi channel
|
||||
GetMatrixSubUnit(_cardNumWithConnectedDmm).OperateCrosspoint(1, _busSelectMatrixChanNum, true);
|
||||
// close the Lo channel
|
||||
GetMatrixSubUnit(_cardNumWithConnectedDmm).OperateCrosspoint(2, _busSelectMatrixChanNum, true);
|
||||
}
|
||||
|
||||
_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)
|
||||
{
|
||||
RelayOpenAll();
|
||||
|
||||
for (int i = _cardStartingIndex; i < _virtualCardCount; i++)
|
||||
{
|
||||
if (_piplxManager.Cards[i].IsOpen())
|
||||
{
|
||||
_piplxManager.Cards[i].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.SwitchMultiplexerPickering60x</AssemblyName>
|
||||
<Product>Switch Multiplexer Pickering 60x implementation</Product>
|
||||
<Description>Switch Multiplexer Pickering 60x 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 = "SwitchMultiplexerPickering60xFactory")]
|
||||
public class SwitchMultiplexerPickering60xFactory : 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 SwitchMultiplexerPickering60xFactory(string defaultConfigPath = DefaultConfigPath)
|
||||
: this(null, defaultConfigPath)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SwitchMultiplexerPickering60xFactory injection constructor
|
||||
/// </summary>
|
||||
[ImportingConstructor]
|
||||
public SwitchMultiplexerPickering60xFactory([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 SwitchMultiplexerPickering60x(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 SwitchMultiplexerPickering60x(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