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,210 +15,175 @@ GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using NLog;
using Raytheon.Common;
using System;
using System.Threading;
using NLog;
using Raytheon.Common;
namespace Raytheon.Instruments
{
/// <summary>
/// A simulated chiller
/// </summary>
public class ChillerSim : IChiller, IDisposable
{
#region PrivateMembers
private double _setPoint;
private static object _sync = new object();
/// <summary>
/// A simulated chiller
/// </summary>
public class ChillerSim : IChiller, IDisposable
{
#region PrivateMembers
private double _setPoint;
private static object _sync = new object();
public string DetailedStatus { get; protected set; }
public string DetailedStatus { get; protected set; }
public bool DisplayEnabled { get; set; }
public bool FrontPanelEnabled { get; set; }
public bool DisplayEnabled { get; set; }
public bool FrontPanelEnabled { get; set; }
public InstrumentMetadata Info { get; set; }
public InstrumentMetadata Info { get; set; }
public string Name { get; protected set; }
public string Name { get; protected set; }
public SelfTestResult SelfTestResult => PerformSelfTest();
public SelfTestResult SelfTestResult => PerformSelfTest();
public State Status { get; set; }
public State Status { get; set; }
/// <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;
#region PrivateFunctions
~ChillerSim()
{
Dispose(false);
}
/// <summary>
/// Dispose of the object's resources.
/// </summary>
/// <param name="disposing">Currently disposing.</param>
protected virtual void Dispose(bool disposing)
{
try
{
if (disposing)
{
}
}
catch (Exception)
{
try
{
//ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
}
catch (Exception)
{
//Do not rethrow. Exception from error logger that has already been garbage collected
}
}
}
#endregion
#endregion
#region PublicFunctions
#region PrivateFunctions
~ChillerSim()
{
Dispose(false);
}
/// <summary>
/// Dispose of the object's resources.
/// </summary>
/// <param name="disposing">Currently disposing.</param>
protected virtual void Dispose(bool disposing)
{
/// <summary>
/// ChillerFTS factory constructor
/// </summary>
/// <param name="deviceName"></param>
/// <param name="configurationManager"></param>
public ChillerSim(string deviceName, IConfigurationManager configurationManager, ILogger logger)
{
Name = deviceName;
}
#endregion
_logger = logger;
#region PublicFunctions
_configurationManager = configurationManager;
_configuration = _configurationManager.GetConfiguration(Name);
}
/// <summary>
/// ChillerFTS factory constructor
/// </summary>
/// <param name="deviceName"></param>
/// <param name="configurationManager"></param>
public ChillerSim(string deviceName, IConfigurationManager configurationManager)
{
Name = deviceName;
/// <summary>
/// The constructor
/// </summary>
/// <param name="name"></param>
public ChillerSim(string name)
{
Name = name;
_setPoint = 20.0;
_logger = LogManager.GetCurrentClassLogger();
}
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
_configurationManager = configurationManager;
_configuration = _configurationManager.GetConfiguration(Name);
}
/// <summary>
/// The constructor
/// </summary>
/// <param name="deviceName"></param>
public ChillerSim(string deviceName)
{
Name = deviceName;
_setPoint = 20.0;
_logger = LogManager.GetLogger($"{this.GetType().Name} - {deviceName}");
}
/// <summary>
/// Stop the chiller pump.
/// </summary>
public void DisableFlow()
{
}
/// <summary>
/// Stop the chiller pump.
/// </summary>
public void DisableFlow()
{
}
/// <summary>
/// Dispose of this objects resources
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
public void Dispose()
{
try
{
Dispose(true);
/// <summary>
/// Dispose of this objects resources
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
catch (Exception)
{
try
{
//ErrorLogger.Instance().Write(err.Message + "\r\n" + err.StackTrace);
}
catch (Exception)
{
//Do not rethrow. Exception from error logger that has already been garbage collected
}
}
}
GC.SuppressFinalize(this);
}
/// <summary>
/// Start the chiller pump.
/// </summary>
public void EnableFlow()
{
}
/// <summary>
/// Start the chiller pump.
/// </summary>
public void EnableFlow()
{
}
/// <summary>
/// Query the current setting for the coolant.
/// </summary>
/// <returns>The current coolant setting.</returns>
public double GetCoolantSetpoint()
{
return _setPoint;
}
/// <summary>
/// Query the current setting for the coolant.
/// </summary>
/// <returns>The current coolant setting.</returns>
public double GetCoolantSetpoint()
{
return _setPoint;
}
/// <summary>
/// Query the temperature of the coolant reservoir.
/// </summary>
/// <returns>The temperature of the coolant.</returns>
public double GetCoolantTemperature()
{
double max = _setPoint + 5;
/// <summary>
/// Query the temperature of the coolant reservoir.
/// </summary>
/// <returns>The temperature of the coolant.</returns>
public double GetCoolantTemperature()
{
double max = _setPoint + 5;
double min = _setPoint - 5;
double min = _setPoint - 5;
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;
Thread.Sleep(100);
Thread.Sleep(100);
return dataToReturn;
}
return dataToReturn;
}
/// <summary>
/// Set the coolant temperature to a desired setpoint.
/// </summary>
/// <param name="temp">The desired coolant temperature.</param>
public void SetCoolantTemperature(double temp)
{
_setPoint = temp;
}
/// <summary>
/// Set the coolant temperature to a desired setpoint.
/// </summary>
/// <param name="temp">The desired coolant temperature.</param>
public void SetCoolantTemperature(double temp)
{
_setPoint = temp;
}
public bool ClearErrors()
{
throw new NotImplementedException();
}
public bool ClearErrors()
{
throw new NotImplementedException();
}
public void Initialize()
{
throw new NotImplementedException();
}
public void Initialize()
{
throw new NotImplementedException();
}
public SelfTestResult PerformSelfTest()
{
throw new NotImplementedException();
}
public SelfTestResult PerformSelfTest()
{
throw new NotImplementedException();
}
public void Reset()
{
throw new NotImplementedException();
}
public void Reset()
{
throw new NotImplementedException();
}
public void Shutdown()
{
throw new NotImplementedException();
}
public void Shutdown()
{
throw new NotImplementedException();
}
#endregion
}
#endregion
}
}