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,236 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Classes.Groups
{
public abstract class GroupHelper
{
#region StaticGroupNames
private static Dictionary<int, string> StaticGroupNames = new Dictionary<int, string>();
public static void ClearStaticGroupNames()
{
StaticGroupNames.Clear();
}
public static void SetStaticGroupName(int id, string name)
{
StaticGroupNames[id] = name;
}
public static string GetStaticGroupName(int Id)
{
var name = string.Empty;
if (StaticGroupNames.ContainsKey(Id))
{
name = StaticGroupNames[Id];
}
return name;
}
#endregion StaticGroupNames
#region EmbeddedGroupIdList
private static List<int> EmbeddedGroupIdList = new List<int>();
public static void ClearEmbeddedGroupIdList()
{
EmbeddedGroupIdList.Clear();
}
public static void SetEmbeddedGroupId(int id)
{
EmbeddedGroupIdList.Add(id);
}
public static bool IsGroupEmbedded(int Id)
{
return EmbeddedGroupIdList.Contains(Id);
}
#endregion EmbeddedGroupIdList
#region TestSetupGroupIds
private static Dictionary<int, int> TestSetupGroupIds = new Dictionary<int, int>();
public static void ClearTestSetupGroupIds()
{
TestSetupGroupIds.Clear();
}
public static void SetTestSetupGroupId(int groupId, int testSetupId)
{
TestSetupGroupIds[groupId] = testSetupId;
}
public static int GetTestSetupGroupId(int groupId)
{
var testSetupGroupId = 0;
if (TestSetupGroupIds.ContainsKey(groupId))
{
testSetupGroupId = TestSetupGroupIds[groupId];
}
return testSetupGroupId;
}
#endregion TestSetupGroupIds
#region GroupChannelIds
private static Dictionary<int, List<int>> GroupChannelIds = new Dictionary<int, List<int>>();
public static void ClearGroupChannelIds()
{
GroupChannelIds.Clear();
}
public static void AddGroupChannelId(int sensorId, int groupId)
{
if (!GroupChannelIds.ContainsKey(sensorId))
{
GroupChannelIds.Add(sensorId, new List<int>());
}
GroupChannelIds[sensorId].Add(groupId);
}
public static List<int> GetGroupIdsFromChannels(int sensorId)
{
var groupIdList = new List<int>();
if (GroupChannelIds.ContainsKey(sensorId))
{
groupIdList = GroupChannelIds[sensorId];
}
return groupIdList;
}
#endregion
#region DASIds
private static Dictionary<string, int> DASIds = new Dictionary<string, int>();
public static void ClearDASIds()
{
DASIds.Clear();
}
public static void SetDASId(string serialNumber, int dasId)
{
DASIds[serialNumber] = dasId;
}
public static int GetDASId(string serialNumber)
{
return DASIds[serialNumber];
}
#endregion DASIds
#region BaseModuleChannelIndexList
public static Dictionary<string, Dictionary<string, List<int>>> BaseModuleChannelIndexList = new Dictionary<string, Dictionary<string, List<int>>>();
public static void ClearBaseModuleChannelIndexList()
{
BaseModuleChannelIndexList.Clear();
}
public static void SetBaseModuleChannelIndexList(string baseSerialNumberSubstring, Dictionary<string, List<int>> tempDictionary)
{
BaseModuleChannelIndexList[baseSerialNumberSubstring] = tempDictionary;
}
public static List<int> GetChannelIndexes(string targetBaseSerialNumber, string targetModuleSerialNumber)
{
var channelIndexList = new List<int>();
foreach (var baseModuleIndexListTriple in BaseModuleChannelIndexList)
{
if (baseModuleIndexListTriple.Key == targetBaseSerialNumber)
{
var moduleIndexListTuple = baseModuleIndexListTriple.Value;
foreach (var moduleSerialNumber in moduleIndexListTuple.Keys)
{
if (moduleSerialNumber == targetModuleSerialNumber)
{
channelIndexList = moduleIndexListTuple[moduleSerialNumber];
}
}
}
}
return channelIndexList;
}
#endregion BaseModuleChannelIndexList
#region DASIdChannelIndexGroupIdList
public static Dictionary<int, Dictionary<int, int>> DASIdChannelIndexGroupIdList = new Dictionary<int, Dictionary<int, int>>();
public static void ClearDASIdChannelIndexGroupIdList()
{
DASIdChannelIndexGroupIdList.Clear();
}
public static void SetDASIdChannelIndexGroupIdList(int dasId, Dictionary<int, int> tempDictionary)
{
DASIdChannelIndexGroupIdList[dasId] = tempDictionary;
}
public static List<int> GetGroupIds(int targetDasId, List<int> targetChannelIndexList)
{
var groupIdList = new List<int>();
foreach (var dasIdChannelIndexGroupIdTriple in DASIdChannelIndexGroupIdList)
{
if (dasIdChannelIndexGroupIdTriple.Key == targetDasId)
{
var channelIndexGroupIdTuple = dasIdChannelIndexGroupIdTriple.Value;
foreach (var channelIndex in channelIndexGroupIdTuple.Keys)
{
if (targetChannelIndexList.Contains(channelIndex))
{
groupIdList.Add(channelIndexGroupIdTuple[channelIndex]);
}
}
}
}
return groupIdList;
}
#endregion BaseModuleChannelIndexList
#region TestSetupHardwareIds
private static Dictionary<int, List<int>> TestSetupHardwareIds = new Dictionary<int, List<int>>();
public static void ClearTestSetupHardwareIds()
{
TestSetupHardwareIds.Clear();
}
public static void AddTestSetupHardwareId(int dasId, int testSetupId)
{
if (!TestSetupHardwareIds.ContainsKey(dasId))
{
TestSetupHardwareIds.Add(dasId, new List<int>());
}
TestSetupHardwareIds[dasId].Add(testSetupId);
}
public static List<int> GetTestSetupHardwareIds(int DASId)
{
var testSetupIdList = new List<int>();
if (TestSetupHardwareIds.ContainsKey(DASId))
{
testSetupIdList = TestSetupHardwareIds[DASId];
}
return testSetupIdList;
}
#endregion TestSetupHardwareIds
#region GroupHardwareIds
private static Dictionary<int, List<int>> GroupHardwareIds = new Dictionary<int, List<int>>();
public static void ClearGroupHardwareIds()
{
GroupHardwareIds.Clear();
}
public static void AddGroupHardwareId(int dasId, int groupId)
{
if (!GroupHardwareIds.ContainsKey(dasId))
{
GroupHardwareIds.Add(dasId, new List<int>());
}
GroupHardwareIds[dasId].Add(groupId);
}
public static List<int> GetGroupHardwareIds(int DASId)
{
var groupIdList = new List<int>();
if (GroupHardwareIds.ContainsKey(DASId))
{
groupIdList = GroupHardwareIds[DASId];
}
return groupIdList;
}
#endregion GroupHardwareIds
}
}

View File

@@ -0,0 +1,42 @@
G\PN:{NAME OF PROGRAM};
G\TA:{TEST ID}_{DAS SERIAL NUMBER};
G\106:17;
G\DSI\N:1;
G\DSI-1:{TEST ID};
G\DST-1:STO;
R-1\ID:{TEST ID};
R-1\RID:S6A_1;
R-1\R1:generated from XML CH10 mapping;
R-1\TC1:OTHR;
R-1\COM:=========================================================================;
R-1\COM: This simple settings for PCM stream
R-1\COM: Mapping defined in the CH10 Programmers Handbook (RCC document 123-16) ;
R-1\COM: appendix P/Q from the definition of a user defined external XML file;
R-1\COM:=========================================================================;
R-1\RML:E;
R-1\ERBS:AUTO;
R-1\NSB:0;
R-1\RI1:Data Bus Tools GmbH;
R-1\RI2:S6A_1;
R-1\RI3:N;
R-1\RI6:N;
R-1\CRE:F;
R-1\RSS:R;
R-1\N:2;
R-1\TK1-1:1;
R-1\TK4-1:1;
R-1\COM: ======================= Time Channel ========================;
R-1\COM: == Format 2 with PTP timestamp ==;
R-1\TK1-1:65535;
R-1\DSI-1:Time;
R-1\TK4-1:65535;
R-1\CHE-1:T;
R-1\CDT-1:TIMEIN;
R-1\CDLN-1:Time;
R-1\IDX\E:T;
R-1\IDX\IT:T;
R-1\IDX\ITV:200;
R-1\TTF-1:1;
R-1\TFMT-1:B;
R-1\TSRC-1:I;
R-1\COM: ====================== START CHANNELS =======================;

View File

@@ -0,0 +1,12 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ILegendViewModel : IBaseViewModel
{
/// <summary>
/// Gets the Tab View.
/// </summary>
ILegendView View { get; }
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Xml.Serialization;
namespace DTS.Common.XMLUtils
{
//FB 24428 https://stackoverflow.com/questions/244953/how-to-serialize-a-nullable-int-without-xsinil-being-added-to-the-resulting-x
public class NullableElement<T>
{
public NullableElement(T value)
{
_value = value;
_hasValue = true;
}
public NullableElement()
{
_hasValue = false;
}
[XmlText]
public T Value
{
get
{
if (!HasValue)
throw new InvalidOperationException();
return _value;
}
set
{
_value = value;
_hasValue = true;
}
}
[XmlIgnore]
public bool HasValue
{ get { return _hasValue; } }
public T GetValueOrDefault()
{ return _value; }
public T GetValueOrDefault(T i_defaultValue)
{ return HasValue ? _value : i_defaultValue; }
public static explicit operator T(NullableElement<T> i_value)
{ return i_value.Value; }
public static implicit operator NullableElement<T>(T i_value)
{ return new NullableElement<T>(i_value); }
public override bool Equals(object i_other)
{
if (!HasValue)
return (i_other == null);
if (i_other == null)
return false;
return _value.Equals(i_other);
}
public override int GetHashCode()
{
if (!HasValue)
return 0;
return _value.GetHashCode();
}
public override string ToString()
{
if (!HasValue)
return "";
return _value.ToString();
}
bool _hasValue;
T _value;
}
}

View File

@@ -0,0 +1,113 @@
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.Sensors;
using System;
using System.Collections.Generic;
namespace DTS.Common.Classes.Sensors
{
/// <summary>
/// internal helper class to avoid passing a huge number of parameters between methods
/// right now it's needed both in the Wizard CSV import code and in DataPRO CSV import code
/// but it can probably be moved to only be in Wizard CSV import code when DataPRO CSV import code is removed
/// for now it lives here.
/// </summary>
public class ParseParameters
{
public bool ImportContainedSensorRanges { get; set; } = false;
private ISensorData _sd;
public ISensorData SensorData { get => _sd; set => _sd = value; }
private IFormatProvider _importCulture;
public IFormatProvider ImportCulture { get => _importCulture; set => _importCulture = value; }
private List<string> _errors;
public List<string> Errors { get => _errors; set => _errors = value; }
private double _dIrTraccExponent;
public double IrtraccExponent { get => _dIrTraccExponent; set => _dIrTraccExponent = value; }
private ISensorCalibration _sc;
public ISensorCalibration SensorCal { get => _sc; set => _sc = value; }
private double _dSensitivity;
public double Sensitivity { get => _dSensitivity; set => _dSensitivity = value; }
private bool _bSavedIsProportional;
public bool SavedIsProportional { get => _bSavedIsProportional; set => _bSavedIsProportional = value; }
private bool _savedRemoveOffset;
public bool SavedRemoveOffset { get => _savedRemoveOffset; set => _savedRemoveOffset = value; }
private bool _stripBackslash;
public bool StripBackslash { get => _stripBackslash; set => _stripBackslash = value; }
private double _dOriginalOffset = double.NaN;
public double OriginalOffset { get => _dOriginalOffset; set => _dOriginalOffset = value; }
private ZeroMethodType _zmt;
public ZeroMethodType ZeroType { get => _zmt; set => _zmt = value; }
private double _zeroMethodEnd;
public double ZeroEnd
{
get => _zeroMethodEnd; set => _zeroMethodEnd = value;
}
private double _zeroMethodStart;
public double ZeroStart { get => _zeroMethodStart; set => _zeroMethodStart = value; }
private ISquibSettingDefaults _squibDefaults;
public ISquibSettingDefaults SquibDefaults
{
get => _squibDefaults; set => _squibDefaults = value;
}
private IDigitalOutDefaults _digitalOutDefaults;
public IDigitalOutDefaults DigitalOutDefaults
{
get => _digitalOutDefaults; set => _digitalOutDefaults = value;
}
private Dictionary<string, string> _sensorGroupNameLookup;
public Dictionary<string, string> SensorGroupNameLookup
{
get => _sensorGroupNameLookup; set => _sensorGroupNameLookup = value;
}
private Dictionary<string, string> _sensorGroupTypeLookup;
public Dictionary<string, string> SensorGroupTypeLookup
{
get => _sensorGroupTypeLookup; set => _sensorGroupTypeLookup = value;
}
private Dictionary<string, string> _groupNameToTestObjectLookup;
public Dictionary<string, string> GroupNameToTestObjectLookup { get => _groupNameToTestObjectLookup; set => _groupNameToTestObjectLookup = value; }
private string _sensorTestObject;
public string SensorTestObject { get => _sensorTestObject; set => _sensorTestObject = value; }
private bool _bUseISOCodeFilterMapping;
public bool UseISOCodeFilterMapping { get => _bUseISOCodeFilterMapping; set => _bUseISOCodeFilterMapping = value; }
private bool _bUseZeroForUnfiltered;
public bool UseZeroForUnfiltered { get => _bUseZeroForUnfiltered; set => _bUseZeroForUnfiltered = value; }
private Dictionary<string, string> _SensorISOCode;
public Dictionary<string, string> SensorISOCode { get => _SensorISOCode; set => _SensorISOCode = value; }
private Dictionary<string, string> _SensorISOChannelName;
public Dictionary<string, string> SensorISOChannelName { get => _SensorISOChannelName; set => _SensorISOChannelName = value; }
private Dictionary<string, string> _SensorUserCode;
public Dictionary<string, string> SensorUserCode { get => _SensorUserCode; set => _SensorUserCode = value; }
private Dictionary<string, string> _SensorUserChannelName;
public Dictionary<string, string> SensorUserChannelName { get => _SensorUserChannelName; set => _SensorUserChannelName = value; }
private Dictionary<string, string> _SensorDASSerialNumber;
public Dictionary<string, string> SensorDASSerialNumber { get => _SensorDASSerialNumber; set => _SensorDASSerialNumber = value; }
private Dictionary<string, int> _SensorDASChannelIndex;
public Dictionary<string, int> SensorDASChannelIndex { get => _SensorDASChannelIndex; set => _SensorDASChannelIndex = value; }
}
}

View File

@@ -0,0 +1,74 @@
using Prism.Events;
// ReSharper disable CheckNamespace
namespace DTS.Common.Events.Sensors.SensorsList
{
/// <summary>
/// FB 13120 this event is used to notify the save function when the new sensor has been added in the setting menu
/// </summary>
public class SensorSavedEvent : PubSubEvent<double>
{
}
/// <summary>
/// FB 13120 this event is used in selecting the default filter in filter list when adding or deleting a sensor
/// </summary>
public class SensorUpdatedEvent : PubSubEvent<bool>
{
}
/// <summary>
/// used to indicate a sensor has changed
/// currently used for sensitivity controls (supported excitation/sensitivity) to notify other consumers that the
/// user has changed a value
/// </summary>
public class SensorChangedEvent : PubSubEvent<SensorChangedArgs>
{
}
public class SensorChangedArgs
{
/// <summary>
/// serial number of the sensor that changed (currently not used)
/// This has been put in place for future use
/// </summary>
public string SerialNumber { get; }
/// <summary>
/// database id of the sensor that changed (currently not used)
/// this has been put in place for future use
/// </summary>
public int DatabaseId { get; }
/// <summary>
/// used to signify the Current Model is being loaded
/// </summary>
public bool CurrentModelLoading { get; }
/// <summary>
/// used to signify NonLinear has changed
/// </summary>
public bool NonLinearChanged { get; }
/// <summary>
/// used to signify sensitivity has changed
/// </summary>
public bool SensitivityChanged { get; }
/// <summary>
/// used to indicate proportionality has changed
/// </summary>
public bool IsProportionalChanged { get; }
/// <summary>
/// used to indicate an excitation setting changed
/// </summary>
public bool ExcitationChanged { get; }
public SensorChangedArgs(string serialNumber, int databaseId, bool currentModelLoading, bool nonLinearChanged, bool sensitivityChanged,
bool isProportionalChanged, bool excitationChanged)
{
SerialNumber = serialNumber;
DatabaseId = databaseId;
CurrentModelLoading = currentModelLoading;
NonLinearChanged = nonLinearChanged;
SensitivityChanged = sensitivityChanged;
IsProportionalChanged = isProportionalChanged;
ExcitationChanged = excitationChanged;
}
}
}