update plant calculation

main
MrWaradana 2 weeks ago
parent 16faf36de4
commit b6d9f147f3

@ -426,13 +426,22 @@ def main():
eaf_v = 0 eaf_v = 0
# rata-rata 3 tahun terakhir untuk net_capacity_factor # rata-rata 3 tahun terakhir untuk net_capacity_factor
if data["is_actual"] == 1:
eaf_history.append(eaf_v) eaf_history.append(eaf_v)
cf_history.append(net_capacity_factor_v) cf_history.append(net_capacity_factor_v)
net_capacity_factor = net_capacity_factor_v
eaf = eaf_v
else:
last_3_eaf = eaf_history[-3:] last_3_eaf = eaf_history[-3:]
last_3_cf = cf_history[-3:] last_3_cf = cf_history[-3:]
avg_eaf_3 = sum(last_3_eaf) / len(last_3_eaf) if last_3_eaf else 0 avg_eaf_3 = sum(last_3_eaf) / len(last_3_eaf) if last_3_eaf else 0
avg_cf_3 = sum(last_3_cf) / len(last_3_cf) if last_3_cf else 0 avg_cf_3 = sum(last_3_cf) / len(last_3_cf) if last_3_cf else 0
selisih_eaf_cf = abs(avg_cf_3 - avg_eaf_3) selisih_eaf_cf = abs(avg_cf_3 - avg_eaf_3)
eaf = eaf_v
net_capacity_factor = eaf_v - selisih_eaf_cf
eaf_history.append(eaf_v)
cf_history.append(net_capacity_factor)
if data["is_actual"] == 1: if data["is_actual"] == 1:
production_bruto = validate_number(data["production_bruto"]) production_bruto = validate_number(data["production_bruto"])

Loading…
Cancel
Save