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,68 @@
using System;
using System.ComponentModel;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface ITestChannel : INotifyPropertyChanged
{
string SerialNumber { get; set; }
string ChannelId { get; set; }
string Description { get; set; }
string ChannelGroupName { get; set; }
string ChannelType { get; set; }
int Number { get; set; }
string DigitalMultiplier { get; set; }
string DigitalMode { get; set; }
DateTime Start { get; set; }
string Bridge { get; set; }
double BridgeResistanceOhms { get; set; }
double ZeroPoint { get; set; }
string ChannelDescriptionString { get; set; }
string ChannelName2 { get; set; }
string HardwareChannelName { get; set; }
double DesiredRange { get; set; }
double Sensitivity { get; set; }
string SoftwareFilter { get; set; }
bool ProportionalToExcitation { get; set; }
bool IsInverted { get; set; }
string LinearizationFormula { get; set; }
bool IsSubsampled { get; set; }
int AbsoluteDisplayOrder { get; set; }
DateTime LastCalibrationDate { get; set; }
string SensorId { get; set; }
int OffsetToleranceLowMv { get; set; }
int OffsetToleranceHighMv { get; set; }
int DataFlag { get; set; }
string ExcitationVoltage { get; set; }
string Eu { get; set; }
bool CalSignalEnabled { get; set; }
bool ShuntEnabled { get; set; }
bool VoltageInsertionCheckEnabled { get; set; }
bool RemoveOffset { get; set; }
string ZeroMethod { get; set; }
double ZeroAverageWindowBegin { get; set; }
double ZeroAverageWindowEnd { get; set; }
int InitialEu { get; set; }
string InitialOffset { get; set; }
int UnsubsampledSampleRateHz { get; set; }
double MeasuredShuntDeflectionMv { get; set; }
double TargetShuntDeflectionMv { get; set; }
double MeasuredExcitationVoltage { get; set; }
double FactoryExcitationVoltage { get; set; }
double TimeOfFirstSample { get; set; }
int Multiplier { get; set; }
int UserOffsetEu { get; set; }
int UnitConversion { get; set; }
bool AtCapacity { get; set; }
int CapacityOutputIsBasedOn { get; set; }
string SourceChannelNumber { get; set; }
string SourceModuleNumber { get; set; }
string SourceModuleSerialNumber { get; set; }
string Calculation { get; set; }
int SampleRateHz { get; set; }
string SensitivityUnits { get; set; }
int SensorCapacity { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile;
using Prism.Events;
namespace DTS.Common.Events.TTSImport
{
/// <summary>
/// The TTSImportTestSetupChangedEvent event.
/// </summary>
///
/// <remarks>This event is published whenever the Test Setup is changed.</remarks>
///
public class TTSImportTestSetupChangedEvent : PubSubEvent<ITTSSetup> { }
}

View File

@@ -0,0 +1,111 @@
using System.Collections.Generic;
namespace DTS.Common.Utils
{
public class IPRange
{
/// <summary>
/// ip range, or a start and a stop
/// </summary>
public IPAddressIntForm RangeStart { get; set; }
public IPAddressIntForm RangeEnd { get; set; }
public IPRange(IPAddressIntForm start, IPAddressIntForm end)
{
RangeStart = start;
RangeEnd = end;
}
}
/// <summary>
/// just structure for ips broken into bytes
/// </summary>
public class IPAddressIntForm
{
public int ByteOne { get; }
public int ByteTwo { get; }
public int ByteThree { get; }
public int ByteFour { get; }
public IPAddressIntForm(int b1, int b2, int b3, int b4)
{
ByteOne = b1;
ByteTwo = b2;
ByteThree = b3;
ByteFour = b4;
}
public override string ToString()
{
return $"{ByteOne}.{ByteTwo}.{ByteThree}.{ByteFour}";
}
public static bool TryParse(string input, out IPAddressIntForm output)
{
var tokens = input.Split('.');
if (4 != tokens.Length)
{
output = null;
return false;
}
if (int.TryParse(tokens[0], out int one)
&& int.TryParse(tokens[1], out int two)
&& int.TryParse(tokens[2], out int three)
&& int.TryParse(tokens[3], out int four))
{
output = new IPAddressIntForm(one, two, three, four);
return true;
}
else
{
output = null;
return false;
}
}
internal class IPComparer : IComparer<IPAddressIntForm>
{
public int Compare(IPAddressIntForm x, IPAddressIntForm y)
{
if (x == y) { return 0; }
if (null == x) { return -1; }
if (null == y) { return 1; }
var ret = x.ByteOne.CompareTo(y.ByteOne);
if (ret != 0) { return ret; }
ret = x.ByteTwo.CompareTo(y.ByteTwo);
if (ret != 0) { return ret; }
ret = x.ByteThree.CompareTo(y.ByteThree);
if (ret != 0) { return ret; }
ret = x.ByteFour.CompareTo(y.ByteFour);
if (ret != 0) { return ret; }
return 0;
}
}
/// <summary>
/// gets all ips between a start and an end
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static string[] GetAllIPs(IPAddressIntForm a, IPAddressIntForm b)
{
var list = new List<string>();
var comparer = new IPComparer();
IPAddressIntForm start = a;
IPAddressIntForm end = b;
if (comparer.Compare(a, b) > 0) { start = b; end = a; }
for( var firstByte = start.ByteOne; firstByte <= end.ByteOne; firstByte ++)
{
for( var secondByte = start.ByteTwo; secondByte <= end.ByteTwo; secondByte ++)
{
for ( var thirdByte = start.ByteThree; thirdByte <= end.ByteThree; thirdByte ++)
{
for ( var fourthByte = start.ByteFour; fourthByte <= end.ByteFour; fourthByte ++)
{
list.Add($"{firstByte}.{secondByte}.{thirdByte}.{fourthByte}");
}
}
}
}
return list.ToArray();
}
}
}

View File

@@ -0,0 +1,95 @@
using System;
namespace DTS.Common.Interface.DASFactory.Download
{
public interface IDownload
{
/// <summary>
/// What do you want to download?
/// </summary>
IDownloadRequest WhatToDownload { get; set; }
void SetWhatToDownload(IDownloadRequest request, bool bSetInDb = true);
/// <summary>
/// The Retrieved information about stored events.
/// </summary>
IDownloadReport EventInfo { get; set; }
void SetEventInfo(IDownloadReport eventInfo, bool bSetInDb = true);
/// <summary>
/// QueryDownloadedStatus will fill this array (indexed by event number, true if
/// HasBeenDownloaded was set for this event, false otherwise)
/// </summary>
bool[] EventDownloadedStatus { get; set; }
void SetEventDownloadStatus(bool[] status, bool storeInDb = true);
/// <summary>
/// DASFactory will fill this array (indexed by event number).
/// </summary>
Guid[] EventGuids { get; set; }
void SetEventGuids(Guid[] guids, bool storeInDb = true);
/// <summary>
/// DASFactory will fill this array (indexed by event number).
/// </summary>
ushort[] FaultFlags { get; set; }
void SetEventFaultFlags(ushort[] flags, bool storeInDb = true);
/// <summary>
/// any extended fault flags1, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags1 { get; set; }
/// <summary>
/// any extended fault flags2, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags2 { get; set; }
/// <summary>
/// any extended fault flags3, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags3 { get; set; }
/// <summary>
/// any extended fault flags4, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags4 { get; set; }
/// <summary>
/// sets the properties for extended fault flags, first array is always events, second array is extended fault flags
/// there are currently 4 extended fault flags in SLICE
/// http://manuscript.dts.local/f/cases/39223/
/// </summary>
/// <param name="flags"></param>
void SetExtendedFaultFlags(uint[][] flags);
/// <summary>
/// DASFactory will fill this array (indexed by event number).
/// </summary>
byte[] ArmAttempts { get; set; }
void SetEventArmAttemps(byte[] armAttempts, bool storeInDb = true);
}
public static class DownloadExtendedFaultFunctions
{
public static void SetExtendedFaultFlags(uint[][] flags, IDownload download)
{
if (null == flags || 0 == flags.Length)
{
ClearExtendedFaultFlags(download);
return;
}
download.ExtendedFaultFlags1 = new uint[flags.Length];
download.ExtendedFaultFlags2 = new uint[flags.Length];
download.ExtendedFaultFlags3 = new uint[flags.Length];
download.ExtendedFaultFlags4 = new uint[flags.Length];
for (var i = 0; i < flags.Length; i++)
{
download.ExtendedFaultFlags1[i] = flags[i].Length > 0 ? flags[i][0] : 0;
download.ExtendedFaultFlags2[i] = flags[i].Length > 1 ? flags[i][1] : 0;
download.ExtendedFaultFlags3[i] = flags[i].Length > 2 ? flags[i][2] : 0;
download.ExtendedFaultFlags4[i] = flags[i].Length > 3 ? flags[i][3] : 0;
}
}
public static void ClearExtendedFaultFlags(IDownload download)
{
download.ExtendedFaultFlags1 = null;
download.ExtendedFaultFlags2 = null;
download.ExtendedFaultFlags3 = null;
download.ExtendedFaultFlags4 = null;
}
}
}