intelligentbuildingcontrol.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. }
  51. // RealPoint TempS1 点位表
  52. type RealPoint struct {
  53. XMLName xml.Name `xml:"real"`
  54. Val string `xml:"val,attr"` // "28.355751037597656"
  55. Status string `xml:"status,attr"` // "down"
  56. Display string `xml:"display,attr"` // "28.36 °C {down}"
  57. Href string `xml:"href,attr"`
  58. Unit string `xml:"unit,attr"` // "obix:units/celsius"
  59. }
  60. // PointType 设备类型表
  61. type BooleanPoint struct {
  62. XMLName xml.Name `xml:"bool"`
  63. Val string `xml:"val,attr"`
  64. Status string `xml:"status,attr"`
  65. Display string `xml:"display,attr"`
  66. Href string `xml:"href,attr"`
  67. Is string `xml:"is,attr"`
  68. }
  69. // NumericPoint TempS1
  70. type NumericPoint struct {
  71. Val float64 `xml:"val,attr"`
  72. Href string `xml:"href,attr,omitempty"`
  73. Is string `xml:"is,attr,omitempty"`
  74. Display string `xml:"display,attr,omitempty"`
  75. Icon string `xml:"icon,attr,omitempty"`
  76. Unit string `xml:"unit,attr,omitempty"`
  77. Facets *Facets `xml:"str"`
  78. ProxyExt *ProxyExt `xml:"ref"`
  79. Out *OutputValue `xml:"real[name=out]"`
  80. Tag *TagReference `xml:"ref[name=tag]"`
  81. }
  82. type Facets struct {
  83. Name string `xml:"name,attr"`
  84. Val string `xml:"val,attr"`
  85. Href string `xml:"href,attr,omitempty"`
  86. Display string `xml:"display,attr,omitempty"`
  87. DisplayName string `xml:"displayName,attr,omitempty"`
  88. }
  89. type ProxyExt struct {
  90. Name string `xml:"name,attr"`
  91. Href string `xml:"href,attr,omitempty"`
  92. Is string `xml:"is,attr,omitempty"`
  93. Display string `xml:"display,attr,omitempty"`
  94. DisplayName string `xml:"displayName,attr,omitempty"`
  95. Icon string `xml:"icon,attr,omitempty"`
  96. }
  97. type OutputValue struct {
  98. Name string `xml:"name,attr"`
  99. Val float64 `xml:"val,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. Unit string `xml:"unit,attr,omitempty"`
  106. }
  107. type TagReference struct {
  108. Name string `xml:"name,attr"`
  109. Href string `xml:"href,attr,omitempty"`
  110. Is string `xml:"is,attr,omitempty"`
  111. Display string `xml:"display,attr,omitempty"`
  112. Icon string `xml:"icon,attr,omitempty"`
  113. }
  114. //TempS1 end
  115. func (p *Point) TableName() string {
  116. return "point"
  117. }