devices.py 7.7 KB

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