devices.py 7.7 KB

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