Browse Source

开始编写服务端代码

l2736 1 week ago
parent
commit
d8bdd27b7c
42 changed files with 1365 additions and 412 deletions
  1. BIN
      Fpga/FPGA/Fpga_Main.vi
  2. BIN
      Fpga/FPGA/伺服控制/SignalGen.vi
  3. BIN
      Fpga/FPGA/伺服控制/三角波生成.vi
  4. BIN
      Fpga/FPGA/伺服控制/信号发生数据初始化.vi
  5. BIN
      Fpga/FPGA/伺服控制/方波生成.vi
  6. BIN
      Fpga/FPGA/伺服控制/正弦发生.vi
  7. BIN
      Fpga/FPGA/伺服控制/相位更新.vi
  8. BIN
      Fpga/FPGA/自由度/八缸力平衡控制.vi
  9. BIN
      Fpga/FPGA/自由度/平衡缸驱动.vi
  10. BIN
      Fpga/FPGA/自由度/求八缸位移.vi
  11. BIN
      Fpga/FPGA/自由度/计算位移.vi
  12. BIN
      Fpga/FPGA/自由度/驱动计算.vi
  13. BIN
      Fpga/FPGA/通道定义/外部输入通道定义.vi
  14. BIN
      Fpga/FPGA/通道定义/寄存器初始化.vi
  15. BIN
      Fpga/FPGA/颤振/颤振信号.vi
  16. 1 1
      Fpga/fpga.aliases
  17. 1 1
      Fpga/fpga.lvlps
  18. 0 0
      Fpga/fpga.lvproj
  19. 597 315
      Service/ShakerService/Shaker.lvbitx
  20. 22 0
      Service/ShakerService/Tools/Tools.cs
  21. 0 28
      Service/ShakerService/ViewModel/DisplacementConfigViewModel.cs
  22. 36 0
      Service/ShakerService/ViewModel/FlutterViewModel.cs
  23. 68 0
      Service/ShakerService/ViewModel/ServoConfigViewModel.cs
  24. 88 0
      Service/ShakerService/ViewModel/ShakerChannelConfigViewModel.cs
  25. 54 8
      Service/ShakerService/ViewModel/ShakerConfigViewModel.cs
  26. 44 0
      Shaker.Model/AIChannel.cs
  27. 35 0
      Shaker.Model/AIChannelType.cs
  28. 44 0
      Shaker.Model/AOChannel.cs
  29. 24 0
      Shaker.Model/AOChannelType.cs
  30. 44 0
      Shaker.Model/DIOChannel.cs
  31. 39 0
      Shaker.Model/Models/AIConfigModel.cs
  32. 25 0
      Shaker.Model/Models/AOConfigModel.cs
  33. 18 0
      Shaker.Model/Models/BalancingControlModel.cs
  34. 0 29
      Shaker.Model/Models/DisplacementChannelConfigModel.cs
  35. 0 26
      Shaker.Model/Models/DisplacementConfigModel.cs
  36. 19 0
      Shaker.Model/Models/DriverModel.cs
  37. 29 0
      Shaker.Model/Models/FlutterModel.cs
  38. 19 0
      Shaker.Model/Models/PIModel.cs
  39. 47 0
      Shaker.Model/Models/ServoConfigModel.cs
  40. 51 0
      Shaker.Model/Models/ShakerChannelConfigModel.cs
  41. 37 4
      Shaker.Model/Models/ShakerConfigModel.cs
  42. 23 0
      Shaker.Model/Polarity.cs

BIN
Fpga/FPGA/Fpga_Main.vi


BIN
Fpga/FPGA/伺服控制/SignalGen.vi


BIN
Fpga/FPGA/伺服控制/三角波生成.vi


BIN
Fpga/FPGA/伺服控制/信号发生数据初始化.vi


BIN
Fpga/FPGA/伺服控制/方波生成.vi


BIN
Fpga/FPGA/伺服控制/正弦发生.vi


BIN
Fpga/FPGA/伺服控制/相位更新.vi


BIN
Fpga/FPGA/自由度/八缸力平衡控制.vi


BIN
Fpga/FPGA/自由度/平衡缸驱动.vi


BIN
Fpga/FPGA/自由度/求八缸位移.vi


BIN
Fpga/FPGA/自由度/计算位移.vi


BIN
Fpga/FPGA/自由度/驱动计算.vi


BIN
Fpga/FPGA/通道定义/外部输入通道定义.vi


BIN
Fpga/FPGA/通道定义/寄存器初始化.vi


BIN
Fpga/FPGA/颤振/颤振信号.vi


+ 1 - 1
Fpga/fpga.aliases

@@ -2,4 +2,4 @@
 RT CompactRIO终端 = "0.0.0.0"
 
 [我的电脑]
-我的电脑 = "172.24.64.1"
+我的电脑 = "192.168.176.1"

+ 1 - 1
Fpga/fpga.lvlps

@@ -1,2 +1,2 @@
 [ÏîÄ¿´°¿ÚÊý¾Ý(_D)]
-ProjectExplorer.ClassicPosition[String] = "234,367,1025,845"
+ProjectExplorer.ClassicPosition[String] = "267,566,1086,1004"

File diff suppressed because it is too large
+ 0 - 0
Fpga/fpga.lvproj


File diff suppressed because it is too large
+ 597 - 315
Service/ShakerService/Shaker.lvbitx


+ 22 - 0
Service/ShakerService/Tools/Tools.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShakerService.Tools
+{
+    internal static class Tools
+    {
+        /// <summary>
+        /// 计算计数的间隔时间
+        /// </summary>
+        /// <param name="maxCount">最大计数</param>
+        /// <returns></returns>
+
+        public static double CalcInterval(uint maxCount)
+        {
+            return 1d / (maxCount << 1);
+        }
+    }
+}

+ 0 - 28
Service/ShakerService/ViewModel/DisplacementConfigViewModel.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ShakerService.ViewModel
-{
-    internal sealed class DisplacementConfigViewModel:ViewModelBase<Shaker.Models.DisplacementConfigModel>
-    {
-        /// <summary>
-        /// 位移灵敏度
-        /// </summary>
-        public IReadOnlyList<Shaker.Models.DisplacementChannelConfigModel> Models =>CurrentModel.DisplacementChannels;
-        /// <summary>
-        /// 位移前馈增益
-        /// </summary>
-        public double DisplacementFeedforwardGain =>CurrentModel.DisplacementFeedforwardGain;
-        public override void SetFpga()
-        {
-            base.SetFpga();
-            ShakerFpga.ShakerFpga.Instance.位移通道.Values = [.. Models.Select(x => x.Channel).Take(ShakerConfigViewModel.Instance.DisplacementCount)];
-            ShakerFpga.ShakerFpga.Instance.位移灵敏度.Value = [.. Models.Select(x => x.Sensitivity).Take(ShakerConfigViewModel.Instance.DisplacementCount)];
-            ShakerFpga.ShakerFpga.Instance.位移直偏.Value = [.. Models.Select(x => x.Bias).Take(ShakerConfigViewModel.Instance.DisplacementCount)];
-            ShakerFpga.ShakerFpga.Instance.位移前馈增益.Value = DisplacementFeedforwardGain;
-        }
-    }
-}

+ 36 - 0
Service/ShakerService/ViewModel/FlutterViewModel.cs

@@ -0,0 +1,36 @@
+using Shaker.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShakerService.ViewModel
+{
+    internal sealed class FlutterViewModel:ViewModelBase<FlutterModel>
+    {
+        /// <summary>
+        /// 频率(Hz)
+        /// </summary>
+        public double Frequency=>CurrentModel.Frequency;
+        /// <summary>
+        /// 幅值(V)
+        /// </summary>
+        public double Amplitude=>CurrentModel.Amplitude;
+        private FlutterViewModel():base()
+        {
+
+        }
+        static FlutterViewModel()
+        {
+
+        }
+        public override void SetFpga()
+        {
+            base.SetFpga();
+            ShakerFpga.ShakerFpga.Instance.颤震频率.Value = CurrentModel.Frequency * 2 / ShakerConfigViewModel.Instance.SampleRate;
+            ShakerFpga.ShakerFpga.Instance.颤振信号幅值.Value = CurrentModel.Amplitude;
+        }
+        public static FlutterViewModel Instance { get; } = new FlutterViewModel();
+    }
+}

+ 68 - 0
Service/ShakerService/ViewModel/ServoConfigViewModel.cs

@@ -0,0 +1,68 @@
+using Shaker.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShakerService.ViewModel
+{
+    internal sealed class ServoConfigViewModel:ViewModelBase<ServoConfigModel>
+    {
+        private ServoConfigViewModel():base()
+        {
+
+        }
+        static ServoConfigViewModel()
+        {
+
+        }
+        public override void SetFpga()
+        {
+            base.SetFpga();
+            ShakerFpga.ShakerFpga.Instance.P参数.Value = [.. PI.Select(x => x.P)];
+            ShakerFpga.ShakerFpga.Instance.I参数.Value = [.. PI.Select(x => x.I)];
+
+            ShakerFpga.ShakerFpga.Instance.水平阀死区电压.Value = HorizontalBarrierPotential;
+            ShakerFpga.ShakerFpga.Instance.竖直阀死区电压.Value = VerticalBarrierPotential;
+
+            ShakerFpga.ShakerFpga.Instance.最大积分电压.Value = MaxIntegratedVoltage;
+            ShakerFpga.ShakerFpga.Instance.最大驱动电压.Value = MaxDriverVoltage;
+
+            ShakerFpga.ShakerFpga.Instance.急停后驱动限幅值.Value = EmerhencyDriverLimitVoltage;
+            ShakerFpga.ShakerFpga.Instance.位移前馈增益.Value = DisplacementFeedforwardGain;
+            ShakerFpga.ShakerFpga.Instance.驱动超限电压.Value = DriverOverLimitVoltage;
+        }
+        public static ServoConfigViewModel Instance { get; } = new ServoConfigViewModel();
+        public IReadOnlyList<PIModel> PI => CurrentModel.PI;
+        /// <summary>
+        /// 水平阀死区电压(V)
+        /// </summary>
+        public double HorizontalBarrierPotential => CurrentModel.HorizontalBarrierPotential;
+        /// <summary>
+        /// 竖直阀死区电压(V)
+        /// </summary>
+        public double VerticalBarrierPotential => CurrentModel.VerticalBarrierPotential;
+        /// <summary>
+        /// 最大积分电压(V)
+        /// </summary>
+        public double MaxIntegratedVoltage => CurrentModel.MaxIntegratedVoltage;
+        /// <summary>
+        /// 位移前馈增益
+        /// </summary>
+
+        public double DisplacementFeedforwardGain => CurrentModel.DisplacementFeedforwardGain;
+        /// <summary>
+        /// 最大驱动电压(V)
+        /// </summary>
+        public double MaxDriverVoltage => CurrentModel.MaxDriverVoltage;
+        /// <summary>
+        /// 驱动超限电压(V)
+        /// </summary>
+        public double DriverOverLimitVoltage => CurrentModel.DriverOverLimitVoltage;
+        /// <summary>
+        /// 急停后驱动限幅值(V)
+        /// </summary>
+        public double EmerhencyDriverLimitVoltage => CurrentModel.EmerhencyDriverLimitVoltage;
+    }
+}

+ 88 - 0
Service/ShakerService/ViewModel/ShakerChannelConfigViewModel.cs

@@ -0,0 +1,88 @@
+using Shaker.Model;
+using Shaker.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShakerService.ViewModel
+{
+    internal sealed class ShakerChannelConfigViewModel:ViewModelBase<Shaker.Models.ShakerChannelConfigModel>
+    {
+        private ShakerChannelConfigViewModel():base()
+        {
+
+        }
+        static ShakerChannelConfigViewModel()
+        {
+
+        }
+        /// <summary>
+        /// 位移通道
+        /// </summary>
+        public IReadOnlyList<AIConfigModel> Displacement =>CurrentModel.Displacement;
+        /// <summary>
+        /// 加速度通道
+        /// </summary>
+        public IReadOnlyList<AIConfigModel> Acceleration =>CurrentModel.Acceleration;
+        /// <summary>
+        /// 外部输入通道
+        /// </summary>
+        public IReadOnlyList<AIConfigModel> OutSignal =>CurrentModel.OutSignal;
+        /// <summary>
+        /// 压差通道
+        /// </summary>
+        public IReadOnlyList<AIConfigModel> DifferentialPressure =>CurrentModel.DifferentialPressure;
+        /// <summary>
+        /// 支撑压力通道
+        /// </summary>
+        public IReadOnlyList<AIConfigModel> Pressure =>CurrentModel.Pressure;
+
+        /// <summary>
+        /// 水平缸通道
+        /// </summary>
+        public IReadOnlyList<AOConfigModel> Horizontal =>CurrentModel.Horizontal;
+        /// <summary>
+        /// 垂直缸通道
+        /// </summary>
+        public IReadOnlyList<AOConfigModel> Vertical =>CurrentModel.Vertical;
+        /// <summary>
+        /// 平衡缸通道
+        /// </summary>
+        public IReadOnlyList<AOChannel> Balancing =>CurrentModel.Balancing;
+        public override void SetFpga()
+        {
+            base.SetFpga();
+            ShakerFpga.ShakerFpga.Instance.位移通道.Values = [.. Displacement.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.位移灵敏度.Value = [.. Displacement.Select(x => x.Sensitivity)];
+            ShakerFpga.ShakerFpga.Instance.位移直偏.Value = [.. Displacement.Select(x => x.Bias)];
+
+            ShakerFpga.ShakerFpga.Instance.加速度通道.Values = [.. Acceleration.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.加速度灵敏度.Value = [.. Acceleration.Select(x => x.Sensitivity)];
+
+            ShakerFpga.ShakerFpga.Instance.外部输入通道.Values = [.. OutSignal.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.外部输入增益.Value = [.. OutSignal.Select(x => x.Sensitivity)];
+
+            ShakerFpga.ShakerFpga.Instance.压差通道.Values = [.. DifferentialPressure.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.压差直偏.Value = [.. DifferentialPressure.Select(x => x.Bias)];
+            ShakerFpga.ShakerFpga.Instance.压差灵敏度.Value = [.. DifferentialPressure.Select(x => x.Sensitivity)];
+
+
+            ShakerFpga.ShakerFpga.Instance.支撑压力通道.Values = [.. Pressure.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.支撑压力直偏.Value = [.. Pressure.Select(x => x.Bias)];
+            ShakerFpga.ShakerFpga.Instance.支撑压力灵敏度.Value = [.. Pressure.Select(x => x.Sensitivity)];
+
+
+            ShakerFpga.ShakerFpga.Instance.平衡缸通道.Values = [.. Balancing.Select(x => (byte)x)];
+
+            ShakerFpga.ShakerFpga.Instance.水平缸通道.Values = [.. Horizontal.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.垂直缸通道.Values = [.. Vertical.Select(x => (byte)x.Channel)];
+            ShakerFpga.ShakerFpga.Instance.伺服驱动直偏.Value = [.. Horizontal.Select(x => x.Bias),..Vertical.Select(x => x.Bias)];
+            ShakerFpga.ShakerFpga.Instance.伺服缸极性.Values = [.. Horizontal.Select(x => x.Polarity == Shaker.Model.Polarity.Positive), ..Vertical.Select(x => x.Polarity == Shaker.Model.Polarity.Positive)];
+            ShakerFpga.ShakerFpga.Instance.伺服开环.Values = [.. Horizontal.Select(x => x.OpenLoop), .. Vertical.Select(x => x.OpenLoop)];
+            ShakerFpga.ShakerFpga.Instance.伺服阀开环驱动.Value = [.. Horizontal.Select(x => x.OpenLoopDriver), .. Vertical.Select(x => x.OpenLoopDriver)];
+        }
+        public static ShakerChannelConfigViewModel Instance { get; } = new ShakerChannelConfigViewModel();
+    }
+}

+ 54 - 8
Service/ShakerService/ViewModel/ShakerConfigViewModel.cs

@@ -1,4 +1,5 @@
-using System;
+using Shaker.Model;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -6,9 +7,9 @@ using System.Threading.Tasks;
 
 namespace ShakerService.ViewModel
 {
-    internal sealed class ShakerConfigViewModel:ViewModelBase<Shaker.Models.ShakerConfigModel>
+    internal sealed class ShakerConfigViewModel : ViewModelBase<Shaker.Models.ShakerConfigModel>
     {
-        private ShakerConfigViewModel():base()
+        private ShakerConfigViewModel() : base()
         {
 
         }
@@ -19,16 +20,61 @@ namespace ShakerService.ViewModel
         /// <summary>
         /// 位移通道数
         /// </summary>
-        public int DisplacementCount =>CurrentModel.DisplacementCount;
+        public byte DisplacementCount => CurrentModel.DisplacementCount;
         /// <summary>
         /// 加速度通道数
         /// </summary>
-        public int AccelerationCount =>CurrentModel.AccelerationCount;
+        public byte AccelerationCount => CurrentModel.AccelerationCount;
         /// <summary>
-        /// 最大模拟通道数
+        /// 最大模拟输入通道数
         /// </summary>
-        public int MaxAICount=>CurrentModel.MaxAICount;
-
+        public byte MaxAICount => CurrentModel.MaxAICount;
+        /// <summary>
+        /// 最大模拟输出通道数
+        /// </summary>
+        public byte MaxAOCount => CurrentModel.MaxAOCount;
+        /// <summary>
+        /// 水平缸通道数
+        /// </summary>
+        public byte MaxHorizontalCount => CurrentModel.MaxHorizontalCount;
+        /// <summary>
+        /// 垂直缸通道数
+        /// </summary>
+        public byte MaxVerticalCount => CurrentModel.MaxVerticalCount;
+        /// <summary>
+        /// 平衡缸通道数
+        /// </summary>
+        public byte MaxBalancingCount => CurrentModel.MaxBalancingCount;
+        /// <summary>
+        /// 采样率
+        /// </summary>
+        public ushort SampleRate => CurrentModel.SampleRate;
+        /// <summary>
+        /// Fpga主时钟
+        /// </summary>
+        public uint FpgaClock => CurrentModel.FpgaClock;
         public static ShakerConfigViewModel Instance { get; } = new ShakerConfigViewModel();
+        public AIChannel MinAIChannel => CurrentModel.MinAIChannel;
+        public AIChannel MaxAIChannel => CurrentModel.MaxAIChannel;
+        public AOChannel MinAOChannel => CurrentModel.MinAOChannel;
+        public AOChannel MaxAOChannel => CurrentModel.MaxAOChannel;
+        public override void SetFpga()
+        {
+            base.SetFpga();
+            ShakerFpga.ShakerFpga.Instance.采样率.Value = SampleRate;
+            ShakerFpga.ShakerFpga.Instance.采样间隔.Value = 1d / SampleRate;
+            ShakerFpga.ShakerFpga.Instance.LoopRate.Value = FpgaClock / SampleRate;
+            ShakerFpga.ShakerFpga.Instance.信号停止最大计数.Value = CurrentModel.MaxSignalStopCount;
+            ShakerFpga.ShakerFpga.Instance.信号停止计数间隔.Value = Tools.Tools.CalcInterval(CurrentModel.MaxSignalStopCount);
+
+            ShakerFpga.ShakerFpga.Instance.升台面最大计数.Value = CurrentModel.MaxRiseCount;
+            ShakerFpga.ShakerFpga.Instance.升台面计数间隔.Value = Tools.Tools.CalcInterval(CurrentModel.MaxRiseCount);
+
+            ShakerFpga.ShakerFpga.Instance.降台面最大计数.Value = CurrentModel.MaxDropCount;
+            ShakerFpga.ShakerFpga.Instance.降台面计数间隔.Value = Tools.Tools.CalcInterval(CurrentModel.MaxDropCount);
+
+            ShakerFpga.ShakerFpga.Instance.零位改最大计数.Value = CurrentModel.MaxZeroChangedCount;
+            ShakerFpga.ShakerFpga.Instance.零位改计数间隔.Value = Tools.Tools.CalcInterval(CurrentModel.MaxZeroChangedCount);
+        }
     }
 }

+ 44 - 0
Shaker.Model/AIChannel.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Model
+{
+    public enum AIChannel:byte
+    {
+        Channel0,
+        Channel1,
+        Channel2, 
+        Channel3,
+        Channel4,
+        Channel5,
+        Channel6,
+        Channel7, 
+        Channel8,
+        Channel9,
+        Channel10,
+        Channel11, 
+        Channel12,
+        Channel13,
+        Channel14,
+        Channel15, 
+        Channel16, 
+        Channel17,
+        Channel18,
+        Channel19,
+        Channel20,
+        Channel21, 
+        Channel22,
+        Channel23, 
+        Channel24,
+        Channel25,
+        Channel26,
+        Channel27,
+        Channel28,
+        Channel29, 
+        Channel30, 
+        Channel31
+    }
+}

+ 35 - 0
Shaker.Model/AIChannelType.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Model
+{
+    /// <summary>
+    /// 模拟通道类型
+    /// </summary>
+    public enum AIChannelType
+    {
+        /// <summary>
+        /// 位移
+        /// </summary>
+        Displacement,
+        /// <summary>
+        /// 加速度
+        /// </summary>
+        Acceleration,
+        /// <summary>
+        /// 外部输入
+        /// </summary>
+        OutSignal,
+        /// <summary>
+        /// 压差
+        /// </summary>
+        DifferentialPressure,
+        /// <summary>
+        /// 压力
+        /// </summary>
+        Pressure
+    }
+}

+ 44 - 0
Shaker.Model/AOChannel.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Model
+{
+    public enum AOChannel:byte
+    {
+        Channel0,
+        Channel1, 
+        Channel2, 
+        Channel3, 
+        Channel4, 
+        Channel5,
+        Channel6, 
+        Channel7, 
+        Channel8, 
+        Channel9, 
+        Channel10,
+        Channel11, 
+        Channel12, 
+        Channel13, 
+        Channel14,
+        Channel15,
+        Channel16, 
+        Channel17, 
+        Channel18, 
+        Channel19, 
+        Channel20,
+        Channel21, 
+        Channel22, 
+        Channel23, 
+        Channel24, 
+        Channel25, 
+        Channel26, 
+        Channel27,
+        Channel28,
+        Channel29,
+        Channel30, 
+        Channel31
+    }
+}

+ 24 - 0
Shaker.Model/AOChannelType.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Model
+{
+    public enum AOChannelType
+    {
+        /// <summary>
+        /// 水平缸
+        /// </summary>
+        Horizontal,
+        /// <summary>
+        /// 垂直缸
+        /// </summary>
+        Vertical,
+        /// <summary>
+        /// 平衡缸
+        /// </summary>
+        Balancing,
+    }
+}

+ 44 - 0
Shaker.Model/DIOChannel.cs

@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Model
+{
+    public enum DIOChannel:byte
+    {
+        Channel0,
+        Channel1,
+        Channel2,
+        Channel3, 
+        Channel4,
+        Channel5, 
+        Channel6, 
+        Channel7, 
+        Channel8, 
+        Channel9, 
+        Channel10, 
+        Channel11, 
+        Channel12, 
+        Channel13, 
+        Channel14, 
+        Channel15, 
+        Channel16, 
+        Channel17, 
+        Channel18, 
+        Channel19, 
+        Channel20,
+        Channel21, 
+        Channel22, 
+        Channel23, 
+        Channel24, 
+        Channel25, 
+        Channel26, 
+        Channel27,
+        Channel28,
+        Channel29, 
+        Channel30,
+        Channel31
+    }
+}

+ 39 - 0
Shaker.Model/Models/AIConfigModel.cs

@@ -0,0 +1,39 @@
+using IModel;
+using Shaker.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public class AIConfigModel:BaseModel
+    {
+        /// <summary>
+        /// 通道序号
+        /// </summary>
+        public AIChannel Channel = AIChannel.Channel0;
+        /// <summary>
+        /// 灵敏度
+        /// </summary>
+        public double Sensitivity = 100;
+        /// <summary>
+        /// 偏置
+        ///<para> 当<see cref="ChannelType"/> ==<see cref="AIChannelType.Acceleration"/>和<see cref="AIChannelType.OutSignal"/>无效</para>
+        /// </summary>
+        public double Bias = 0;
+        /// <summary>
+        /// 模拟通道类型
+        /// </summary>
+        public AIChannelType ChannelType = AIChannelType.Displacement;
+        /// <summary>
+        /// 单位
+        /// </summary>
+        public string Unit = "";
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 25 - 0
Shaker.Model/Models/AOConfigModel.cs

@@ -0,0 +1,25 @@
+using IModel;
+using Shaker.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public sealed class AOConfigModel:BaseModel
+    {
+        public Shaker.Model.Polarity Polarity = Polarity.Positive;
+        public bool OpenLoop = false;
+        public double OpenLoopDriver = 0;
+        public AOChannel Channel = AOChannel.Channel0;
+        public double Bias = 0;
+        public AOChannelType ChannelType = AOChannelType.Horizontal;
+        public string Unit = "";
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 18 - 0
Shaker.Model/Models/BalancingControlModel.cs

@@ -0,0 +1,18 @@
+using IModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public sealed class BalancingControlModel:BaseModel
+    {
+
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 0 - 29
Shaker.Model/Models/DisplacementChannelConfigModel.cs

@@ -1,29 +0,0 @@
-using IModel;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Shaker.Models
-{
-    public class DisplacementChannelConfigModel:BaseModel
-    {
-        /// <summary>
-        /// 位移灵敏度(mv/mm)
-        /// </summary>
-        public double Sensitivity = 100;
-        /// <summary>
-        ///  位移偏置(mm)
-        /// </summary>
-        public double Bias = 0;
-        /// <summary>
-        /// 通道序号
-        /// </summary>
-        public byte Channel = 0;
-        public override object Clone()
-        {
-            return this.CloneBase();
-        }
-    }
-}

+ 0 - 26
Shaker.Model/Models/DisplacementConfigModel.cs

@@ -1,26 +0,0 @@
-using IModel;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Shaker.Models
-{
-    public sealed class DisplacementConfigModel : BaseModel
-    {
-        /// <summary>
-        /// 位移灵敏度
-        /// </summary>
-        public List<DisplacementChannelConfigModel> DisplacementChannels = new List<DisplacementChannelConfigModel>();
-        /// <summary>
-        /// 位移前馈增益
-        /// </summary>
-        public double DisplacementFeedforwardGain = 0;
-
-        public override object Clone()
-        {
-            return this.CloneBase();
-        }
-    }
-}

+ 19 - 0
Shaker.Model/Models/DriverModel.cs

@@ -0,0 +1,19 @@
+using IModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public sealed class DriverModel:BaseModel
+    {
+        public List<PIModel> PI = new List<PIModel>();
+
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 29 - 0
Shaker.Model/Models/FlutterModel.cs

@@ -0,0 +1,29 @@
+using IModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    /// <summary>
+    /// 颤振信号
+    /// </summary>
+    public sealed class FlutterModel:BaseModel
+    {
+        /// <summary>
+        /// 频率(Hz)
+        /// </summary>
+        public double Frequency = 0;
+        /// <summary>
+        /// 幅值(V)
+        /// </summary>
+        public double Amplitude = 0;
+        public override object Clone()
+        {
+           return this.CloneBase();
+        }
+    }
+}

+ 19 - 0
Shaker.Model/Models/PIModel.cs

@@ -0,0 +1,19 @@
+using IModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public sealed class PIModel:BaseModel
+    {
+        public double P = 0;
+        public double I = 0;
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 47 - 0
Shaker.Model/Models/ServoConfigModel.cs

@@ -0,0 +1,47 @@
+using IModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public sealed class ServoConfigModel:BaseModel
+    {
+        public List<PIModel> PI = new List<PIModel>();
+        /// <summary>
+        /// 水平阀死区电压(V)
+        /// </summary>
+        public double HorizontalBarrierPotential = 0;
+        /// <summary>
+        /// 竖直阀死区电压(V)
+        /// </summary>
+        public double VerticalBarrierPotential = 0;
+        /// <summary>
+        /// 最大积分电压(V)
+        /// </summary>
+        public double MaxIntegratedVoltage = 2;
+        /// <summary>
+        /// 位移前馈增益
+        /// </summary>
+
+        public double DisplacementFeedforwardGain = 1;
+        /// <summary>
+        /// 最大驱动电压(V)
+        /// </summary>
+        public double MaxDriverVoltage = 8;
+        /// <summary>
+        /// 驱动超限电压(V)
+        /// </summary>
+        public double DriverOverLimitVoltage = 2;
+        /// <summary>
+        /// 急停后驱动限幅值(V)
+        /// </summary>
+        public double EmerhencyDriverLimitVoltage = 1.2;
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 51 - 0
Shaker.Model/Models/ShakerChannelConfigModel.cs

@@ -0,0 +1,51 @@
+using IModel;
+using Shaker.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Models
+{
+    public sealed class ShakerChannelConfigModel : BaseModel
+    {
+        /// <summary>
+        /// 位移通道
+        /// </summary>
+        public List<AIConfigModel> Displacement = new List<AIConfigModel>();
+        /// <summary>
+        /// 加速度通道
+        /// </summary>
+        public List<AIConfigModel> Acceleration = new List<AIConfigModel>();
+        /// <summary>
+        /// 外部输入通道
+        /// </summary>
+        public List<AIConfigModel> OutSignal = new List<AIConfigModel>();
+        /// <summary>
+        /// 压差通道
+        /// </summary>
+        public List<AIConfigModel> DifferentialPressure = new List<AIConfigModel>();
+        /// <summary>
+        /// 支撑压力通道
+        /// </summary>
+        public List<AIConfigModel> Pressure = new List<AIConfigModel>();
+
+        /// <summary>
+        /// 水平缸通道
+        /// </summary>
+        public List<AOConfigModel> Horizontal = new List<AOConfigModel>();
+        /// <summary>
+        /// 垂直缸通道
+        /// </summary>
+        public List<AOConfigModel> Vertical = new List<AOConfigModel>();
+        /// <summary>
+        /// 平衡缸通道
+        /// </summary>
+        public List<AOChannel> Balancing = new List<AOChannel>();
+        public override object Clone()
+        {
+            return this.CloneBase();
+        }
+    }
+}

+ 37 - 4
Shaker.Model/Models/ShakerConfigModel.cs

@@ -1,4 +1,5 @@
 using IModel;
+using Shaker.Model;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -12,15 +13,47 @@ namespace Shaker.Models
         /// <summary>
         /// 位移通道数
         /// </summary>
-        public int DisplacementCount = 8;
+        public byte DisplacementCount = 8;
         /// <summary>
         /// 加速度通道数
         /// </summary>
-        public int AccelerationCount = 3;
+        public byte AccelerationCount = 3;
         /// <summary>
-        /// 最大模拟通道数
+        /// 最大模拟输入通道数
         /// </summary>
-        public int MaxAICount = 32;
+        public byte MaxAICount = 32;
+        /// <summary>
+        /// 最大模拟输出通道数
+        /// </summary>
+        public byte MaxAOCount = 16;
+        /// <summary>
+        /// 水平缸通道数
+        /// </summary>
+        public byte MaxHorizontalCount = 4;
+        /// <summary>
+        /// 垂直缸通道数
+        /// </summary>
+        public byte MaxVerticalCount = 4;
+        /// <summary>
+        /// 平衡缸通道数
+        /// </summary>
+        public byte MaxBalancingCount = 4;
+        /// <summary>
+        /// 采样率
+        /// </summary>
+        public ushort SampleRate = 2000;
+        /// <summary>
+        /// Fpga主时钟
+        /// </summary>
+        public uint FpgaClock = 40_000_000;
+        public uint MaxRiseCount = 6000;
+        public uint MaxDropCount = 6000;
+        public uint MaxZeroChangedCount = 6000;
+        public uint MaxSignalStopCount = 6000;
+        public AIChannel MinAIChannel => AIChannel.Channel0;
+        public AIChannel MaxAIChannel => MinAIChannel + MaxAICount;
+        public AOChannel MinAOChannel => AOChannel.Channel0;
+        public AOChannel MaxAOChannel => MinAOChannel + MaxAOCount;
         public override object Clone()
         {
             return this.CloneBase();

+ 23 - 0
Shaker.Model/Polarity.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Shaker.Model
+{
+    public enum Polarity:byte
+    {
+        /// <summary>
+        /// 正极性
+        /// </summary>
+        [Description("Positive")]
+        Positive,
+        /// <summary>
+        /// 负极性
+        /// </summary>
+        [Description("Negative")]
+        Negative,
+    }
+}

Some files were not shown because too many files changed in this diff