devices.py 5.3 KB

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