devices.py 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. from app.schemas.space import SpaceATFU
  8. class ThermalMode(str, Enum):
  9. cooling = "cooling"
  10. heating = "heating"
  11. hold = "hold"
  12. class DevicesInstructionsBaseResponse(BaseModel):
  13. project_id: str = Field(None, alias="projectId")
  14. device_id: str = Field(None, alias="equipId")
  15. output: Dict
  16. class DevicesEarlyStartTime(BaseModel):
  17. project_id: str = Field(None, alias="projectId")
  18. space_id: str = Field(None, alias="spaceId")
  19. minutes: float
  20. class ACATVIInstructionsRequest(BaseModel):
  21. device_id: str
  22. return_air_temperature: float
  23. running_status: bool
  24. work_mode: float
  25. current_speed: str
  26. current_temperature_set: float
  27. space_temperature_target: float
  28. space_realtime_temperature: float
  29. feedback: FeedbackValue
  30. on_time: str
  31. off_time: str
  32. class ACATVIInstructionsTemporaryResponse(BaseModel):
  33. output: Dict
  34. class ACATVIInstructionsResponse(BaseModel):
  35. switch_set: Optional[str]
  36. speed_set: Optional[str]
  37. temperature_set: Optional[float]
  38. # mode_set: Optional[str]
  39. class ACATFCInstructionsRequestBase(BaseModel):
  40. device_id: str
  41. season: str
  42. space_temperature_target: float
  43. space_realtime_temperature: Optional[float]
  44. class ACATFC2InstructionsRequest(ACATFCInstructionsRequestBase):
  45. pass
  46. class ACATFC4InstructionsRequest(ACATFCInstructionsRequestBase):
  47. pass
  48. class ACATFCInstructionsResponse(BaseModel):
  49. switch_set: int = Field(None, alias="onOff")
  50. speed_set: int = Field(None, alias="speed")
  51. temperature_set: float = Field(None, alias="temperature")
  52. mode_set: int = Field(None, alias="mode")
  53. water_valve_switch_set: int = Field(None, alias="water")
  54. class ACATFCEarlyStartPredictionRequest(BaseModel):
  55. season: Season
  56. space_id: Optional[str]
  57. device_id: str
  58. space_realtime_temperature: float
  59. outdoor_realtime_temperature: float
  60. class ACATFCEarlyStartPredictionResponse(BaseModel):
  61. minutes: float
  62. class Space(BaseModel):
  63. realtime_temperature: float
  64. temperature_target: float
  65. vav_default_weight: float
  66. vav_temporary_weight: float
  67. vav_temporary_update_time: str
  68. class ACATVAInstructionsRequestBase(BaseModel):
  69. device_id: str
  70. spaces: List[Space]
  71. class ACATVAInstructionsRequest(ACATVAInstructionsRequestBase):
  72. season: str
  73. supply_air_temperature: Optional[float]
  74. acatah_supply_air_temperature: Optional[float]
  75. supply_air_flow: float
  76. supply_air_flow_lower_limit: float
  77. supply_air_flow_upper_limit: float
  78. class ACATVAInstructionsRequestV2(ACATVAInstructionsRequestBase):
  79. season: str
  80. # temperature_set: float
  81. return_air_temp: float
  82. class ACATVAInstructionsResponse(BaseModel):
  83. supply_air_flow_set: float = Field(None, alias="SupplyAirFlowSet")
  84. virtual_temperature_target_set: float = Field(None, alias="TargetTemperatureSet")
  85. virtual_realtime_temperature: float = Field(
  86. None, alias="VirtualRealtimeTemperature"
  87. )
  88. class ACATVAInstructionsResponseV2(BaseModel):
  89. temperature_target_set: float
  90. class ACATAHFreqSetRequest(BaseModel):
  91. device_id: str
  92. system_supply_static_press: float
  93. system_supply_static_press_set: float
  94. current_freq_set: float
  95. supply_air_temperature_set_list: List[float]
  96. spaces_hot_rate: float
  97. class ACATAHFreqSetResponse(BaseModel):
  98. freq_set: float
  99. class SwitchSetRequestBase(BaseModel):
  100. device_id: str
  101. running_status: bool
  102. in_cloud_status: bool
  103. on_time: str
  104. off_time: str
  105. is_workday: bool
  106. class SwitchSetResponseBase(BaseModel):
  107. switch_set: SwitchSet
  108. class ACVTSFSwitchSetRequest(SwitchSetRequestBase):
  109. pass
  110. class ACVTSFSwitchSetResponse(SwitchSetResponseBase):
  111. pass
  112. class ACATFUSwitchSetRequest(SwitchSetRequestBase):
  113. pass
  114. class ACATFUSwitchSetResponse(SwitchSetResponseBase):
  115. pass
  116. class ACATAHSwitchSetRequest(SwitchSetRequestBase):
  117. break_start_time: str
  118. break_end_time: str
  119. class ACATAHSwitchSetResponse(SwitchSetResponseBase):
  120. pass
  121. class VAV(BaseModel):
  122. id: str
  123. virtual_realtime_temperature: float
  124. virtual_temperature_target: float
  125. supply_air_flow_lower_limit: float
  126. supply_air_flow_upper_limit: float
  127. supply_air_flow_set: float
  128. valve_opening: float
  129. class ACATAHRequestBase(BaseModel):
  130. device_id: str
  131. season: str
  132. vav_list: List[VAV]
  133. class ACATAHThermalModeSetRequest(ACATAHRequestBase):
  134. pass
  135. class ACATAHThermalModeSetResponse(BaseModel):
  136. thermal_mode_set: ThermalMode
  137. class ACATAHSupplyAirTempSetRequest(ACATAHRequestBase):
  138. supply_air_temperature: float
  139. return_air_temperature: float
  140. chill_water_valve_opening_set_list: Optional[List[float]]
  141. hot_water_valve_opening_set_list: Optional[List[float]]
  142. equip_switch_set_list: Optional[List[float]]
  143. is_clear_day: Optional[bool]
  144. class ACATAHSupplyAirTempSetResponse(BaseModel):
  145. supply_air_temperature_set: float
  146. class ACATFUSupplyAirTempSetRequest(BaseModel):
  147. device_id: str
  148. season: Season
  149. supply_air_temperature_set: float
  150. hot_ratio: float
  151. cold_ratio: float
  152. running_status_list: List[float]
  153. class ACATFUSupplyAirTempSetResponse(BaseModel):
  154. supply_air_temperature_set: float
  155. class ACATFUFreqSetRequest(BaseModel):
  156. device_id: str
  157. freq: float
  158. fresh_air_temperature: float
  159. spaces: List[SpaceATFU]
  160. season: Season
  161. running_status_list: List[float]
  162. class ACATFUFreqSetResponse(BaseModel):
  163. freq_set: float