12345678910111213141516171819202122232425262728293031323334 |
- # -*- coding: utf-8 -*-
- from fastapi import APIRouter, Query
- from app.controllers.equipment.fcu.q_learning import QLearningCommandBuilder
- from app.models.domain.space import SpaceControlResponse
- from app.services.transfer import Season
- router = APIRouter()
- @router.get('/control', response_model=SpaceControlResponse)
- async def get_space_command(
- project_id: str = Query(..., max_length=50, regex='^Pj', alias='projectId'),
- space_id: str = Query(..., max_length=50, regex='^Sp', alias='roomId'),
- timestamp: str = Query(None, min_length=14, max_length=14, alias='time'),
- method: int = Query(3),
- ):
- response = {
- 'projectId': project_id,
- 'roomId': space_id,
- 'flag': 1,
- 'time': timestamp,
- 'method': method,
- }
- return response
- @router.get('/test')
- async def get_test_result(current: float, pre: float, target: float):
- builder = QLearningCommandBuilder(Season('Cooling'))
- command = await builder.get_command(current, pre, target)
- return command
|