devices.py 5.3 KB

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