diff --git a/src/calculation_target_reliability/router.py b/src/calculation_target_reliability/router.py index a381ead..dbabb06 100644 --- a/src/calculation_target_reliability/router.py +++ b/src/calculation_target_reliability/router.py @@ -91,7 +91,7 @@ async def get_target_reliability( simulation_id=simulation_id, token=token ) - + optimize_result = await identify_worst_eaf_contributors( simulation_result=results, target_eaf=eaf_input, diff --git a/src/calculation_target_reliability/service.py b/src/calculation_target_reliability/service.py index 1db56f3..03a929d 100644 --- a/src/calculation_target_reliability/service.py +++ b/src/calculation_target_reliability/service.py @@ -89,26 +89,23 @@ def calculate_asset_eaf_contributions(plant_result, eq_results, standard_scope, MIN_BIRNBAUM_IMPORTANCE = 0.0005 REALISTIC_MAX_AVAILABILITY = 0.995 # 99.5% - MIN_IMPROVEMENT_PERCENT = 0.005 # 0.5% + MIN_IMPROVEMENT_PERCENT = 0.0001 min_improvement_fraction = MIN_IMPROVEMENT_PERCENT / 100.0 results = [] for asset in eq_results: asset_name = asset.get("aeros_node").get("node_name") - contribution_factor = 0 - birbaum = 0 - current_availability = 0 - downtime = 0 if asset_name not in standard_scope: continue - if asset: - contribution_factor = asset.get("contribution_factor", 0.0) - birbaum = asset.get("contribution", 0.0) - current_availability = asset.get("availability", 0.0) - downtime = asset.get("total_downtime", 0.0) + + contribution_factor = asset.get("contribution_factor", 0.0) + birbaum = asset.get("contribution", 0.0) + current_availability = asset.get("availability", 0.0) + downtime = asset.get("total_downtime", 0.0) + # Filter 1: Importance too low if contribution_factor < MIN_BIRNBAUM_IMPORTANCE: @@ -127,8 +124,8 @@ def calculate_asset_eaf_contributions(plant_result, eq_results, standard_scope, # Filter 2: Improvement too small - # if required_impr < min_improvement_fraction: - # continue + if improvement_impact < MIN_IMPROVEMENT_PERCENT: + continue # Contribution efficiency (secondary metric) efficiency = birbaum / downtime if downtime > 0 else birbaum