devices.py 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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 Space(BaseModel):
  74. realtime_temperature: float | None
  75. class ACATVASpace(Space):
  76. temperature_target: float | None
  77. vav_default_weight: float | None
  78. vav_temporary_weight: float | None
  79. vav_temporary_update_time: str | None
  80. class ACATAHSpace(Space):
  81. temperature_target: float | None
  82. ahu_default_weight: float | None
  83. ahu_temporary_weight: float | None
  84. ahu_temporary_update_time: str | None
  85. class ACATFUSpace(Space):
  86. realtime_co2: float | None
  87. hcho: float | None
  88. class ACATVAInstructionsRequestBase(BaseModel):
  89. device_id: str
  90. spaces: list[ACATVASpace]
  91. class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase):
  92. season: str
  93. supply_air_temperature: float | None
  94. acatah_supply_air_temperature: float | None
  95. supply_air_flow: float | None
  96. supply_air_flow_lower_limit: float | None
  97. supply_air_flow_upper_limit: float | None
  98. class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase):
  99. season: str
  100. return_air_temperature: float | None
  101. class ACATVAInstructionsResponse(BaseModel):
  102. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  103. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  104. virtual_realtime_temperature: float = Field(None, alias="VirtualRealtimeTemperature")
  105. class ACATVAInstructionsResponseV2(BaseModel):
  106. temperature_target_set: float
  107. virtual_target_temperature: float
  108. virtual_realtime_temperature: float
  109. class ACATAHFreqSetRequest(BaseModel):
  110. device_id: str
  111. system_supply_static_press: float | None
  112. system_supply_static_press_set: float | None
  113. current_freq_set: float | None
  114. supply_air_temperature_set_list: list[float]
  115. spaces_hot_rate: float | None
  116. class ACATAHFreqSetResponse(BaseModel):
  117. freq_set: float
  118. class ACATAHInstructionsRequest(BaseModel):
  119. device_id: str
  120. season: Season
  121. spaces: ACATAHSpace | None
  122. running_status: bool | None
  123. return_air_temperature: float | None
  124. return_air_temperature_set: float | None
  125. supply_air_temperature: float | None
  126. supply_air_temperature_set: float | None
  127. freq: float | None
  128. freq_set: float | None
  129. fan_freq_upper_limit_set: float | None
  130. fan_freq_lower_limit_set: float | None
  131. class ACATAHInstructionsResponse(BaseModel):
  132. switch_set: str
  133. return_air_temp_set: float | None
  134. supply_air_temp_set: float | None
  135. freq_set: float | None
  136. class SwitchSetRequestBase(BaseModel):
  137. device_id: str
  138. running_status: bool | None
  139. in_cloud_status: bool | None
  140. on_time: str | None
  141. off_time: str | None
  142. is_workday: bool | None
  143. class SwitchSetResponseBase(BaseModel):
  144. switch_set: SwitchSet
  145. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  146. pass
  147. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  148. pass
  149. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  150. break_start_time: str | None
  151. break_end_time: str | None
  152. class ACATFUCO2SwitchSetRequest(ACATFUSwitchSetRequest):
  153. co2_list: list[float]
  154. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  155. pass
  156. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  157. break_start_time: str | None
  158. break_end_time: str | None
  159. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  160. pass
  161. class VAV(BaseModel):
  162. id: str
  163. virtual_realtime_temperature: float | None
  164. virtual_temperature_target: float | None
  165. supply_air_flow_lower_limit: float | None
  166. supply_air_flow_upper_limit: float | None
  167. supply_air_flow_set: float | None
  168. supply_air_temperature: float | None
  169. valve_opening: float | None
  170. class ACATAHRequestBase(BaseModel):
  171. device_id: str
  172. season: str
  173. vav_list: list[VAV]
  174. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  175. pass
  176. class ACATAHThermalModeSetResponse(BaseModel):
  177. thermal_mode_set: ThermalMode
  178. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  179. supply_air_temperature: float | None
  180. supply_air_temperature_set: float | None
  181. return_air_temperature: float | None
  182. chill_water_valve_opening_set_list: list[float]
  183. hot_water_valve_opening_set_list: list[float]
  184. equip_switch_set_list: list[float]
  185. is_clear_day: bool | None
  186. class ACATAHSupplyAirTempSetResponse(BaseModel):
  187. supply_air_temperature_set: float
  188. class ACATFUSupplyAirTempSetRequest(BaseModel):
  189. device_id: str
  190. season: Season
  191. supply_air_temperature_set: float | None
  192. hot_ratio: float | None
  193. cold_ratio: float | None
  194. running_status_list: list[float]
  195. class ACATFUSupplyAirTempSetResponse(BaseModel):
  196. supply_air_temperature_set: float
  197. class ACATFUFreqSetRequest(BaseModel):
  198. device_id: str
  199. freq: float | None
  200. fresh_air_temperature: float | None
  201. spaces: list[ACATFUSpace]
  202. season: Season
  203. running_status_list: list[float]
  204. class ACATFUFreqSetResponse(BaseModel):
  205. freq_set: float
  206. class ASHPRequest(BaseModel):
  207. season: Season
  208. outdoor_temp: list[float] # 30min
  209. device_list: list[ASHP]
  210. class ASHPResponse(BaseModel):
  211. device_list: list[ASHP]
  212. interval: float
  213. is_warning: bool
  214. class FeedWaterPumpRequest(BaseModel):
  215. season: Season
  216. outdoor_temp: list[float]
  217. ashp_list: list[ASHP]
  218. pump_list: list[FeedWaterPump]
  219. class FeedWaterPumpResponse(BaseModel):
  220. device_list: list[FeedWaterPump]