Major upgrade

This commit is contained in:
Duc
2025-10-24 15:18:11 -07:00
parent fd85735c93
commit ce583d1664
478 changed files with 237518 additions and 47610 deletions

View File

@@ -15,280 +15,275 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using System;
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>
///
/// </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;
private readonly ILogger _logger;
#endregion
private readonly IConfigurationManager _configurationManager;
private readonly IConfiguration _configuration;
/// <summary>
/// ScopeSim factory constructor
/// </summary>
/// <param name="deviceName"></param>
/// <param name="configurationManager"></param>
public ScopeSim(string deviceName, IConfigurationManager configurationManager, ILogger logger)
{
Name = deviceName;
#endregion
_logger = logger;
/// <summary>
/// ScopeSim factory constructor
/// </summary>
/// <param name="deviceName"></param>
/// <param name="configurationManager"></param>
public ScopeSim(string deviceName, IConfigurationManager configurationManager)
{
Name = deviceName;
_configurationManager = configurationManager;
_configuration = _configurationManager.GetConfiguration(Name);
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
_state = State.Uninitialized;
_selfTestResult = SelfTestResult.Unknown;
}
_configurationManager = configurationManager;
_configuration = _configurationManager.GetConfiguration(Name);
/// <summary>
///
/// </summary>
/// <param name="name"></param>
public ScopeSim(string name)
{
_name = name;
_state = State.Uninitialized;
_selfTestResult = SelfTestResult.Unknown;
}
_logger = LogManager.GetCurrentClassLogger();
/// <summary>
///
/// </summary>
/// <param name="deviceName"></param>
public ScopeSim(string deviceName)
{
_name = deviceName;
_selfTestResult = SelfTestResult.Unknown;
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
_state = State.Uninitialized;
}
_selfTestResult = SelfTestResult.Unknown;
/// <summary>
///
/// </summary>
/// <param name="channelNumber"></param>
public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance)
{
}
_state = State.Uninitialized;
}
/// <summary>
///
/// </summary>
public string DetailedStatus
{
get
{
return "This is a Scope Sim called " + _name;
}
}
/// <summary>
///
/// </summary>
/// <param name="channelNumber"></param>
public void ConfigureChannel(int channelNumber, double timePerDivison, double timeOffset, double voltageOffset, double voltageScale, string inputImpedance)
{
}
/// <summary>
///
/// </summary>
public bool DisplayEnabled
{
get
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
public string DetailedStatus
{
get
{
return "This is a Scope Sim called " + _name;
}
}
set
{
throw new NotImplementedException();
}
}
/// <summary>
///
/// </summary>
public bool DisplayEnabled
{
get
{
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
public bool FrontPanelEnabled
{
get
{
throw new NotImplementedException();
}
set
{
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 InstrumentMetadata Info
{
get
{
throw new NotImplementedException();
}
}
/// <summary>
///
/// </summary>
public string Name
{
get { return _name; }
set { _name = value; }
}
/// <summary>
///
/// </summary>
public string Name
{
get { return _name; }
set { _name = value; }
}
/// <summary>
///
/// </summary>
public SelfTestResult SelfTestResult
{
get
{
return _selfTestResult;
}
}
/// <summary>
///
/// </summary>
public SelfTestResult SelfTestResult
{
get
{
return _selfTestResult;
}
}
/// <summary>
///
/// </summary>
public State Status
{
get
{
return _state;
}
}
/// <summary>
///
/// </summary>
public State Status
{
get
{
return _state;
}
}
public bool ClearErrors()
{
throw new NotImplementedException();
}
public bool ClearErrors()
{
throw new NotImplementedException();
}
public bool HasItTriggered()
{
return true;
}
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 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 string IOQuery(string command)
{
// nothing to do in sim
return "";
}
public void IOWrite(string command, bool shallWeCheckForError = true)
{
// nothing to do in sim
}
public void IOWrite(string command, bool shallWeCheckForError = true)
{
// nothing to do in sim
}
public double MeasureFallTime(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureFallTime(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureFrequency(int channel)
{
double max = 10000;
public double MeasureFrequency(int channel)
{
double max = 10000;
double min = 100;
double min = 100;
Random rnd = new Random();
Random rnd = new Random();
double seed = rnd.NextDouble();
double seed = rnd.NextDouble();
double dataToReturn = (seed * (max - min)) + min;
double dataToReturn = (seed * (max - min)) + min;
return dataToReturn;
}
return dataToReturn;
}
public double MeasureMaxVoltage(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureMaxVoltage(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureMinVoltage(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureMinVoltage(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasurePulseWidth(int channelNumber)
{
double max = 10000;
public double MeasurePulseWidth(int channelNumber)
{
double max = 10000;
double min = 100;
double min = 100;
Random rnd = new Random();
Random rnd = new Random();
double seed = rnd.NextDouble();
double seed = rnd.NextDouble();
double dataToReturn = (seed * (max - min)) + min;
double dataToReturn = (seed * (max - min)) + min;
return dataToReturn;
}
return dataToReturn;
}
public double MeasureRiseTime(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureRiseTime(int channelNumber)
{
throw new NotImplementedException();
}
public double MeasureVoltageLevel(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;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public SelfTestResult PerformSelfTest()
{
_selfTestResult = SelfTestResult.Pass;
return _selfTestResult;
}
public void Reset()
{
}
public void Reset()
{
}
public void SaveImage(string fileName)
{
}
public void SaveImage(string fileName)
{
}
public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel)
{
public void SetupTrigger(bool useRisingEdge, int channelNumber, double triggerLevel)
{
}
}
public void Shutdown()
{
if (_state == State.Ready)
{
_state = State.Uninitialized;
}
}
public void Shutdown()
{
if (_state == State.Ready)
{
_state = State.Uninitialized;
}
}
}
}
}