feature/reliability_stat
Cizz22 4 months ago
parent cf353de4f5
commit 01dd11b293

@ -73,35 +73,36 @@ async def get_simulation_results(*, simulation_id: str, token: str):
"plant_result": plant_data "plant_result": plant_data
} }
def calculate_asset_weights(plant_result, eq_results): # def calculate_asset_weights(plant_result, eq_results):
""" # """
Calculate each asset's contribution weight to plant EAF # Calculate each asset's contribution weight to plant EAF
Based on production capacity and criticality # Based on production capacity and criticality
""" # """
plant_ideal_production = plant_result.get('ideal_production', 0) # plant_ideal_production = plant_result.get('ideal_production', 0)
results = [] # results = []
for asset in eq_results: # for asset in eq_results:
# Weight based on production capacity # # Weight based on production capacity
capacity_weight = asset.get('ideal_production', 0) / plant_ideal_production if plant_ideal_production > 0 else 0 # capacity_weight = asset.get('ideal_production', 0) / plant_ideal_production if plant_ideal_production > 0 else 0
# Get asset EAF # # Get asset EAF
asset_eaf = asset.get('eaf', 0) # asset_eaf = asset.get('eaf', 0)
# Calculate EAF impact (how much this asset affects plant EAF) # # Calculate EAF impact (how much this asset affects plant EAF)
eaf_impact = (100 - asset_eaf) * capacity_weight # eaf_impact = (100 - asset_eaf) * capacity_weight
asset_weight = AssetWeight( # asset_weight = AssetWeight(
node=asset.get('aeros_node'), # node=asset.get('aeros_node'),
capacity_weight=capacity_weight, # capacity_weight=capacity_weight,
eaf_impact=eaf_impact, # eaf_impact=eaf_impact,
eaf=asset_eaf, # eaf=asset_eaf,
num_of_failures=asset.get('num_events', 0), # num_of_failures=asset.get('num_events', 0),
ideal_production=asset.get('ideal_production', 0) # ideal_production=asset.get('ideal_production', 0),
) # downtime_hours=asset
results.append(asset_weight) # )
# results.append(asset_weight)
return results # return results
def calculate_asset_eaf_contributions(plant_result, eq_results): def calculate_asset_eaf_contributions(plant_result, eq_results):
""" """
@ -204,7 +205,7 @@ async def identify_worst_eaf_contributors(*, simulation_result, target_eaf: floa
target_plant_eaf=target_eaf, target_plant_eaf=target_eaf,
eaf_gap=eaf_gap, eaf_gap=eaf_gap,
asset_contributions=selected_asset, asset_contributions=selected_asset,
optimization_success=optimization_success optimization_success=optimization_success,
simulation_id=simulation_id simulation_id=simulation_id
) )

Loading…
Cancel
Save