Cizz22 3 months ago
parent 77496b247a
commit bb1b875f09

@ -809,13 +809,17 @@ async def get_calculation_result(db_session: DbSession, calculation_id: str, tok
'critical_procurement_items': 0
}
# plant_monthly_metrics = await plant_simulation_metrics(simulation_id=scope_calculation.rbd_simulation_id, location_tag="plant", use_location_tag=0, token=token, last_oh_date=prev_oh_scope.end_date, max_interval=scope_calculation.max_interval)
# The code `plant_monthly_metrics` is likely a function or a variable in Python. Without
# seeing the implementation of the code, it is not possible to determine exactly what it is
# doing. It could be used to store monthly metrics for a plant, calculate metrics, or perform
# some other operation related to plant data.
plant_monthly_metrics = await plant_simulation_metrics(simulation_id=scope_calculation.rbd_simulation_id, location_tag="plant", use_location_tag=0, token=token, last_oh_date=prev_oh_scope.end_date, max_interval=scope_calculation.max_interval)
# REFERENCE_CAPACITY = 630 # or 550
# COST_PER_MWH = 1_000_000 # rupiah
REFERENCE_CAPACITY = 630 # or 550
COST_PER_MWH = 1_000_000 # rupiah
# plant_capacity_loss_money = [metrics['derated_mwh'] * COST_PER_MWH for metrics in plant_monthly_metrics.values()]
# # cumulative_loss_money = np.cumsum(plant_capacity_loss_money)
plant_capacity_loss_money = [metrics['derated_mwh'] * COST_PER_MWH for metrics in plant_monthly_metrics.values()]
cumulative_loss_money = np.cumsum(plant_capacity_loss_money)
# # raise Exception(plant_monthly_metrics)
@ -823,7 +827,7 @@ async def get_calculation_result(db_session: DbSession, calculation_id: str, tok
for month_index in range(data_num):
month_result = {
"overhaul_cost": 0.0,
"corrective_cost": 0.0,
"corrective_cost": cumulative_loss_money,
"procurement_cost": 0.0,
"num_failures": 0.0,
"day": month_index + 1,

@ -62,6 +62,7 @@ filtered_wo AS (
FROM wo_costs w
JOIN location_max lm ON w.asset_location = lm.asset_location
WHERE w.total_wo_cost > 0
AND w.total_wo_cost >= lm.max_cost * 0.10 -- keep within 10% of max
)
SELECT
asset_location,

Loading…
Cancel
Save