devices.py 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. from enum import Enum
  2. from pydantic import BaseModel, Field
  3. from app.controllers.equipment.switch import SwitchSet
  4. from app.models.domain.feedback import FeedbackValue
  5. from app.schemas.equipment import ASHP, FeedWaterPump
  6. from app.schemas.equipment import VRFMode
  7. from app.schemas.season import Season
  8. class ThermalMode(str, Enum):
  9. cooling = "cooling"
  10. heating = "heating"
  11. hold = "hold"
  12. class Speed(str, Enum):
  13. off = "off"
  14. low = "low"
  15. medium = "medium"
  16. high = "high"
  17. hold = "hold"
  18. class ACATVIInstructionsRequest(BaseModel):
  19. device_id: str
  20. return_air_temperature: float | None
  21. running_status: bool | None
  22. work_mode: VRFMode
  23. current_speed: str | None
  24. current_temperature_set: float | None
  25. space_temperature_target: float | None
  26. space_realtime_temperature: float | None
  27. feedback: FeedbackValue
  28. on_time: str | None
  29. off_time: str | None
  30. class ACATVIInstructionsResponse(BaseModel):
  31. switch_set: str | None
  32. speed_set: str | None
  33. temperature_set: float | None
  34. class ACATVIModeRequest(BaseModel):
  35. season: Season
  36. space_temperature_list: list[float]
  37. class ACATVIModeResponse(BaseModel):
  38. mode: str
  39. class ACATFCInstructionsRequestBase(BaseModel):
  40. device_id: str
  41. season: str
  42. space_temperature_target: float | None
  43. space_realtime_temperature: float | None
  44. running_status: bool | None
  45. speed: Speed | None
  46. feedback: FeedbackValue
  47. class ACATFC2InstructionsRequest(ACATFCInstructionsRequestBase):
  48. pass
  49. class ACATFC4InstructionsRequest(ACATFCInstructionsRequestBase):
  50. pass
  51. class ACATFCInstructionsResponseBase(BaseModel):
  52. speed_set: str
  53. switch_set: str
  54. class ACATFC2InstructionsResponse(ACATFCInstructionsResponseBase):
  55. water_valve_set: str
  56. class ACATFC4InstructionsResponse(ACATFCInstructionsResponseBase):
  57. chill_water_valve_set: str
  58. hot_water_valve_set: str
  59. class ACATFCInstructionsResponse(BaseModel):
  60. switch_set: int = Field(None, alias="onOff")
  61. speed_set: int = Field(None, alias="speed")
  62. temperature_set: float = Field(None, alias="temperature")
  63. mode_set: int = Field(None, alias="mode")
  64. water_valve_switch_set: int = Field(None, alias="water")
  65. class ACATFCEarlyStartPredictionRequest(BaseModel):
  66. season: Season
  67. space_id: str | None
  68. device_id: str
  69. space_realtime_temperature: float | None
  70. outdoor_realtime_temperature: float | None
  71. class ACATFCEarlyStartPredictionResponse(BaseModel):
  72. minutes: float
  73. class ACATVIEarlyStartPredictionRequest(ACATFCEarlyStartPredictionRequest):
  74. pass
  75. class ACATVIEarlyStartPredictionResponse(ACATFCEarlyStartPredictionResponse):
  76. pass
  77. class Space(BaseModel):
  78. realtime_temperature: float | None
  79. class ACATVASpace(Space):
  80. temperature_target: float | None
  81. vav_default_weight: float | None
  82. vav_temporary_weight: float | None
  83. vav_temporary_update_time: str | None
  84. class ACATAHSpace(Space):
  85. temperature_target: float | None
  86. ahu_default_weight: float | None
  87. ahu_temporary_weight: float | None
  88. ahu_temporary_update_time: str | None
  89. class ACATFUSpace(Space):
  90. realtime_co2: float | None
  91. hcho: float | None
  92. class ACATVAInstructionsRequestBase(BaseModel):
  93. device_id: str
  94. spaces: list[ACATVASpace]
  95. class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase):
  96. season: str
  97. supply_air_temperature: float | None
  98. acatah_supply_air_temperature: float | None
  99. supply_air_flow: float | None
  100. supply_air_flow_lower_limit: float | None
  101. supply_air_flow_upper_limit: float | None
  102. class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase):
  103. season: str
  104. return_air_temperature: float | None
  105. class ACATVAInstructionsResponse(BaseModel):
  106. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  107. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  108. virtual_realtime_temperature: float = Field(None, alias="VirtualRealtimeTemperature")
  109. class ACATVAInstructionsResponseV2(BaseModel):
  110. temperature_target_set: float
  111. virtual_target_temperature: float
  112. virtual_realtime_temperature: float
  113. class ACATAHFreqSetRequest(BaseModel):
  114. device_id: str
  115. system_supply_static_press: float | None
  116. system_supply_static_press_set: float | None
  117. current_freq_set: float | None
  118. supply_air_temperature_set_list: list[float]
  119. spaces_hot_rate: float | None
  120. class ACATAHFreqSetResponse(BaseModel):
  121. freq_set: float
  122. class ACATAHInstructionsRequest(BaseModel):
  123. device_id: str
  124. season: Season
  125. spaces: ACATAHSpace | None
  126. running_status: bool | None
  127. return_air_temperature: float | None
  128. return_air_temperature_set: float | None
  129. supply_air_temperature: float | None
  130. supply_air_temperature_set: float | None
  131. freq: float | None
  132. freq_set: float | None
  133. fan_freq_upper_limit_set: float | None
  134. fan_freq_lower_limit_set: float | None
  135. class ACATAHInstructionsResponse(BaseModel):
  136. switch_set: str
  137. return_air_temp_set: float | None
  138. supply_air_temp_set: float | None
  139. freq_set: float | None
  140. class SwitchSetRequestBase(BaseModel):
  141. device_id: str
  142. running_status: bool | None
  143. in_cloud_status: bool | None
  144. on_time: str | None
  145. off_time: str | None
  146. is_workday: bool | None
  147. class SwitchSetResponseBase(BaseModel):
  148. switch_set: SwitchSet
  149. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  150. pass
  151. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  152. pass
  153. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  154. break_start_time: str | None
  155. break_end_time: str | None
  156. class ACATFUCO2SwitchSetRequest(ACATFUSwitchSetRequest):
  157. co2_list: list[float]
  158. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  159. pass
  160. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  161. break_start_time: str | None
  162. break_end_time: str | None
  163. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  164. pass
  165. class VAV(BaseModel):
  166. id: str
  167. virtual_realtime_temperature: float | None
  168. virtual_temperature_target: float | None
  169. supply_air_flow_lower_limit: float | None
  170. supply_air_flow_upper_limit: float | None
  171. supply_air_flow_set: float | None
  172. supply_air_temperature: float | None
  173. valve_opening: float | None
  174. class ACATAHRequestBase(BaseModel):
  175. device_id: str
  176. season: str
  177. vav_list: list[VAV]
  178. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  179. pass
  180. class ACATAHThermalModeSetResponse(BaseModel):
  181. thermal_mode_set: ThermalMode
  182. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  183. supply_air_temperature: float | None
  184. supply_air_temperature_set: float | None
  185. return_air_temperature: float | None
  186. chill_water_valve_opening_set_list: list[float]
  187. hot_water_valve_opening_set_list: list[float]
  188. equip_switch_set_list: list[float]
  189. is_clear_day: bool | None
  190. class ACATAHSupplyAirTempSetResponse(BaseModel):
  191. supply_air_temperature_set: float
  192. class ACATFUSupplyAirTempSetRequest(BaseModel):
  193. device_id: str
  194. season: Season
  195. supply_air_temperature_set: float | None
  196. hot_ratio: float | None
  197. cold_ratio: float | None
  198. running_status_list: list[float]
  199. class ACATFUSupplyAirTempSetResponse(BaseModel):
  200. supply_air_temperature_set: float
  201. class ACATFUFreqSetRequest(BaseModel):
  202. device_id: str
  203. freq: float | None
  204. fresh_air_temperature: float | None
  205. spaces: list[ACATFUSpace]
  206. season: Season
  207. running_status_list: list[float]
  208. class ACATFUFreqSetResponse(BaseModel):
  209. freq_set: float
  210. class ASHPRequest(BaseModel):
  211. season: Season
  212. outdoor_temp: list[float] # 30min
  213. device_list: list[ASHP]
  214. class ASHPResponse(BaseModel):
  215. device_list: list[ASHP]
  216. interval: float
  217. is_warning: bool
  218. class FeedWaterPumpRequest(BaseModel):
  219. season: Season
  220. outdoor_temp: list[float]
  221. ashp_list: list[ASHP]
  222. pump_list: list[FeedWaterPump]
  223. class FeedWaterPumpResponse(BaseModel):
  224. device_list: list[FeedWaterPump]