Cizz22 5 months ago
parent 0ddc47a0e1
commit a3d47d3d55

@ -265,6 +265,7 @@ def get_asset_batch(location_tags: List[str], nr_location_tags: List[str],
results[location_tag]["relDisType"] = item["distribution"] if is_nr else "NHPPTTFF" 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]["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) results[location_tag]["relDisP2"] = item.get("parameters", 0).get("eta", 0)
results[location_tag]["parameters"] = item.get("parameters", {})
return results return results
@ -346,7 +347,7 @@ async def update_equipment_for_simulation(*, db_session: DbSession, project_name
continue continue
eq["cmDisP1"] = reliabiility.get("cmDisP1", 0) eq["cmDisP1"] = reliabiility.get("cmDisP1", 0)
eq["relDisType"] = "NHPPTTFF" eq["relDisType"] = reliabiility.get("relDisType", "NHPPTTFF")
eq["relDisP1"] = reliabiility.get("relDisP1", 0) eq["relDisP1"] = reliabiility.get("relDisP1", 0)
eq["relDisP2"] = reliabiility.get("relDisP2", 0) eq["relDisP2"] = reliabiility.get("relDisP2", 0)
@ -355,7 +356,8 @@ async def update_equipment_for_simulation(*, db_session: DbSession, project_name
"mttr": eq["cmDisP1"], "mttr": eq["cmDisP1"],
"distribution": eq["relDisType"], "distribution": eq["relDisType"],
"beta": eq["relDisP1"], "beta": eq["relDisP1"],
"eta": eq["relDisP2"] "eta": eq["relDisP2"],
"parameters": eq.get("parameters", {})
} }
except Exception as e: except Exception as e:
print(f"Error fetching data for {eq['equipmentName']}: {e}") print(f"Error fetching data for {eq['equipmentName']}: {e}")

@ -221,7 +221,8 @@ async def save_simulation_result(
eq_reliability = eq_update.get(result["nodeName"], { eq_reliability = eq_update.get(result["nodeName"], {
"eta": 0, "eta": 0,
"beta": 0, "beta": 0,
"mttr": 0 "mttr": 0,
"parameters": {}
}) })
@ -268,7 +269,8 @@ async def save_simulation_result(
eaf=result["production"] / result["idealProduction"] if result["idealProduction"] > 0 else 0, eaf=result["production"] / result["idealProduction"] if result["idealProduction"] > 0 else 0,
beta=eq_reliability["beta"] if node_type == "RegularNode" else None, beta=eq_reliability["beta"] if node_type == "RegularNode" else None,
eta=eq_reliability["eta"] if node_type == "RegularNode" else None, eta=eq_reliability["eta"] if node_type == "RegularNode" else None,
mttr=eq_reliability["mttr"] if node_type == "RegularNode" else None mttr=eq_reliability["mttr"] if node_type == "RegularNode" else None,
parameters=eq_reliability["parameters"] if node_type == "RegularNode" else None
) )
calc_objects.append(calc_result) calc_objects.append(calc_result)

Loading…
Cancel
Save