edit plant simulation run2.py -> menambahkan hitung nilai cf=selisih dari rata2 3 tahun terakhir eaf - (cf - eaf)

main
ariwahyunahar 3 weeks ago
parent 398a2b14a2
commit 8c01702c7a

@ -391,6 +391,8 @@ def main():
cost_a_depreciation = 0 cost_a_depreciation = 0
net_capacity_factor_v = 0 net_capacity_factor_v = 0
eaf_v = 0 eaf_v = 0
eaf_history = []
cf_history = []
# Prefetch master data CF dan EAF sekali saja di luar loop # Prefetch master data CF dan EAF sekali saja di luar loop
cur.execute(""" cur.execute("""
@ -399,7 +401,6 @@ def main():
order by year asc order by year asc
""") """)
year_rows = cur.fetchall() year_rows = cur.fetchall()
print(year_rows)
year_data_map = {int(t): (validate_number(cf), validate_number(eaf)) for (t, cf, eaf) in year_rows if year_data_map = {int(t): (validate_number(cf), validate_number(eaf)) for (t, cf, eaf) in year_rows if
t is not None} t is not None}
@ -418,6 +419,15 @@ def main():
net_capacity_factor_v = 0 net_capacity_factor_v = 0
eaf_v = 0 eaf_v = 0
# rata-rata 3 tahun terakhir untuk net_capacity_factor
eaf_history.append(eaf_v)
cf_history.append(net_capacity_factor_v)
last_3_eaf = eaf_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_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)
if data["is_actual"] == 1: if data["is_actual"] == 1:
production_bruto = validate_number(data["production_bruto"]) production_bruto = validate_number(data["production_bruto"])
production_netto = validate_number(data["production_netto"]) production_netto = validate_number(data["production_netto"])
@ -431,6 +441,8 @@ def main():
cost_bd_om = validate_number(data["cost_bd_om"]) cost_bd_om = validate_number(data["cost_bd_om"])
cost_bd_pm_nonmi = validate_number(data["cost_bd_pm_nonmi"]) cost_bd_pm_nonmi = validate_number(data["cost_bd_pm_nonmi"])
cost_bd_bd = validate_number(data["cost_bd_bd"]) cost_bd_bd = validate_number(data["cost_bd_bd"])
net_capacity_factor = net_capacity_factor_v
eaf = eaf_v
else: else:
production_netto = net_capacity_factor * 8760 * daya_mampu_netto / 100 production_netto = net_capacity_factor * 8760 * daya_mampu_netto / 100
production_bruto = production_netto / (100 - (auxiliary + susut_trafo)) * 100 production_bruto = production_netto / (100 - (auxiliary + susut_trafo)) * 100
@ -449,9 +461,8 @@ def main():
cost_bd_om = cost_bd_om cost_bd_om = cost_bd_om
cost_bd_pm_nonmi = cost_bd_pm_nonmi cost_bd_pm_nonmi = cost_bd_pm_nonmi
cost_bd_bd = cost_bd_bd cost_bd_bd = cost_bd_bd
eaf = eaf_v
net_capacity_factor = net_capacity_factor_v net_capacity_factor = eaf_v - selisih_eaf_cf
eaf = eaf_v
# ++++++ REVENUE +++++++ # ++++++ REVENUE +++++++
revenue_total = revenue_a + revenue_b + revenue_c + revenue_d revenue_total = revenue_a + revenue_b + revenue_c + revenue_d

Loading…
Cancel
Save