intelligentbuildingcontrol.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package model
  2. import (
  3. "encoding/xml"
  4. "gorm.io/gorm"
  5. )
  6. type IntelligentBuildingControl struct {
  7. gorm.Model
  8. }
  9. func (m *IntelligentBuildingControl) TableName() string {
  10. return "intelligent_building_control"
  11. }
  12. // 点位表
  13. type Point struct {
  14. Id int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement;comment:点位ID"`
  15. FullPath string `json:"full_path" gorm:"column:full_path;type:varchar(255);comment:点位全路径"`
  16. DeviceType string `json:"device_type" gorm:"column:device_type;type:varchar(50);comment:设备类型"`
  17. Building string `json:"building" gorm:"column:building;type:varchar(50);comment:所属楼宇ID"`
  18. Floor string `json:"floor" gorm:"column:floor;type:varchar(50);comment:楼层"`
  19. Section string `json:"section" gorm:"column:section;type:varchar(50);comment:区域"`
  20. DeviceName string `json:"device_name" gorm:"column:device_name;type:varchar(100);comment:设备名称"`
  21. PointName string `json:"point_name" gorm:"column:point_name;type:varchar(100);comment:点位名称"`
  22. }
  23. // DeviceType 设备类型对应表
  24. var DeviceType = map[string]string{
  25. "JSK": "集水坑",
  26. "AHU": "空调机组",
  27. "PAU": "新风机组",
  28. "EAF": "送排风机",
  29. }
  30. type PointType struct {
  31. Type map[string]string `json:"type"`
  32. }
  33. // PointName 设备名称对应表
  34. var PointName = map[string]string{
  35. "TempS1": "送风温度",
  36. "HumS1": "送风湿度",
  37. "TempH1": "回风温度",
  38. "TempX1": "新风温度",
  39. "CO2": "回风二氧化碳",
  40. "AHUSts1": "运行状态",
  41. "AHUAlr1": "故障报警",
  42. "AHUAorm1": "自动状态",
  43. "FJDPS1": "风机压差",
  44. "FDKG1": "防冻开关",
  45. "Sorw1": "冬夏季模式",
  46. "XFLev1": "新风阀反馈",
  47. "HFLev1": "回风阀反馈",
  48. "SFLev1": "水阀反馈",
  49. "GlwDPS1": "过滤网压差",
  50. "PumbSts1": "泵运行状态1",
  51. "PumbAlr1": "泵故障报警1",
  52. "PumbSts2": "泵运行状态2",
  53. "PumbAlr2": "泵故障报警2",
  54. "PumbAorm1": "泵自动状态1",
  55. "YWG1": "超高液位",
  56. "PFSts1": "运行状态",
  57. "PFAlr1": "故障报警",
  58. "PFAorm1": "自动状态",
  59. }
  60. // RealPoint TempS1 点位表
  61. type RealPoint struct {
  62. XMLName xml.Name `xml:"real"`
  63. Val string `xml:"val,attr"` // "28.355751037597656"
  64. Status string `xml:"status,attr"` // "down"
  65. Display string `xml:"display,attr"` // "28.36 °C {down}"
  66. Href string `xml:"href,attr"`
  67. Unit string `xml:"unit,attr"` // "obix:units/celsius"
  68. }
  69. // PointType 设备类型表
  70. type BooleanPoint struct {
  71. XMLName xml.Name `xml:"bool"`
  72. Val string `xml:"val,attr"`
  73. Status string `xml:"status,attr"`
  74. Display string `xml:"display,attr"`
  75. Href string `xml:"href,attr"`
  76. Is string `xml:"is,attr"`
  77. }
  78. // NumericPoint TempS1
  79. type NumericPoint struct {
  80. Val float64 `xml:"val,attr"`
  81. Href string `xml:"href,attr,omitempty"`
  82. Is string `xml:"is,attr,omitempty"`
  83. Display string `xml:"display,attr,omitempty"`
  84. Icon string `xml:"icon,attr,omitempty"`
  85. Unit string `xml:"unit,attr,omitempty"`
  86. Facets *Facets `xml:"str"`
  87. ProxyExt *ProxyExt `xml:"ref"`
  88. Out *OutputValue `xml:"real[name=out]"`
  89. Tag *TagReference `xml:"ref[name=tag]"`
  90. }
  91. type Facets struct {
  92. Name string `xml:"name,attr"`
  93. Val string `xml:"val,attr"`
  94. Href string `xml:"href,attr,omitempty"`
  95. Display string `xml:"display,attr,omitempty"`
  96. DisplayName string `xml:"displayName,attr,omitempty"`
  97. }
  98. type ProxyExt struct {
  99. Name string `xml:"name,attr"`
  100. Href string `xml:"href,attr,omitempty"`
  101. Is string `xml:"is,attr,omitempty"`
  102. Display string `xml:"display,attr,omitempty"`
  103. DisplayName string `xml:"displayName,attr,omitempty"`
  104. Icon string `xml:"icon,attr,omitempty"`
  105. }
  106. type OutputValue struct {
  107. Name string `xml:"name,attr"`
  108. Val float64 `xml:"val,attr"`
  109. Href string `xml:"href,attr,omitempty"`
  110. Is string `xml:"is,attr,omitempty"`
  111. Display string `xml:"display,attr,omitempty"`
  112. DisplayName string `xml:"displayName,attr,omitempty"`
  113. Icon string `xml:"icon,attr,omitempty"`
  114. Unit string `xml:"unit,attr,omitempty"`
  115. }
  116. type TagReference struct {
  117. Name string `xml:"name,attr"`
  118. Href string `xml:"href,attr,omitempty"`
  119. Is string `xml:"is,attr,omitempty"`
  120. Display string `xml:"display,attr,omitempty"`
  121. Icon string `xml:"icon,attr,omitempty"`
  122. }
  123. //TempS1 end
  124. func (p *Point) TableName() string {
  125. return "point"
  126. }