Commit c7f1fa76 authored by ZZH's avatar ZZH

update inv eval 2024-12-31 13:44

parent 987ac3ce
...@@ -43,3 +43,4 @@ class EmsInvEvalRsp(Model): ...@@ -43,3 +43,4 @@ class EmsInvEvalRsp(Model):
irr: float = Opt(Float("内部收益率 ").eg(0.1)) irr: float = Opt(Float("内部收益率 ").eg(0.1))
ior: float = Opt(Float("投资回报率").eg(0.1)) ior: float = Opt(Float("投资回报率").eg(0.1))
cost_kWh: float = Opt(Float("度电成本").eg(0.1)) cost_kWh: float = Opt(Float("度电成本").eg(0.1))
error: str = Opt(Str("不合理输入").eg("当前限制条件不合理"))
...@@ -44,6 +44,9 @@ async def post_inv_eval(req, body: EmsInvEvalReq) -> EmsInvEvalRsp: ...@@ -44,6 +44,9 @@ async def post_inv_eval(req, body: EmsInvEvalReq) -> EmsInvEvalRsp:
sale_price=sale_price, sale_limit=sale_limit, sale_price=sale_price, sale_limit=sale_limit,
sale_cost=sale_cost, goal=goal) sale_cost=sale_cost, goal=goal)
cfg = await inv_eval(d_params) cfg = await inv_eval(d_params)
if "Error" in cfg:
return EmsInvEvalRsp(error=cfg["Error"])
return EmsInvEvalRsp(pv=cfg.get("pv", 0), es_p=cfg.get("es_p", 0), return EmsInvEvalRsp(pv=cfg.get("pv", 0), es_p=cfg.get("es_p", 0),
es_cap=cfg.get("es_cap", 0), es_cap=cfg.get("es_cap", 0),
cg=cfg.get("cg", 0), cg=cfg.get("cg", 0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment