Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
e4a663a5
Commit
e4a663a5
authored
Jul 06, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
86b3998e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
load_forecast_dao.py
unify_api/modules/load_analysis/dao/load_forecast_dao.py
+2
-2
load_forecast_service.py
...pi/modules/load_analysis/service/load_forecast_service.py
+9
-6
No files found.
unify_api/modules/load_analysis/dao/load_forecast_dao.py
View file @
e4a663a5
...
@@ -15,7 +15,7 @@ async def get_kwh_p_dao(terms, start_time, end_time,
...
@@ -15,7 +15,7 @@ async def get_kwh_p_dao(terms, start_time, end_time,
"""
"""
sql
=
f
"""
sql
=
f
"""
select
avg(p) p,sum(kwh) kwh,
DATE_FORMAT(create_time,"{time_fmt}")
select
sum(p) p,count(*) p_count,
DATE_FORMAT(create_time,"{time_fmt}")
as cal_time
as cal_time
from {table_name} where cid in
%
s and create_time >=
%
s
from {table_name} where cid in
%
s and create_time >=
%
s
and create_time <=
%
s group by cal_time
and create_time <=
%
s group by cal_time
...
@@ -36,7 +36,7 @@ async def get_pred_p_dao(terms, start_time, end_time,
...
@@ -36,7 +36,7 @@ async def get_pred_p_dao(terms, start_time, end_time,
:return:
:return:
"""
"""
sql
=
f
"""
sql
=
f
"""
select
avg
(p) p ,count(*) p_count,DATE_FORMAT(create_time,
select
sum
(p) p ,count(*) p_count,DATE_FORMAT(create_time,
"{time_fmt}") as cal_time
"{time_fmt}") as cal_time
from company_day_ahead_predict
from company_day_ahead_predict
where cid in
%
s and create_time >=
%
s and create_time <=
%
s
where cid in
%
s and create_time >=
%
s and create_time <=
%
s
...
...
unify_api/modules/load_analysis/service/load_forecast_service.py
View file @
e4a663a5
...
@@ -37,19 +37,22 @@ async def load_forecast_srv(cids, s_time, e_time, interval, slots):
...
@@ -37,19 +37,22 @@ async def load_forecast_srv(cids, s_time, e_time, interval, slots):
for
slot
in
slots
:
for
slot
in
slots
:
if
slot
in
real_data
:
if
slot
in
real_data
:
p
=
real_data
[
slot
][
"p"
]
p
=
real_data
[
slot
][
"p"
]
kwh
=
real_data
[
slot
][
"kwh"
]
if
slot
>
now_time
:
if
slot
>
now_time
:
value
,
kwh
=
""
,
""
value
=
""
elif
p
in
[
0
,
0.0
]:
elif
p
in
[
0
,
0.0
]:
value
,
kwh
=
0.0
,
0.0
value
=
0.0
elif
p
:
elif
p
:
value
=
round
(
p
,
2
)
value
=
round
(
p
,
2
)
kwh
=
round
(
kwh
,
2
)
else
:
else
:
value
,
kwh
=
""
,
""
value
=
""
else
:
else
:
value
,
kwh
=
""
,
""
value
=
""
real_list
.
append
(
value
)
real_list
.
append
(
value
)
if
value
or
value
==
0.0
:
p_count
=
real_data
[
slot
][
"p_count"
]
kwh
=
round
(
value
*
0.25
*
p_count
,
2
)
else
:
kwh
=
""
real_power_list
.
append
(
kwh
)
real_power_list
.
append
(
kwh
)
# 2,获取预测数据
# 2,获取预测数据
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment