feat: 增加吨熟料发电量及计算

This commit is contained in:
caoqianming 2024-05-10 11:17:05 +08:00
parent ebccaa2a50
commit 43aa4c83a8
2 changed files with 12 additions and 2 deletions

View File

@ -134,6 +134,7 @@ class EnStat(BaseModel):
en_consume_unit = models.FloatField("单位产品能耗", default=0, help_text="tce/t")
cen_consume_unit = models.FloatField("单位产品综合能耗", default=0, help_text="kgce/t")
production_hour = models.FloatField("台时产量", default=0, help_text="t/h")
production_elec_unit = models.FloatField("吨熟料发电量", default=0, help_text="kw·h/t")
total_hour_now = models.FloatField("动态总时长", default=0, help_text="h")
run_hour = models.FloatField("运转时长", default=0, help_text="h")
shut_hour = models.FloatField("停机时长", default=0, help_text="h")

View File

@ -489,12 +489,21 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
# 综合能耗
enstat.cen_consume_unit = enstat.coal_consume_unit + 0.1229 * enstat.elec_consume_unit
enstat.save()
if enstat.mgroup.name == "水泥磨" and enstat.type not in ["month_st", "sflog"] and "pcoal" in this_cal_attrs:
elif enstat.mgroup.name == "水泥磨" and enstat.type not in ["month_st", "sflog"] and "pcoal" in this_cal_attrs:
pre_enstat = EnStat.objects.filter(type=enstat.type, year_s=enstat.year_s, month_s=enstat.month_s, day_s=enstat.day_s, hour=enstat.hour, mgroup__name="回转窑").first()
if pre_enstat:
# 综合能耗
enstat.cen_consume_unit = enstat.elec_consume_unit * 0.1229 + 0.7 * pre_enstat.cen_consume_unit
enstat.save()
elif enstat.mgroup.name == '余热发电':
pre_enstat = EnStat.objects.filter(type=enstat.type, year_s=enstat.year_s, month_s=enstat.month_s, day_s=enstat.day_s, hour=enstat.hour, mgroup__name="回转窑").first()
if pre_enstat:
# 吨熟料发电量
try:
enstat.production_elec_unit = enstat.total_production / pre_enstat.total_production
enstat.save()
except ZeroDivisionError:
pass
# 运转时长相关
if type != "hour_s" and "run_hour" in this_cal_attrs:
enstat.total_hour_now, enstat.shut_hour = get_total_hour_now_and_shut_hour(enstat)