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