init
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Enums.Groups;
|
||||
using DTS.Common.Interface.Channels;
|
||||
using DTS.Common.Utils;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DTS.Common.Interface.Groups
|
||||
{
|
||||
/// <summary>
|
||||
/// this class describes the view module for the group import module
|
||||
/// this handles iteraction betweens the views and the application, as well as
|
||||
/// the logic and intermediate data for the module
|
||||
/// </summary>
|
||||
public interface IGroupImportViewModel : IBaseViewModel
|
||||
{
|
||||
void SetStatus(string message, Color color);
|
||||
/// <summary>
|
||||
/// options view controls selecting files
|
||||
/// </summary>
|
||||
IGroupImportOptionsView ImportOptionsView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// preview view handles selecting groups and viewing channels in a .grp file
|
||||
/// </summary>
|
||||
IGroupImportPreviewView ImportPreviewView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// handles commiting and displaying progress as commiting groups
|
||||
/// </summary>
|
||||
IGroupImportImportView ImportView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// reads source files and parses out channels and groups
|
||||
/// </summary>
|
||||
void ParseSourceFiles(string userTags);
|
||||
|
||||
/// <summary>
|
||||
/// commits groups and channels to application
|
||||
/// </summary>
|
||||
void Import();
|
||||
|
||||
/// <summary>
|
||||
/// resets the view model to initial values
|
||||
/// we are currently not creating a new viewmodel in the page, but re-using an existing one
|
||||
/// so everytime we re-visit the page we must re-initialize the vm
|
||||
/// </summary>
|
||||
void Reset();
|
||||
|
||||
/// <summary>
|
||||
/// logging facility to log any messages to
|
||||
/// </summary>
|
||||
FileUtils.LogDelegate Logger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// nav steps exist outside the group import module, and inside
|
||||
/// the application itself
|
||||
/// this is the function that allows the module to change nav steps
|
||||
/// </summary>
|
||||
SwitchNavStepsDelegate SwitchNavSteps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// this provides a function for checking whether a group already exists in the application or not
|
||||
/// </summary>
|
||||
CheckGroupExistsDelegate CheckGroupExists { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// this provides a function for checking whether a sensor already exists in the application or not
|
||||
/// </summary>
|
||||
CheckSensorExistsDelegate CheckSensorExists { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// as groups exist in the application space currently, we need the application to actually create a group
|
||||
/// this is the function that lets the module invoke creating a group
|
||||
/// </summary>
|
||||
CreateGroupDelegate CreateGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// as groups exist in the application space currently, we need the application to actually create channels in a group
|
||||
/// this is the function that lets the module invoke adding a channel to a group
|
||||
/// </summary>
|
||||
AddChannelToGroupDelegate AddChannel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// as groups exist in the application space currently, we need the application to actually commit groups to the database
|
||||
/// this is the function that lets the module invoke commiting a group to the db
|
||||
/// </summary>
|
||||
CommitGroupsDelegate CommitGroups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// allows the module to disable the UI
|
||||
/// </summary>
|
||||
Disable_UIDelegate DisableUI { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// allows the module to enable the UI
|
||||
/// </summary>
|
||||
Enable_UIDelegate EnableUI { get; set; }
|
||||
bool BrowseOk { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delegate describing a method of switching navigation steps
|
||||
/// </summary>
|
||||
/// <param name="step">step to switch to</param>
|
||||
public delegate void SwitchNavStepsDelegate(GroupImportEnums.Steps step);
|
||||
|
||||
/// <summary>
|
||||
/// delegate describing a method of checking if a group exists
|
||||
/// </summary>
|
||||
/// <param name="name">group serial number/name to check for</param>
|
||||
/// <returns></returns>
|
||||
public delegate bool CheckGroupExistsDelegate(string name);
|
||||
|
||||
/// <summary>
|
||||
/// delegate describing a method of checking if a sensor exists
|
||||
/// </summary>
|
||||
/// <param name="serialNumber">serial number of sensor to check for</param>
|
||||
/// <returns></returns>
|
||||
public delegate bool CheckSensorExistsDelegate(string serialNumber);
|
||||
|
||||
/// <summary>
|
||||
/// delegate describing a method for creating a group
|
||||
/// </summary>
|
||||
/// <param name="serialNumber">serial number of new group</param>
|
||||
/// <param name="tags">tags that will be added to new group</param>
|
||||
public delegate void CreateGroupDelegate(string serialNumber, string tags);
|
||||
|
||||
/// <summary>
|
||||
/// adds a channel to a group
|
||||
/// channels are added to the end of the groups existing channels
|
||||
/// </summary>
|
||||
/// <param name="groupSerialNumber">group serial number/name to add channel to</param>
|
||||
/// <param name="displayName">the display name of the channel</param>
|
||||
/// <param name="sensorSerialNumber">the sensor serial number of the sensor on the channel</param>
|
||||
/// <param name="capacity">null if the sensor capacity should be used, otherwise the desired range for the channel</param>
|
||||
/// <param name="invert">null if the sensor invert setting should be used, otherwise the desired invert settings for the channel</param>
|
||||
public delegate void AddChannelToGroupDelegate(string groupSerialNumber, string displayName,
|
||||
string sensorSerialNumber, double? capacity, bool? invert, string isoCode, IChannelSetting[] channelDefaults);
|
||||
|
||||
/// <summary>
|
||||
/// delegate describing a method for commiting a group to the database
|
||||
/// </summary>
|
||||
/// <param name="serialNumber"></param>
|
||||
public delegate void CommitGroupsDelegate(string[] serialNumbers);
|
||||
|
||||
public delegate void Disable_UIDelegate();
|
||||
|
||||
public delegate void Enable_UIDelegate();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using DTS.Common.Interface.Channels;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using DTS.Common.Interface.Sensors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Interface.TestSetups.TestSetupsList;
|
||||
|
||||
namespace DTS.Common.Interface.Groups.GroupList
|
||||
{
|
||||
public interface IGroup : IComparable<IGroup>
|
||||
{
|
||||
IGroupDbRecord GetIGroupDbRecord();
|
||||
int ChannelCount { get; set; }
|
||||
int Id { get; set; }
|
||||
string Name { get; set; }
|
||||
string DisplayName { get; set; }
|
||||
int? StaticGroupId { get; set; }
|
||||
string Description { get; set; }
|
||||
bool Embedded { get; set; }
|
||||
DateTime LastModified { get; set; }
|
||||
string LastModifiedBy { get; set; }
|
||||
/// <summary>
|
||||
/// returns true if group matches search term
|
||||
/// false otherwise
|
||||
/// </summary>
|
||||
/// <param name="term"></param>
|
||||
/// <returns></returns>
|
||||
bool Filter(string term);
|
||||
int[] IncludedHardware { get; set; }
|
||||
//holds a list of hardware identified using the old SerialNumber_type id scheme
|
||||
//I believe this is primarily for import purposes.
|
||||
string[] IncludedHardwareStringList { get; set; }
|
||||
bool Save(Channels.IGroupChannel[] groupChannels, bool canUserCommitChannelCodes);
|
||||
bool Save(Channels.IGroupChannel[] groupChannels, bool canUserCommitChannelCodes, ref List<DTS.Common.Interface.Channels.IGroupChannel> newGroupChannelList);
|
||||
void ClearGroupChannelSettingCache(long groupId);
|
||||
Channels.IGroupChannel[] GetAllChannels(bool bEditable, IDictionary<int, ISensorData> sensorLookup,
|
||||
IDictionary<int, IDASHardware> hardwareLookup, IChannelSetting[] channelDefaults, bool allowSensorPushAndPull = false);
|
||||
void LoadHardware();
|
||||
void ConvertToEmbedded(Channels.IGroupChannel[] groupChannels);
|
||||
|
||||
void DeterminePositionAndTestObject(Channels.IGroupChannel[] channels);
|
||||
bool PositionIsMixed { get; set; }
|
||||
bool PositionIsTextbox { get; set; }
|
||||
bool PositionIsCombobox { get; set; }
|
||||
string Position { get; set; }
|
||||
|
||||
bool TestObjectIsMixed { get; set; }
|
||||
string TestObject { get; set; }
|
||||
|
||||
int DisplayOrder { get; set; }
|
||||
|
||||
ISensorData GetSensor(Channels.IGroupChannel channel, ISensorData sensorData, bool bUseIsoFilter);
|
||||
|
||||
void SetSensor(Channels.IGroupChannel channel, ISensorData sensorData);
|
||||
void WriteXML(ref System.Xml.XmlWriter writer);
|
||||
IGroup ReadXML(System.Xml.XmlElement node, Dictionary<long, DTS.Common.Interface.Channels.IGroupChannel> channelLookup, List<ISensorData> sensors);
|
||||
List<Channels.IGroupChannel> GroupChannelList { get; set; }
|
||||
/// <summary>
|
||||
/// sets the included hardware property and the _bloaded property
|
||||
/// </summary>
|
||||
/// <param name="hardware"></param>
|
||||
void SetIncludedHardware(int[] hardware);
|
||||
List<TestSetupParentHelper> AssociatedTestSetups { get; set; }
|
||||
void SetTestSetupLists();
|
||||
bool StaticGroupIsEqual();
|
||||
bool IsDifferentThanStaticGroup { get; set; }
|
||||
bool TagCompatible(int[] tags);
|
||||
int[] TagIDs { get; set; }
|
||||
string GetTagsAsCommaSeparatedString(Classes.Tags.TagsInstance.TagsGetDelegate tagsGet);
|
||||
string Tags { get; set; }
|
||||
List<string> AvailableTestObjects { get; set; }
|
||||
string SelectedTestObjectItem { get; set; }
|
||||
List<string> AvailablePositions { get; set; }
|
||||
string SelectedPositionItem { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
|
||||
namespace DTS.Common.Events.RegionOfInterest.RegionOfInterestChannels
|
||||
{
|
||||
public class RegionOfInterestChannelsSelectedEvent : PubSubEvent<RegionOfInterestChannelsSelectedEventArgs> { }
|
||||
|
||||
public class RegionOfInterestChannelsSelectedEventArgs
|
||||
{
|
||||
public string RegionOfInterestSuffix { get; private set; }
|
||||
public string[] ChannelNames { get; private set; }
|
||||
public long[] ChannelIds { get; private set; }
|
||||
|
||||
public object Consumer { get; private set; }
|
||||
public RegionOfInterestChannelsSelectedEventArgs(string roiSuffix, string[] selectedChannelNames, long[] selectedChannelIds, object o)
|
||||
{
|
||||
RegionOfInterestSuffix = roiSuffix;
|
||||
ChannelNames = selectedChannelNames;
|
||||
ChannelIds = selectedChannelIds;
|
||||
Consumer = o;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace DTS.Common.Enums.Sensors
|
||||
{
|
||||
public enum NonLinearStyles
|
||||
{
|
||||
IRTraccManual,
|
||||
IRTraccDiagnosticsZero,
|
||||
IRTraccZeroMMmV,
|
||||
IRTraccAverageOverTime,
|
||||
Polynomial,
|
||||
IRTraccCalFactor
|
||||
}
|
||||
public enum NonLinearSLICEWareStyles
|
||||
{
|
||||
Manual,
|
||||
DiagnosticZeroMMmV,
|
||||
ZeroMMmV,
|
||||
AverageOverTime,
|
||||
Polynomial
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface.TestSetups.Imports.TTS
|
||||
{
|
||||
public interface IAnalogChannelsView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IPropertyViewModel : IBaseViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Tab View.
|
||||
/// </summary>
|
||||
IPropertyView View { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
using DTS.Common.Enums.Hardware;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DTS.Common.Classes.DSP
|
||||
{
|
||||
/// <summary>
|
||||
/// see IStreamingFilterProfile for more information
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Acronym")]
|
||||
public class DSPFilterType : IStreamingFilterProfile
|
||||
{
|
||||
public double Ratio { get; set; }
|
||||
public int EnumValue { get; set; }
|
||||
public string DisplayString { get; set; }
|
||||
public string DescriptionString { get; set; }
|
||||
private readonly List<DASRestriction> _restrictions = new List<DASRestriction>();
|
||||
public DASRestriction[] Restrictions { get => _restrictions.ToArray(); set { _restrictions.Clear(); _restrictions.AddRange(value); } }
|
||||
|
||||
public DSPFilterType() { }
|
||||
public DSPFilterType(DSPFilterCollection.DSPFilterDefaults filter, DASRestriction[] restrictions)
|
||||
{
|
||||
GetProfileValues(filter, out var displayName, out var description, out var enumValue, out var ratio);
|
||||
Initialize(enumValue, displayName, description, ratio, restrictions);
|
||||
}
|
||||
public DSPFilterType(int enumValue, string displayString, string descriptionString, double ratio, DASRestriction[] restrictions)
|
||||
{
|
||||
Initialize(enumValue, displayString, descriptionString, ratio, restrictions);
|
||||
}
|
||||
private void Initialize(int enumValue, string displayString, string descriptionString, double ratio, DASRestriction[] restrictions)
|
||||
{
|
||||
EnumValue = enumValue;
|
||||
DisplayString = displayString;
|
||||
DescriptionString = descriptionString;
|
||||
Restrictions = restrictions;
|
||||
Ratio = ratio;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return DisplayString;
|
||||
}
|
||||
public static void GetProfileValues(DSPFilterCollection.DSPFilterDefaults filter, out string displayName, out string description, out int enumValue,
|
||||
out double ratio)
|
||||
{
|
||||
displayName = string.Empty;
|
||||
description = string.Empty;
|
||||
enumValue = -1;
|
||||
ratio = -1;
|
||||
|
||||
var enumType = typeof(DSPFilterCollection.DSPFilterDefaults);
|
||||
var memberInfos = enumType.GetMember(filter.ToString());
|
||||
var enumValueMemberInfo = Array.Find(memberInfos, m => m.DeclaringType == enumType);
|
||||
var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(DisplayAttribute), false);
|
||||
|
||||
enumValue = (int)filter;
|
||||
description = ((DisplayAttribute)valueAttributes[0]).GetDescription();
|
||||
displayName = ((DisplayAttribute)valueAttributes[0]).GetName();
|
||||
|
||||
valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(ScalerAttribute), false);
|
||||
ratio = ((ScalerAttribute)valueAttributes[0]).Scaler;
|
||||
}
|
||||
/// <summary>
|
||||
/// this is the table of breakpoints and corresponding fC for S6A/br
|
||||
/// </summary>
|
||||
private static readonly List<Tuple<int, int>> _6PButterWorthTable = new List<Tuple<int, int>>
|
||||
(
|
||||
new[]
|
||||
{
|
||||
new Tuple<int,int>(8000, 1280),
|
||||
new Tuple<int,int>(5000, 610),
|
||||
new Tuple<int,int>(2000, 366),
|
||||
new Tuple<int,int>(1000, 120),
|
||||
new Tuple<int,int>(500,120),
|
||||
new Tuple<int,int>(200,50),
|
||||
new Tuple<int,int>(80,15)
|
||||
}
|
||||
);
|
||||
/// <summary>
|
||||
/// returns an array of breakpoints and fC for S6A and S6A-BR legacy butterworth digital filter
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Tuple<int, int>[] Get6PButterWorthLegacyTable() { return _6PButterWorthTable.ToArray(); }
|
||||
/// <summary>
|
||||
/// this is the cap of SPS where S6A will fall back on AAF
|
||||
/// </summary>
|
||||
public const int S6A_CAP = 20480;
|
||||
/// <summary>
|
||||
/// returns the fC given a hardware type, and the legacy 6P butterworth filter
|
||||
/// double.NaN means the filter is not supported
|
||||
/// </summary>
|
||||
/// <param name="sps"></param>
|
||||
/// <param name="hwType"></param>
|
||||
/// <returns></returns>
|
||||
public static double GetLegacytDSPFilterRate(double sps, string hwType)
|
||||
{
|
||||
//if we have legacy then we need the sample rate, if it's >8k s6abr then Fc
|
||||
if (hwType == HardwareTypes.SLICE6_AIR.ToString() && sps >= S6A_CAP) { return double.NaN; }
|
||||
|
||||
var array = Get6PButterWorthLegacyTable();
|
||||
Array.Sort(array, (x, y) => { return y.Item1.CompareTo(x.Item1); });
|
||||
foreach (var entry in array)
|
||||
{
|
||||
if (sps >= entry.Item1) { return entry.Item2; }
|
||||
}
|
||||
return double.NaN;
|
||||
}
|
||||
/// <summary>
|
||||
/// returns a filter rate given the current digital filter profile and sps and hardware type
|
||||
/// </summary>
|
||||
/// <param name="sps"></param>
|
||||
/// <param name="hwType"></param>
|
||||
/// <returns></returns>
|
||||
public double GetDSPFilterRate(double sps, string hwType)
|
||||
{
|
||||
if (EnumValue != DSPFilterCollection.BUTTERWORTH) { return double.NaN; }
|
||||
if (!Array.Exists(Restrictions, x => x.DASType == hwType || string.IsNullOrEmpty(x.DASType))) { return double.NaN; }
|
||||
return GetLegacytDSPFilterRate(sps, hwType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user