|
|
|
@ -259,14 +259,19 @@ def get_asset_batch(location_tags: List[str], nr_location_tags: List[str],
|
|
|
|
|
|
|
|
|
|
|
|
for item in reliabiility_data:
|
|
|
|
for item in reliabiility_data:
|
|
|
|
location_tag = item["location_tag"]
|
|
|
|
location_tag = item["location_tag"]
|
|
|
|
is_nr = location_tag in nr_location_tags
|
|
|
|
try:
|
|
|
|
|
|
|
|
is_nr = item["distribution"] != "NHPP"
|
|
|
|
results[location_tag]["cmDisP1"] = item.get("mttr", 0)
|
|
|
|
mtbf = item["mtbf"]
|
|
|
|
results[location_tag]["relDisType"] = item["distribution"] if is_nr else "NHPPTTFF"
|
|
|
|
mttr = item["mttr"]
|
|
|
|
results[location_tag]["relDisP1"] = item.get("parameters", 0).get("beta", 0) if not is_nr else item.get("mbtf", 0)
|
|
|
|
distribution, reldisp1, reldisp2 = get_distribution(item)
|
|
|
|
results[location_tag]["relDisP2"] = item.get("parameters", 0).get("eta", 0)
|
|
|
|
|
|
|
|
results[location_tag]["parameters"] = item.get("parameters", {})
|
|
|
|
results[location_tag]["cmDisP1"] = mttr
|
|
|
|
|
|
|
|
results[location_tag]["relDisType"] = distribution
|
|
|
|
|
|
|
|
results[location_tag]["relDisP1"] = reldisp1
|
|
|
|
|
|
|
|
results[location_tag]["relDisP2"] = reldisp2
|
|
|
|
|
|
|
|
results[location_tag]["parameters"] = item.get("parameters", {})
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
raise Exception(f"Error processing item {location_tag}: {e}")
|
|
|
|
return results
|
|
|
|
return results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -277,6 +282,35 @@ def get_asset_batch(location_tags: List[str], nr_location_tags: List[str],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_distribution(item):
|
|
|
|
|
|
|
|
name = item["distribution"]
|
|
|
|
|
|
|
|
# Map distribution names to the expected format
|
|
|
|
|
|
|
|
if name == "Weibull-2P":
|
|
|
|
|
|
|
|
beta = item["parameters"].get("beta", 0)
|
|
|
|
|
|
|
|
alpha = item["parameters"].get("alpha", 0)
|
|
|
|
|
|
|
|
return "Weibull2", beta, alpha
|
|
|
|
|
|
|
|
elif name == "Weibull-3P":
|
|
|
|
|
|
|
|
beta = item["parameters"].get("beta", 0)
|
|
|
|
|
|
|
|
alpha = item["parameters"].get("alpha", 0)
|
|
|
|
|
|
|
|
return "Weibull3", beta, alpha
|
|
|
|
|
|
|
|
elif name == "Exponential-2P":
|
|
|
|
|
|
|
|
lambda_ = item["parameters"].get("Lambda", 0)
|
|
|
|
|
|
|
|
gamma = item["parameters"].get("gamma", 0)
|
|
|
|
|
|
|
|
return "Exponential2", lambda_, gamma
|
|
|
|
|
|
|
|
elif name == "NHPP":
|
|
|
|
|
|
|
|
beta = item["parameters"].get("beta", 0)
|
|
|
|
|
|
|
|
eta = item["parameters"].get("eta", 0)
|
|
|
|
|
|
|
|
return "NHPPTTFF", beta, eta
|
|
|
|
|
|
|
|
elif name == "Lognormal":
|
|
|
|
|
|
|
|
mu = item["parameters"].get("mu", 0)
|
|
|
|
|
|
|
|
sigma = item["parameters"].get("sigma", 0)
|
|
|
|
|
|
|
|
return "Lognormal", mu, sigma
|
|
|
|
|
|
|
|
elif name == "Normal":
|
|
|
|
|
|
|
|
mu = item["parameters"].get("mu", 0)
|
|
|
|
|
|
|
|
sigma = item["parameters"].get("sigma", 0)
|
|
|
|
|
|
|
|
return "Normal", mu, 1000
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def update_equipment_for_simulation(*, db_session: DbSession, project_name: str, schematic_name: str, custom_input: Optional[dict] = None):
|
|
|
|
async def update_equipment_for_simulation(*, db_session: DbSession, project_name: str, schematic_name: str, custom_input: Optional[dict] = None):
|
|
|
|
@ -347,7 +381,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"] = reliabiility.get("relDisType", "NHPPTTFF")
|
|
|
|
eq["relDisType"] = reliabiility.get("relDisType", "Fixed")
|
|
|
|
eq["relDisP1"] = reliabiility.get("relDisP1", 0)
|
|
|
|
eq["relDisP1"] = reliabiility.get("relDisP1", 0)
|
|
|
|
eq["relDisP2"] = reliabiility.get("relDisP2", 0)
|
|
|
|
eq["relDisP2"] = reliabiility.get("relDisP2", 0)
|
|
|
|
|
|
|
|
|
|
|
|
|