This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,320 @@
using DTS.Common.Base;
using DTS.Common.Enums;
using DTS.Common.Interface.Sensors;
using DTS.Common.Interface.Sensors.SoftwareFilters;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
namespace DTS.Common.Classes.Sensors
{
/// <summary>
/// Implementation of IDigitalInDbRecord
/// represents a record of a digital input setting in the database
/// <inheritdoc cref="IDigitalInDbRecord"/>
/// </summary>
public class DigitalInDbRecord : BasePropertyChanged, IDigitalInDbRecord
{
private int _id = -1;
/// <summary>
/// Database id of record
/// </summary>
[Key]
public int Id
{
get => _id;
set => SetProperty(ref _id, value, "Id");
}
private string _serialNumber = "";
/// <summary>
/// serial number or name of setting
/// </summary>
public string SerialNumber
{
get => _serialNumber;
set => SetProperty(ref _serialNumber, value, "SerialNumber");
}
private DigitalInputModes _settingMode = DigitalInputModes.TLH;
/// <summary>
/// Input mode for setting
/// </summary>
public DigitalInputModes Mode
{
get => _settingMode;
set => SetProperty(ref _settingMode, value, "Mode");
}
private IDigitalInputScaleMultiplier _scaleMultiplier = new DigitalInputScaleMultiplier();
/// <summary>
/// ScaleMultiplier, defines how to interpret output in terms of
/// units or active/default value of input state
/// </summary>
[Required]
[StringLength(50)]
public IDigitalInputScaleMultiplier ScaleMultiplier
{
get => _scaleMultiplier;
set => SetProperty(ref _scaleMultiplier, value, "ScaleMultiplier");
}
private DateTime _lastModified = DateTime.MinValue;
[Column(TypeName = "datetime")]
/// <summary>
/// when setting was last modified
/// </summary>
public DateTime LastModified
{
get => _lastModified;
set => SetProperty(ref _lastModified, value, "LastModified");
}
private string _lastModifiedBy = "";
/// <summary>
/// user that last modified setting in db
/// </summary>
[Required]
[StringLength(50)]
public string LastModifiedBy
{
get => _lastModifiedBy;
set => SetProperty(ref _lastModifiedBy, value, "LastModifiedBy");
}
private string _eId = "";
/// <summary>
/// Electronic ID for digital input setting
/// (dallas or TeDS ID value)
/// </summary>
[Required]
[Column("eId")]
[StringLength(50)]
public string EID
{
get => _eId;
set => SetProperty(ref _eId, value, "EID");
}
private string _isoCode = "";
/// <summary>
/// ISO 13499 code for digital input data collected using this setting
/// this is the default code when the setting is applied to an input channel
/// but can be changed in group or test settings
/// </summary>
[Required]
[StringLength(50)]
public string ISOCode
{
get => _isoCode;
set => SetProperty(ref _isoCode, value, "ISOCode");
}
private string _isoChannelName = "";
/// <summary>
/// the associated ISO 13499 channel name to apply to a channel when applying
/// setting to an input channel
/// but can be changed in group or test settings
/// </summary>
[Required]
[StringLength(255)]
public string ISOChannelName
{
get => _isoChannelName;
set => SetProperty(ref _isoChannelName, value, "ISOChannelName");
}
private string _userCode = "";
/// <summary>
/// the user code to apply to a channel when applying setting to a channel
/// can be changed in group or test settings
/// </summary>
[Required]
[StringLength(50)]
public string UserCode
{
get => _userCode;
set => SetProperty(ref _userCode, value, "UserCode");
}
private string _userChannelName = "";
/// <summary>
/// user channel name to apply to a channel when applying setting to a channel
/// can be changed in group or test settings
/// </summary>
[Required]
[StringLength(255)]
public string UserChannelName
{
get => _userChannelName;
set => SetProperty(ref _userChannelName, value, "UserChannelName");
}
private string _userValue1 = "";
/// <summary>
/// user value to carry through to collected data channel when collecting data with this setting
/// </summary>
[StringLength(255)]
public string UserValue1
{
get => _userValue1;
set => SetProperty(ref _userValue1, value, "UserValue1");
}
private string _userValue2 = "";
/// <summary>
/// user value to carry through to collected data channel when collecting data with this setting
/// </summary>
[StringLength(255)]
public string UserValue2
{
get => _userValue2;
set => SetProperty(ref _userValue2, value, "UserValue2");
}
private string _userValue3 = "";
/// <summary>
/// user value to carry through to collected data channel when collecting data with this setting
/// </summary>
[StringLength(255)]
public string UserValue3
{
get => _userValue3;
set => SetProperty(ref _userValue3, value, "UserValue3");
}
private byte[] _userTags;
/// <summary>
/// bytes describing tag ids for tags associated with setting
/// see ITagAware for more information
/// </summary>
public byte[] UserTags
{
get => _userTags;
set => SetProperty(ref _userTags, value, "UserTags");
}
private string _measurementUnit = "V";
/// <summary>
/// measurement unit for collected data, for example
/// 'V' or Volts
/// </summary>
[Required]
[StringLength(50)]
public string MeasurementUnit
{
get => _measurementUnit;
set => SetProperty(ref _measurementUnit, value, "MeasurementUnit");
}
private IFilterClass _filterClass;
/// <summary>
/// software filter class (applied when viewing data) to apply to collected data by default
/// can be changed when viewing or exporting, this is just a default filter
/// </summary>
[Required]
[StringLength(50)]
public IFilterClass FilterClass
{
get => _filterClass;
set => SetProperty(ref _filterClass, value, "FilterClass");
}
private bool _doNotUse = false;
/// <summary>
/// a flag indicating setting should not be used for arbitrary user specified reason
/// </summary>
public bool DoNotUse
{
get => _doNotUse;
set => SetProperty(ref _doNotUse, value, "DoNotUse");
}
private bool _broken = false;
/// <summary>
/// a flag indicating setting should not be used because it is currently broken
/// </summary>
public bool Broken
{
get => _broken;
set => SetProperty(ref _broken, value, "Broken");
}
public DigitalInDbRecord() { }
public DigitalInDbRecord(ISensorData copy, byte [] tagBlockBytes, IDigitalInputScaleMultiplier digitalScaleMultiplier)
{
Id = copy.DatabaseId;
SerialNumber = copy.SerialNumber;
ISOCode = copy.ISOCode;
ISOChannelName = copy.ISOChannelName;
UserCode = copy.UserCode;
UserChannelName = copy.UserChannelName;
Broken = copy.Broken;
DoNotUse = copy.DoNotUse;
LastModified = copy.LastModified;
LastModifiedBy = copy.LastUpdatedBy;
Mode = copy.InputMode;
MeasurementUnit = copy.DIUnits;
FilterClass = new FilterClass(copy.FilterClass.FClass, copy.FilterClass.Frequency);
ISOCode = copy.ISOCode;
EID = copy.EID;
UserValue1 = copy.UserValue1;
UserValue2 = copy.UserValue2;
UserValue3 = copy.UserValue3;
if (null == tagBlockBytes) { UserTags = null; }
else
{
if (tagBlockBytes.Any())
{
UserTags = new byte[tagBlockBytes.Length];
Array.Copy(tagBlockBytes, UserTags, tagBlockBytes.Length);
}
else { UserTags = new byte[0]; }
}
ScaleMultiplier.FromDbSerializeString(digitalScaleMultiplier.ToSerializeDbString());
}
public DigitalInDbRecord(IDataReader reader)
{
Id = Utility.GetInt(reader, "Id", -1);
SerialNumber = Utility.GetString(reader, "SerialNumber", string.Empty);
ISOCode = Utility.GetString(reader, "ISOCode", string.Empty);
ISOChannelName = Utility.GetString(reader, "ISOChannelName", string.Empty);
UserCode = Utility.GetString(reader, "UserCode", string.Empty);
UserChannelName = Utility.GetString(reader, "UserChannelName", string.Empty);
Broken = Utility.GetBool(reader, "Broken", false);
DoNotUse = Utility.GetBool(reader, "DoNotUse", false);
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy", string.Empty);
Mode = (DigitalInputModes)Utility.GetInt(reader,"SettingMode");
MeasurementUnit = Utility.GetString(reader, "MeasurementUnit");
FilterClass = new FilterClass(Utility.GetString(reader, "FilterClass"));
if( ISOCode.Length< 16) { ISOCode = ISOCode.PadRight(16, '?'); }
var s = ISOCode.ToCharArray();
s[15] = '0';
ISOCode = new string(s);
EID = Utility.GetString(reader, "eId", string.Empty);
UserValue1 = Utility.GetString(reader, "UserValue1", string.Empty);
UserValue2 = Utility.GetString(reader, "UserValue2", string.Empty);
UserValue3 = Utility.GetString(reader, "UserValue3", string.Empty);
UserTags = (byte[])reader["UserTags"];
ScaleMultiplier.FromDbSerializeString(Utility.GetString(reader, "ScaleMultiplier"));
}
public DigitalInDbRecord(IDigitalInDbRecord copy)
{
Id = copy.Id;
SerialNumber = copy.SerialNumber;
ISOCode = copy.ISOCode;
ISOChannelName = copy.ISOChannelName;
UserCode = copy.UserCode;
UserChannelName = copy.UserChannelName;
Broken = copy.Broken;
DoNotUse = copy.DoNotUse;
LastModified = copy.LastModified;
LastModifiedBy = copy.LastModifiedBy;
Mode = copy.Mode;
MeasurementUnit = copy.MeasurementUnit;
FilterClass = new FilterClass(copy.FilterClass.FClass, copy.FilterClass.Frequency);
ISOCode = copy.ISOCode;
EID = copy.EID;
UserValue1 = copy.UserValue1;
UserValue2 = copy.UserValue2;
UserValue3 = copy.UserValue3;
if( null == copy.UserTags) { UserTags = null; }
else
{
if(copy.UserTags.Any())
{
var userTags = new byte[copy.UserTags.Length];
Array.Copy(copy.UserTags, userTags, copy.UserTags.Length);
UserTags = userTags;
}
else { UserTags = new byte[0]; }
}
ScaleMultiplier.FromDbSerializeString(copy.ScaleMultiplier.ToSerializeDbString());
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Enums
{
/// <summary>
/// Enum representing the TabControl operations type.
/// </summary>
public enum RibbonControlOperation
{
/// <summary>
/// The item has been added to the TabControl.
/// </summary>
AddedItem,
/// <summary>
/// The item has been removed from the TabControl.
/// </summary>
RemovedItem
}
}

View File

@@ -0,0 +1,14 @@
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
using Microsoft.Practices.Prism.Events;
namespace DTS.Common.Events.TTSImport
{
/// <summary>
/// The AssignedChannelsChangedEvent event.
/// </summary>
///
/// <remarks>This event is published whenever the assigned channels are changed.</remarks>
///
public class AssignedChannelsChangedEvent : CompositePresentationEvent<ITTSSetup> { }
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.DASFactory.Diagnostics.HardwareList
{
public interface IHardwareListSelectView : IBaseView { }
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IViewerSettingsView : IBaseView { }
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.Database
{
public interface IDatabaseSwitchView : IBaseView { }
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.GroupTemplate
{
public interface IGroupTemplateExportView : IBaseView { }
}

View File

@@ -0,0 +1,156 @@
using DTS.Common.Enums.Sensors;
namespace DTS.Common.Interface.DASFactory.Diagnostics
{
public interface IDiagnosticResult
{
/// <summary>
/// Which DASChannel from which this diagnostics is returning.
/// </summary>
int DASChannelNumber { get; set; }
/// <summary>
/// The event number that this diagnostics is relevant for.
/// </summary>
int EventNumber { get; set; }
/// <summary>
/// The firmware calculates a scale factory for the channel's input. The hardware will
/// deliver raw, unprocessed data upon download, but to diagnos this data to
/// reflect real world votages it must be scaled based on the DAS unit's factory
/// diagnostics as well as results from this diagnose. The samples that
/// will be downloaded will be straight from the A to D Converter so this scale
/// factor is MANDATORY and must be used at the software level to scale the data
/// to the real sensed voltages and engineering units.
/// </summary>
double ScalefactorMilliVoltsPerADC { get; set; }
double ScalefactorEngineeringUnitsPerADC { get; set; }
/// <summary>
/// The factory excitation value (mandatory)
/// </summary>
double ExpectedExcitationMilliVolts { get; set; }
/// <summary>
/// gets what will probably be the datazerolevel adc for the channel
/// </summary>
/// <param name="zeroMethod"></param>
/// <returns></returns>
short GetExpectedDataZeroLevelADC(ZeroMethodType zeroMethod);
/// <summary>
/// Excitation voltage provided to sensor as measured by the firmware during
/// calibration. When read from event attributes, a value of 0.0 might actually
/// mean null (i.e. was not measured).
/// </summary>
double? MeasuredExcitationMilliVolts { get; set; }
/// <summary>
/// flag to indicate whether MeasuredExcitationMilliVolts was negative when it was initially read
/// 14233 Negative Excitation Reported by TDAS hardware not showing in Diagnostics
/// this was created to relate to legacy TDC/TDAS broken sensor/wire warnings carried through
/// the excitation reading
/// </summary>
bool NegativeExcitation { get; set; }
/// <summary>
/// What is the sensor's offset reading from the 0 level? This is measured by firmware
/// during the calibration. When read from event attributes, a value of 0.0 might actually
/// mean null (i.e. was not measured).
/// </summary>
double? MeasuredOffsetMilliVolts{ get; set; }
double? MeasuredInternalOffsetMilliVolts{ get; set; }
/// <summary>
/// What is the sensor's offset reading from the 0 level? This is measured by firmware
/// during the calibration. When read from event attributes, a value of 0.0 might actually
/// mean null (i.e. was not measured).
/// </summary>
double? MeasuredOffsetEngineeringUnits { get; set; }
/// <summary>
/// when a channel is autozero'd (remove offset)
/// this is the devation from 0 (from RW Auto zero is checking for +/- 5% from 0 in counts.)
/// </summary>
double? AutoZeroPercentDeviation{ get; set; }
/// <summary>
/// If the <see cref="DTS.DASLib.Service.DiagnosticsService" />.Calibrate method was called with the "RemoveOffset" boolean variable set
/// to TRUE then the firmware will attempt to remove the offset of the sensor, moving it's base
/// reading back to 0. This value is how much offset is present after removing the offset. While the
/// offset my not be compeletely removed it may have been reduced to fall within the high and low
/// limits for acceptable offsets for the sensor. See <see cref="AnalogInputDASChannel" /> to find
/// these sensor specific values. When read from event attributes, a value of 0.0 might actually
/// mean null (i.e. was not measured).
/// </summary>
short? FinalOffsetADC { get; set; }
int? RemovedOffsetADC { get; set; }
int? RemovedInternalOffsetADC { get; set; }
/// <summary>
/// FullScaleSignal to Noise ratio as a percentage. When read from event attributes, a value of 0.0 might actually
/// mean null (i.e. was not measured).
/// </summary>
double? NoisePercentFullScale { get; set; }
bool ShuntDeflectionFailed { get; set; }
bool CalSignalCheckFailed { get; set; }
/// <summary>
/// If an emulated shunt test is performed the measured shunt deflection in mV detected
/// during the test will be here.
/// <see cref="DTS.DASLib.Service.DiagnosticsActions" />.PerformShuntCheck
/// When read from event attributes, a value of 0.0 might actually mean null
/// (i.e. was not measured).
/// </summary>
double? MeasuredShuntDeflectionMv { get; set; }
double? MeasuredCalSignalMv { get; set; }
double? TargetCalSignalMv { get; set; }
double? MeasuredDurationMS { get; set; }
double? MeasuredDelayMS { get; set; }
bool? SquibFirePassed { get; set; }
bool? SquibDurationPassed { get; set; }
bool? SquibDelayPassed { get; set; }
double[] SquibFireCurrentData { get; set; }
double[] SquibFireVoltageData { get; set; }
double[] SquibFireTimeAxis { get; set; }
double SquibThreshold { get; set; }
double SquibVoltageScaler { get; set; }
double SquibCurrentScaler { get; set; }
double? TargetGain { get; set; }
double? MeasuredGain { get; set; }
double? QueriedGain { get; set; }
/// <summary>
/// If an emulated shunt test is performed the target shunt deflection in mV will be here.
/// CalibrateActions.PerformShuntCheck When read from event attributes, a value of 0.0 might actually
/// mean null (i.e. was not measured).
/// </summary>
double? TargetShuntDeflectionMv { get; set; }
/// <summary>
/// If the bridge resistance of the sensor was measured, the measured resistance in
/// ohms will be here. <see cref="DiagnosticsActions.MeasureBridgeResistance" />
/// When read from event attributes, a value of 0.0 might actually mean null
/// (i.e. was not measured).
/// </summary>
double? BridgeResistance { get; set; }
short ZeroMVInADC { get; set; }
/// <summary>
/// WindowAverageADC is the average ADC over the averaging window specified for the channel
/// short.MinValue indicates an unitialized or invalid value
/// </summary>
short WindowAverageADC { get; set; }
bool DigitalInputActiveState { get; set; }
}
}