devices.py 7.2 KB

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