|
|
|
|
@ -10,7 +10,7 @@ from src.auth.service import CurrentUser
|
|
|
|
|
from src.config import AEROS_BASE_URL, DEFAULT_PROJECT_NAME
|
|
|
|
|
from src.database.core import DbSession
|
|
|
|
|
from src.database.service import search_filter_sort_paginate
|
|
|
|
|
from .model import AerosEquipment, AerosEquipmentDetail, MasterEquipment, AerosEquipmentGroup
|
|
|
|
|
from .model import AerosEquipment, AerosEquipmentDetail, MasterEquipment, AerosEquipmentGroup, ReliabilityPredictNonRepairable
|
|
|
|
|
from .schema import EquipmentConfiguration
|
|
|
|
|
from src.aeros_project.model import AerosProject
|
|
|
|
|
from src.aeros_simulation.model import AerosNode
|
|
|
|
|
@ -219,8 +219,8 @@ async def save_default_equipment(*, db_session: DbSession, project_name: str):
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_asset_batch(location_tags: List[str],
|
|
|
|
|
base_url: str = "http://192.168.1.82:8000",
|
|
|
|
|
def get_asset_batch(location_tags: List[str], nr_location_tags: List[str],
|
|
|
|
|
base_url: str = "http://192.168.1.82:8000",
|
|
|
|
|
timeout: int = 30)-> dict:
|
|
|
|
|
"""
|
|
|
|
|
Get asset batch data using GET request with JSON body.
|
|
|
|
|
@ -259,9 +259,11 @@ def get_asset_batch(location_tags: List[str],
|
|
|
|
|
|
|
|
|
|
for item in reliabiility_data:
|
|
|
|
|
location_tag = item["location_tag"]
|
|
|
|
|
is_nr = location_tag in nr_location_tags
|
|
|
|
|
|
|
|
|
|
results[location_tag]["cmDisP1"] = item.get("mttr", 0)
|
|
|
|
|
results[location_tag]["relDisType"] = item["distribution"]
|
|
|
|
|
results[location_tag]["relDisP1"] = item.get("parameters", 0).get("beta", 0)
|
|
|
|
|
results[location_tag]["relDisType"] = item["distribution"] if is_nr else "NHPPTTFF"
|
|
|
|
|
results[location_tag]["relDisP1"] = item.get("parameters", 0).get("beta", 0) if not is_nr else item.get("mbtf", 0)
|
|
|
|
|
results[location_tag]["relDisP2"] = item.get("parameters", 0).get("eta", 0)
|
|
|
|
|
|
|
|
|
|
return results
|
|
|
|
|
@ -304,8 +306,11 @@ async def update_equipment_for_simulation(*, db_session: DbSession, project_name
|
|
|
|
|
location_tag=reg_nodes, project_name=project_name
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
non_repairable = await db_session.execute(Select(ReliabilityPredictNonRepairable))
|
|
|
|
|
non_repairable_location_tags = [tag.location_tag for tag in non_repairable.scalars().all()]
|
|
|
|
|
|
|
|
|
|
print("Getting reliability data")
|
|
|
|
|
reliability_data = get_asset_batch(reg_nodes)
|
|
|
|
|
reliability_data = get_asset_batch(reg_nodes, non_repairable_location_tags)
|
|
|
|
|
|
|
|
|
|
reqNodeInputs = []
|
|
|
|
|
results = defaultdict()
|
|
|
|
|
|