123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- # -*- coding: utf-8 -*-
- import numpy as np
- from app.controllers.equipment.controller import EquipmentController
- from app.models.equipment import VAVBox, FCU
- class VAVController(EquipmentController):
- def __init__(self, equipment: VAVBox):
- super(VAVController, self).__init__()
- self._equipment = equipment
- async def get_strategy(self):
- strategy = 'Plan A'
- for space in self._equipment.spaces:
- for eq in space.equipment:
- if isinstance(eq, FCU):
- strategy = 'Plan B'
- break
- return strategy
- async def get_temperature_target(self) -> float:
- total_targets = []
- total_buffer = []
- strategy = self.get_strategy()
- for space in self._equipment.spaces:
- if strategy == 'Plan A':
- total_targets.append(space.temperature_target)
- elif strategy == 'Plan B':
- for eq in space.equipment:
- if isinstance(eq, FCU):
- buffer = (4 - eq.air_valve_speed) / 4
- total_buffer.append(buffer)
- break
- total = total_buffer + total_targets
- result = np.array(total).sum() / len(total_targets)
- self._equipment.setting_temperature = result
- return result
- def run(self):
- pass
|