295 lines
5.4 KiB
C#
295 lines
5.4 KiB
C#
// 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 System;
|
|
|
|
namespace Raytheon.Instruments
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class ScopeSim : IOscilloScope
|
|
{
|
|
#region PrivateMembers
|
|
private State _state;
|
|
private string _name;
|
|
private SelfTestResult _selfTestResult;
|
|
|
|
/// <summary>
|
|
/// NLog logger
|
|
/// </summary>
|
|
private readonly ILogger _logger;
|
|
/// <summary>
|
|
/// Raytheon configuration
|
|
/// </summary>
|
|
private readonly IConfigurationManager _configurationManager;
|
|
private readonly IConfiguration _configuration;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// ScopeSim factory constructor
|
|
/// </summary>
|
|
/// <param name="deviceName"></param>
|
|
/// <param name="configurationManager"></param>
|
|
public ScopeSim(string deviceName, IConfigurationManager configurationManager, ILogger logger)
|
|
{
|
|
Name = deviceName;
|
|
|
|
_logger = logger;
|
|
|
|
_configurationManager = configurationManager;
|
|
_configuration = _configurationManager.GetConfiguration(Name);
|
|
|
|
_state = State.Uninitialized;
|
|
_selfTestResult = SelfTestResult.Unknown;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
public ScopeSim(string name)
|
|
{
|
|
_name = name;
|
|
|
|
_logger = LogManager.GetCurrentClassLogger();
|
|
|
|
_selfTestResult = SelfTestResult.Unknown;
|
|
|
|
_state = State.Uninitialized;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="channelNumber"></param>
|
|
public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string DetailedStatus
|
|
{
|
|
get
|
|
{
|
|
return "This is a Scope Sim called " + _name;
|
|
}
|
|
}
|
|
|
|
/// <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 string Name
|
|
{
|
|
get { return _name; }
|
|
set { _name = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public SelfTestResult SelfTestResult
|
|
{
|
|
get
|
|
{
|
|
return _selfTestResult;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public State Status
|
|
{
|
|
get
|
|
{
|
|
return _state;
|
|
}
|
|
}
|
|
|
|
public bool ClearErrors()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public bool HasItTriggered()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void Initialize()
|
|
{
|
|
if (_state == State.Uninitialized)
|
|
{
|
|
_state = State.Ready;
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("expected the state to be Uninitialized, state was: " + _state.ToString());
|
|
}
|
|
}
|
|
|
|
public string IOQuery(string command)
|
|
{
|
|
// nothing to do in sim
|
|
return "";
|
|
}
|
|
|
|
public void IOWrite(string command, bool shallWeCheckForError = true)
|
|
{
|
|
// nothing to do in sim
|
|
}
|
|
|
|
public double MeasureFallTime(int channelNumber)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public double MeasureFrequency(int channel)
|
|
{
|
|
double max = 10000;
|
|
|
|
double min = 100;
|
|
|
|
Random rnd = new Random();
|
|
|
|
double seed = rnd.NextDouble();
|
|
|
|
double dataToReturn = (seed * (max - min)) + min;
|
|
|
|
return dataToReturn;
|
|
}
|
|
|
|
public double MeasureMaxVoltage(int channelNumber)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public double MeasureMinVoltage(int channelNumber)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public double MeasurePulseWidth(int channelNumber)
|
|
{
|
|
double max = 10000;
|
|
|
|
double min = 100;
|
|
|
|
Random rnd = new Random();
|
|
|
|
double seed = rnd.NextDouble();
|
|
|
|
double dataToReturn = (seed * (max - min)) + min;
|
|
|
|
return dataToReturn;
|
|
}
|
|
|
|
public double MeasureRiseTime(int channelNumber)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public double MeasureVoltageLevel(int channelNumber)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public SelfTestResult PerformSelfTest()
|
|
{
|
|
_selfTestResult = SelfTestResult.Pass;
|
|
return _selfTestResult;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
}
|
|
|
|
public void SaveImage(string fileName)
|
|
{
|
|
}
|
|
|
|
public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel)
|
|
{
|
|
|
|
}
|
|
|
|
public void Shutdown()
|
|
{
|
|
if (_state == State.Ready)
|
|
{
|
|
_state = State.Uninitialized;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|