PlcParameterModel.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MvvmScaffoldFrame48.Model.StorageModel.PlcParameter
  7. {
  8. public enum PlcDataType
  9. {
  10. None = 0,
  11. ValueBit = 1,
  12. Int32 = 2,
  13. Double = 3
  14. }
  15. public class PlcParameterModel
  16. {
  17. //public string Name { get; set; }
  18. /// <summary>
  19. /// 1:ValueBit
  20. /// 2:Int32
  21. /// 3:Double
  22. /// </summary>
  23. public PlcDataType Type { get; set; } = PlcDataType.None;
  24. public int Length { get; set; } = 1;
  25. public int Address { get; set; }
  26. }
  27. public class PlcValueBitParameterModel: PlcParameterModel
  28. {
  29. public int bitAddress { get; set; }
  30. public PlcValueBitParameterModel(int Address,int bitAddress)
  31. {
  32. this.Type = PlcDataType.ValueBit;
  33. this.Address = Address;
  34. this.bitAddress = bitAddress;
  35. }
  36. }
  37. public class PlcInt32ParameterModel:PlcParameterModel
  38. {
  39. public int MaxValue { get; set; }
  40. public int MinValue { get; set; }
  41. public PlcInt32ParameterModel(int Address)
  42. {
  43. this.Type = PlcDataType.Int32;
  44. this.Address = Address;
  45. this.Length = 2;
  46. this.MaxValue = Int32.MaxValue;
  47. this.MinValue = Int32.MinValue;
  48. }
  49. public PlcInt32ParameterModel(int Address,int MaxValue,int MinValue)
  50. {
  51. this.Type = PlcDataType.Int32;
  52. this.Address = Address;
  53. this.Length = 2;
  54. this.MaxValue = MaxValue;
  55. this.MinValue = MinValue;
  56. }
  57. }
  58. public class PlcDouble64ParameterModel : PlcParameterModel
  59. {
  60. public double MaxValue { get; set; }
  61. public double MinValue { get; set; }
  62. public PlcDouble64ParameterModel(int Address)
  63. {
  64. this.Type = PlcDataType.Double;
  65. this.Address = Address;
  66. this.Length = 4;
  67. this.MaxValue = double.MaxValue;
  68. this.MinValue = double.MinValue;
  69. }
  70. public PlcDouble64ParameterModel(int Address,double MaxValue,double MinValue)
  71. {
  72. this.Type = PlcDataType.Double;
  73. this.Address = Address;
  74. this.Length = 4;
  75. this.MaxValue = MaxValue;
  76. this.MinValue = MinValue;
  77. }
  78. }
  79. }