From 18deae293af9ca5b4c56ae0d3b06913569cb8cc9 Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Tue, 5 Aug 2025 17:06:41 +0700 Subject: [PATCH] fix --- .env | 2 +- src/aeros_equipment/service.py | 4 ++++ src/aeros_project/service.py | 5 ++++- src/aeros_simulation/service.py | 14 ++++++++------ src/config.py | 4 ++-- src/dashboard_model/service.py | 19 +++++++++++++++---- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/.env b/.env index 067acce..ab99210 100644 --- a/.env +++ b/.env @@ -16,4 +16,4 @@ COLLECTOR_CREDENTIAL_PASSWORD=postgres COLLECTOR_NAME=digital_twin -WINDOWS_AEROS_BASE_URL=http://192.168.1.87:8800 +WINDOWS_AEROS_BASE_URL=http://192.168.1.102:8800 diff --git a/src/aeros_equipment/service.py b/src/aeros_equipment/service.py index 57f6f47..174e8ea 100644 --- a/src/aeros_equipment/service.py +++ b/src/aeros_equipment/service.py @@ -306,6 +306,10 @@ async def update_equipment_for_simulation(*, db_session: DbSession, project_name for eq in nodes_data: try: + # Check if eq already exists in results + if eq["equipmentName"] in results.keys(): + continue + reliabiility = reliability_data.get(eq["equipmentName"], {}) if custom_input and eq["equipmentName"] in custom_input: diff --git a/src/aeros_project/service.py b/src/aeros_project/service.py index e459d60..3491295 100644 --- a/src/aeros_project/service.py +++ b/src/aeros_project/service.py @@ -39,12 +39,14 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr detail=f"File type not allowed. Allowed: {ALLOWED_EXTENSIONS}" ) + print("read file") + # Read and check file size content = await file.read() if len(content) > MAX_FILE_SIZE: raise HTTPException( status_code=400, - detail="File too large. Max size: 100MB" + detail="File too large. Max size: 100Mb" ) @@ -67,6 +69,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr "file": (file.filename, content, file.content_type or "application/octet-stream") } + print("fetch") response = await client.post( f"{WINDOWS_AEROS_BASE_URL}/api/aeros/upload-file", files=files diff --git a/src/aeros_simulation/service.py b/src/aeros_simulation/service.py index ec2a106..c47c7e9 100644 --- a/src/aeros_simulation/service.py +++ b/src/aeros_simulation/service.py @@ -226,7 +226,6 @@ async def save_simulation_result( }) - if not node: if result["nodeType"] != "RegularNode" and result["nodeType"] != "Schematic": continue @@ -492,17 +491,20 @@ async def get_simulation_with_calc_result( if schematic_name: - query = query.join( - AerosNode, AerosNode.id == AerosSimulationCalcResult.aeros_node_id - ).filter(AerosNode.structure_name.contains(schematic_name)) + if schematic_name == "WTP": + query = query.join( + AerosNode, AerosNode.id == AerosSimulationCalcResult.aeros_node_id + ).filter(AerosNode.structure_name.contains(schematic_name)) + else: + query = query.join( + AerosNode, AerosNode.id == AerosSimulationCalcResult.aeros_node_id + ).filter(AerosNode.structure_name.contains(schematic_name)) query = query.options( selectinload(AerosSimulationCalcResult.aeros_node).options( selectinload(AerosNode.equipment) )) - - simulation = await db_session.execute(query) return simulation.scalars().all() diff --git a/src/config.py b/src/config.py index cb3058c..8aa3d24 100644 --- a/src/config.py +++ b/src/config.py @@ -74,7 +74,7 @@ MAXIMO_BASE_URL = config("MAXIMO_BASE_URL", default="http://example.com") MAXIMO_API_KEY = config("MAXIMO_API_KEY", default="keys") AUTH_SERVICE_API = config("AUTH_SERVICE_API", default="http://192.168.1.82:8000/auth") -AEROS_BASE_URL = config("AEROS_BASE_URL", default="http://192.168.1.87") -WINDOWS_AEROS_BASE_URL = config("WINDOWS_AEROS_BASE_URL", default="http://192.168.1.87:8800") +AEROS_BASE_URL = config("AEROS_BASE_URL", default="http://192.168.1.102") +WINDOWS_AEROS_BASE_URL = config("WINDOWS_AEROS_BASE_URL", default="http://192.168.1.102:8800") DEFAULT_PROJECT_NAME = config("DEFAULT_PROJECT_NAME", default="RBD TJB") diff --git a/src/dashboard_model/service.py b/src/dashboard_model/service.py index 54a9463..4a83318 100644 --- a/src/dashboard_model/service.py +++ b/src/dashboard_model/service.py @@ -44,14 +44,25 @@ async def get_model_data(*, db_session: DbSession, simulation_id: Optional[UUID] EAF = (main_calc_data.availability - (main_calc_data.total_cm_downtime / total_time) - (main_calc_data.total_oh_downtime / total_time)) * 100 powerplant_reliability = { - "COAL HANDLING (CHS)": 98, - "Boiler": 98, + "Plant Control": 98, + "SPS": 98, "Turbine": 98, "Generator": 98, - "FGD (SUP)": 98, "Condensate Water": 98, "Feedwater System": 98, - "FGD (SUP)": 98, + "Cooling Water": 98, + "SCR": 98, + "Ash Handling": 98, + "Air Flue Gas": 98, + "Boiler": 98, + "SAC-IAC": 98, + "KLH": 98, + "CL": 98, + "Desalination": 98, + "FGD": 98, + "CHS": 98, + "SSB": 98, + "WTP": 98, } return {"id": str(simulation.id), "availability": availability, "EFOR": EFOR, "EAF": EAF, "powerplant_reliability": powerplant_reliability}