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,368 @@
using DTS.Common.Interface.DASFactory;
using DTS.Common.Interface.DataRecorders;
using DTS.Common.Interface.Groups.GroupList;
using DTS.Common.Interface.Sensors;
using System;
using System.Collections.Generic;
namespace DTS.Common.Interface.TestSetups.TestSetupsList
{
/// <summary>
/// this is an interface to the Heavy Test Setup class
/// </summary>
public interface ITestTemplate : ITestSetup
{
bool LowgLevelTriggersMixed { get; set; }
double LowgLinearLevelTriggerAggregate { get; set; }
bool HighgLevelTriggersMixed { get; set; }
double HighgLinearLevelTriggerAggregate { get; set; }
bool AngularAccelLevelTriggersMixed { get; set; }
double AngularAccelLevelTriggerAggregate { get; set; }
bool AngularRateLevelTriggersMixed { get; set; }
double AngularRateLevelTriggerAggregate { get; set; }
/// <summary>
/// property used to indicate that the test is destructive or impact and should set the first use date
/// of any relevant sensors or DAS
/// 15524 DAS "First Use Date"
/// note: this property is not serialized with the test setup, it's a run-time set property when
/// running the test
/// </summary>
bool DestructiveTest { get; set; }
/// <summary>
/// removes the ids for this test template creating a copy without the id associations
/// </summary>
void CreateCopy();
void ClearHardware();
/// <summary>
/// returns true whenever the test template is a quick test setup, false otherwise
/// </summary>
bool QuickSensorCheck { get; set; }
#region Properties
bool ExpressTestSetup { get; set; }
bool PreserveTestId { get; set; }
/// <summary>
/// true if the test objects and other fields have already been loaded from the database, false otherwise
/// </summary>
bool IsLoaded { get; }
void SetIsLoaded(bool bIsLoaded);
bool ArmCheckListStep { get; set; }
bool CheckListBatteryVoltageCheck { get; set; }
bool CheckListInputVoltageCheck { get; set; }
bool CheckListSquibResistanceCheck { get; set; }
bool CheckListSensorIdCheck { get; set; }
bool CheckListRequirePass { get; set; }
bool CheckListTiltSensorCheck { get; set; }
bool CheckListTemperatureCheck { get; set; }
bool CheckListClockSyncCheck { get; set; }
Dictionary<string, double> FilterLookup { get; set; }
/// <summary>
/// excitation warmup time
/// can be defined at test level, test object level, (and maybe at hardware or channel level?)
/// if defined here, we return it right away, otherwise we pass it to the max of the test objets
/// </summary>
int ExcitationWarmupTimeMS { get; set; }
int GraphCount { get; }
string SetupFile { get; set; }
string TestId { get; set; }
string TestIdNode { get; set; }
string TestDirectory { get; set; }
string OriginalTestDirectory { get; set; }
string SampleRateText { get; set; }
List<string> CheckedDASList { get; set; }
bool GroupsStepValid { get; set; }
//assumes list is in order and sets display orders accordingly
void SetGroupsListOrder();
double MaxSampleRate { get; }
double MinSampleRate { get; }
string DownloadFolder { get; set; }
string ExportFolder { get; set; }
DateTime TestTime { get; set; }
int ChannelCount { get; }
int IncludedChannelCount { get; }
#endregion Properties
/// <summary>
/// if you use rename serial number method to create a new test setup, we have to go and recreate the groups.
/// groups are supposed to be unique to a test setup, and we don't want them to unintentionally share groups
/// <param name="bAddedGroups">whether operating on static or dynamic groups</param>
/// </summary>
void Rename(bool bAddedGroups);
int GetMaxDisplayOrder();
#region LEVEL_TRIGGER
/// <summary>
/// replaces any level triggers that have a specific id, with another
/// brand new id
/// </summary>
/// <param name="oldId"></param>
/// <param name="newId"></param>
void ReplaceLevelTriggerChannel(string oldId, string newId);
/// <summary>
/// scans through all level triggers, looks for any level triggers that might be associated with an old group serial number
/// and replaces those references with the new group serial number
/// </summary>
/// <param name="oldGroupSerial"></param>
/// <param name="newGroupSerial"></param>
void ReplaceLevelTriggerChannelGroupMapping(string oldGroupSerial, string newGroupSerial);
/// <summary>
/// updates the channel settings for groups which have changed serial numbers [rename/clone group]
/// 8404 Copy all channel parameters/settings/level triggers/graphs when cloning a test setup
/// </summary>
/// <param name="oldIdToNewIdLookup"></param>
/// <param name="oldGroupSnToNewGroupSn"></param>
void ReplaceChannelSetting(Dictionary<string, string> oldIdToNewIdLookup, Dictionary<string, string> oldGroupSnToNewGroupSn);
void ReplaceLevelTriggerChannel(Dictionary<string, string> oldIdToNewIdLookup, Dictionary<string, string> oldGroupSnToNewGroupSn);
void RenameLevelTriggerChannels(string oldName, string newName);
void RemoveImpossibleLevelTriggers();
#endregion LEVEL_TRIGGER
#region Sensor
/// <summary>
/// get sensor from sensor db again (but preserving custom values such as range/polarity/CFC/etc)
/// note, test objects already get sensors from from db every time. we hold onto them here, I guess for efficiency, but we could get them fresh every time as well
/// </summary>
void RefreshSensorsFromDb();
/// <summary>
/// sets a channel to be disabled
/// disabled channels don't appear in run test
/// </summary>
/// <param name="groupName"></param>
/// <param name="channelName"></param>
/// <param name="disabled"></param>
void SetDisabled(string groupName, string channelName, bool disabled);
//public SensorData GetSensor(IGroupChannel groupChannel)
//SensorData GetSensor(string serialNumber, string testObjectSerial, string channelName)
// FB5438 & FB5023
void RemoveSensor(string sensorserialnumber, string testobjectserial, string channelname);
#endregion Sensor
#region XML
/// <summary>
/// writes a test setup out to xml
/// </summary>
/// <param name="writer"></param>
void WriteXML(ref System.Xml.XmlWriter writer);
#endregion XML
void ReloadGroupsMemoryOnly();
/// <summary>
/// reloads static groups from list
/// </summary>
void ReloadGroups(bool bMemoryOnly);
bool CheckForIEPE();
/// <summary>
/// returns whether there is a TOM in the test setup or not
/// </summary>
/// <returns></returns>
bool CheckForTOM();
/// <summary>
/// returns whether there is a TOM with channels in use in the test setup or not
/// </summary>
/// <returns></returns>
bool CheckForTOMInTest();
/// <summary>
/// returns whether there is an analog channel in the test or not
/// </summary>
/// <returns></returns>
bool CheckForAnalog();
/// <summary>
/// sets the dirty flag
/// does NOT set the flag in the database, so this should only be called when the flag needs to be set in memory
/// (for instance during initialization)
/// </summary>
/// <param name="bDirty"></param>
void SetIsDirty(bool bDirty);
/// <summary>
/// sets the complete flag
/// does not set the flag in the database, so this should only be called when the flag needs to be set in memory
/// (for instance during initialization)
/// </summary>
/// <param name="bComplete"></param>
void SetIsComplete(bool bComplete);
/// <summary>
/// sets the completion error message.
/// does not set the field in the db, so this should only be called when the information nets to be set in memory and not the db
/// (for instance during initialization)
/// </summary>
/// <param name="msg"></param>
void SetCompletionErrorMessage(string msg);
double GetSampleRateForHardware(string h);
float GetAAFForHardware(IDASCommunication das);
float GetAAFForHardware(IDASCommunication das, int sps);
/// <summary>
/// returns the Anti-Alias Filter (AAF) for the DAS in question
/// this is dependent on the sample rate for the hardware and a ratio in the config file
/// (RealtimeSampleRateAAFilterRatio)
/// </summary>
/// <param name="das"></param>
/// <returns></returns>
float GetRealtimeAAFForHardware(IDASCommunication idas, double samplerate);
void SetDefaultSetupFile();
/// <summary>
/// calculates whether the test setup is complete or not
/// will cause the test setup to be loaded if it is not yet
/// does not unload the test setup
/// </summary>
void CalculateIsComplete(bool bSetInDb = true);
void CheckSensorCalDates();
/// <summary>
/// marks a test setup as unchecked by setting the dirty flag, which means the next time completion is checked it will be calculated again
/// this function will change that flag in the database immediately
/// </summary>
void MarkIsCompleteUnchecked(bool skipMemoryCheck = false);
void ClearOverrides();
/// <summary>
/// frees up the memory assigned during Load, this includes channels, groups, meta data, etc
/// various things may cause us to load the information and hold the information for some setups,
/// but in general we want to unload it if we don't need it
/// </summary>
void UnLoad();
/// <summary>
/// signifies if the test setup is being used for a quick checkout
/// quick checkout tests are not stored and are run time only
/// </summary>
bool IsQuickCheckout { get; set; }
void Load(bool fromDB = false);
/// <summary>
/// All items from db are updated in our cache
/// </summary>
void UpdateFromDb();
IDASHardware[] GetHardwareFromDb();
IDASHardware[] GetAllCachedHardware2();
ISensorCalibration[] GetCachedSensorCalibrations();
ISensorData[] GetCachedSensors();
/// <summary>
/// loads all the information for the test setup from tables in the db
/// we do this so that we can keep the minimal information on hand until we need it
/// </summary>
void LoadFromDb();
string GetTestIdNode();
/// <summary>
/// gets a serialized version of the settings table
/// </summary>
/// <returns></returns>
string GetSettings();
/// <summary>
/// loads values from a serialized string into the settings table
/// </summary>
/// <param name="s"></param>
void LoadSettings(string s);
bool CheckListTriggerStartCheck { get; set; }
void FilterTestObjects(string term);
int GetAbsoluteNumber(string serial, int dasChannelNumber);
double GetPreTriggerSeconds(string serial);
double GetPostTriggerSeconds(string serial);
int GetNumberOfRealtimeSupportedChannels();
/// <summary>
/// for some reason it seems custom and lab details are held in two different areas, in meta deta and in the custom/lab detail objects
/// this function merely synchronizes the meta data with the objects
/// </summary>
void SynchronizeTestMetaData();
#region CalculatedChannels
void UpdateCalculatedChannelId(string[] names, int[] newIds);
void UpdateCalculatedChannelId(string name, int newId);
void RemoveImpossibleCalculatedChannels();
void ReplaceCalculatedChannel(Dictionary<string, string> oldIdToNewIdLookup);
void RenameCalculatedChannels(string oldName, string newName);
#endregion CalculatedChannels
void SetHardwareOverride(string hid, bool bAdd);
/// <summary>
/// takes a dynamic group in the test and replaces it with a snapshot of the static group
/// also updates calculated channels and level trigger channels
/// 15400 Group Push/Pull should allow the LT to be preserved in the Test Setup regardless of push/pull
/// </summary>
/// <param name="_updateGroup"></param>
/// <param name="staticGroup"></param>
void UpdateDynamicGroupFromStaticGroup(IGroup _updateGroup, IGroup staticGroup);
#region MetaData
// FB14362 This method will keep the _metaDataLookup dictionary updated to prevent the missing data from database.
void UpdateMetaDataLookupKey(char oldKey, char newKey);
#endregion MetaData
void Rename(string newName);
}
}

View File

@@ -0,0 +1,15 @@
using System;
namespace DTS.Common.Classes.TestSetups
{
public class SimpleHardware : Tuple<string, string, int, int>
{
public SimpleHardware(string serialNumber, string parentDAS, int dasId, int dasType) : base(serialNumber, parentDAS, dasId, dasType)
{
}
public string SerialNumber => Item1;
public string ParentDAS => Item2;
public int DASId => Item3;
public int DASType => Item4;
}
}

View File

@@ -0,0 +1,31 @@
namespace DTS.Common.Classes.DSP
{
/// <summary>
/// this is a restriction on who can use this filter
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Acronym")]
public class DSPFilterRestriction
{
/// <summary>
/// the Hardware_Type string value for the das (e.g. SLICE6_AIR, etc)
/// empty string means all das
/// </summary>
public string DASType { get; set; }
/// <summary>
/// the protocol version for that das (<=0 means all protocol versions will work)
/// </summary>
public int ProtocolVersion { get; set; }
public DSPFilterRestriction()
{
DASType = string.Empty;
ProtocolVersion = -1;
}
public DSPFilterRestriction(string dasType, int protocolVersion)
{
DASType = dasType;
ProtocolVersion = protocolVersion;
}
}
}

View File

@@ -0,0 +1,116 @@
using DTS.Common.Enums.DASFactory;
using System;
using System.Collections;
using System.Collections.Generic;
using static DTS.Common.Enums.DASFactory.DFConstantsAndEnums;
namespace DTS.Common.Classes.DASFactory
{
public class TemperatureConfig
{
public ushort LogEnable { get; set; }
public ushort LogIntervalSec { get; set; }
private BitArray _channels = new BitArray(new[] { 0x00, 0x00 });
public ushort Channels
{
get
{
var bytes = new byte[2];
_channels.CopyTo(bytes, 0);
return BitConverter.ToUInt16(bytes, 0);
}
set
{
var bytes = BitConverter.GetBytes(value);
_channels = new BitArray(bytes);
}
}
public const ushort Reserved = 0;
public bool MCUTemp
{
get => _channels.Get((int)TempLogChannelBits.OnBoardTemp);
set => _channels.Set((int)TempLogChannelBits.OnBoardTemp, value);
}
public bool OnBoardHumidity
{
get => _channels.Get((int)TempLogChannelBits.OnBoardHumidity);
set => _channels.Set((int)TempLogChannelBits.OnBoardHumidity, value);
}
public bool EnvironmentalCh1
{
get => _channels.Get((int)TempLogChannelBits.EnvironmentalCh1);
set => _channels.Set((int)TempLogChannelBits.EnvironmentalCh1, value);
}
public bool EnvironmentalCh2
{
get => _channels.Get((int)TempLogChannelBits.EnvironmentalCh2);
set => _channels.Set((int)TempLogChannelBits.EnvironmentalCh2, value);
}
public bool EnvironmentalCh3
{
get => _channels.Get((int)TempLogChannelBits.EnvironmentalCh3);
set => _channels.Set((int)TempLogChannelBits.EnvironmentalCh3, value);
}
public bool EnvironmentalCh4
{
get => _channels.Get((int)TempLogChannelBits.EnvironmentalCh4);
set => _channels.Set((int)TempLogChannelBits.EnvironmentalCh4, value);
}
public ushort[] ToUShortArray()
{
return new[] { LogEnable, LogIntervalSec, Channels, Reserved };
}
public TemperatureConfig() { }
public TemperatureConfig(ushort[] ushortArray)
{
if (null == ushortArray) { return; }
LogEnable = GetUShort(ushortArray, 0);
LogIntervalSec = GetUShort(ushortArray, 1);
Channels = GetUShort(ushortArray, 2);
}
private ushort GetUShort(ushort[] ushortArray, int position)
{
if (ushortArray.Length > position) { return ushortArray[position]; }
return 0;
}
public int[] GetChannelsArray()
{
var list = new List<int>();
for (var i = 0; i < _channels.Length; i++)
{
if (_channels.Get(i))
{
list.Add(i);
}
}
return list.ToArray();
}
public S6DBDiagnosticChannelList[] GetMeasurementChannels()
{
var list = new List<S6DBDiagnosticChannelList>();
if (MCUTemp) { list.Add(S6DBDiagnosticChannelList.DiagMcuTemperature); }
if (OnBoardHumidity) { list.Add(S6DBDiagnosticChannelList.DiagEnv_1_Humidity); }
if (EnvironmentalCh1) { list.Add(S6DBDiagnosticChannelList.DiagEnv_1_Temperature); }
if (EnvironmentalCh2) { list.Add(S6DBDiagnosticChannelList.DiagEnv_2_Temperature); }
if (EnvironmentalCh3) { list.Add(S6DBDiagnosticChannelList.DiagEnv_3_Temperature); }
if (EnvironmentalCh4) { list.Add(S6DBDiagnosticChannelList.DiagEnv_4_Temperature); }
return list.ToArray();
}
private readonly Dictionary<S6DBDiagnosticChannelList, TempLogChannelBits> _diagChannelToTempLogBit = new Dictionary<S6DBDiagnosticChannelList, TempLogChannelBits>()
{
{S6DBDiagnosticChannelList.DiagMcuTemperature, TempLogChannelBits.OnBoardTemp },
{S6DBDiagnosticChannelList.DiagEnv_1_Humidity, TempLogChannelBits.OnBoardHumidity },
{S6DBDiagnosticChannelList.DiagEnv_1_Temperature, TempLogChannelBits.EnvironmentalCh1 },
{S6DBDiagnosticChannelList.DiagEnv_2_Temperature, TempLogChannelBits.EnvironmentalCh2 },
{S6DBDiagnosticChannelList.DiagEnv_3_Temperature, TempLogChannelBits.EnvironmentalCh3 },
{S6DBDiagnosticChannelList.DiagEnv_4_Temperature, TempLogChannelBits.EnvironmentalCh4 }
};
public TempLogChannelBits GetChannelBitForDiagChannel(S6DBDiagnosticChannelList ch)
{
if (_diagChannelToTempLogBit.ContainsKey(ch)) { return _diagChannelToTempLogBit[ch]; }
throw new NullReferenceException($"Not found: {ch}");
}
}
}