Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling-v3
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
虢奥
integrated-scheduling-v3
Commits
435b229f
Commit
435b229f
authored
Nov 23, 2021
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复索引溢出异常
parent
2f1f9dca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
40 deletions
+100
-40
truck.py
equipment/truck.py
+11
-5
realtime_dispatch.py
realtime_dispatch.py
+0
-0
tables.py
tables.py
+67
-28
traffic_flow_info.py
traffic_flow/traffic_flow_info.py
+22
-7
No files found.
equipment/truck.py
View file @
435b229f
...
...
@@ -3,7 +3,7 @@
# @Time : 2021/8/24 11:28
# @Author : Opfer
# @Site :
# @File : truck.py
# @File : truck.py
# @Software: PyCharm
from
para_config
import
*
...
...
@@ -132,11 +132,12 @@ class TruckInfo(WalkManage):
self
.
truck_current_task
=
{}
device_name_set
=
redis2
.
keys
()
print
(
"tast_truck_set"
)
print
(
get_value
(
"dynamic_truck_set"
))
## 两个
# print("tast_truck_set")
# print(get_value("dynamic_truck_set")) ## 两个
#
# print(self.dynamic_truck_set)
# print(self.truck_uuid_to_index_dict)
print
(
self
.
dynamic_truck_set
)
print
(
self
.
truck_uuid_to_index_dict
)
for
item
in
device_name_set
:
try
:
...
...
@@ -156,6 +157,11 @@ class TruckInfo(WalkManage):
logger
.
info
(
"矿卡当前任务:"
)
logger
.
info
(
self
.
truck_current_task
)
# logger.info("device_name_set,大小")
# logger.info(len(device_name_set))
# logger.info("device_name_set")
# logger.info(device_name_set)
# self.truck_current_task = {}
#
# dynamic_truck_set = get_value("dynamic_truck_set")
...
...
realtime_dispatch.py
View file @
435b229f
This diff is collapsed.
Click to expand it.
tables.py
View file @
435b229f
...
...
@@ -9,12 +9,22 @@
# 存储数据库表结构
from
settings
import
*
from
sqlalchemy
import
Column
,
create_engine
from
sqlalchemy
import
VARCHAR
,
DateTime
,
Float
,
Integer
,
BOOLEAN
from
sqlalchemy.orm
import
sessionmaker
,
scoped_session
from
sqlalchemy.ext.declarative
import
declarative_base
from
urllib.parse
import
quote
import
json
json_file
=
"config.json"
with
open
(
json_file
)
as
f
:
mysql_config
=
json
.
load
(
f
)[
"mysql"
]
with
open
(
json_file
)
as
f
:
postgre_config
=
json
.
load
(
f
)[
"postgresql"
]
# 创建对象的基类:
...
...
@@ -30,33 +40,6 @@ engine_postgre = create_engine(
%
quote
(
"Huituo@123"
)
)
# 创建DBsession_mysql类型:
DBsession_mysql
=
sessionmaker
(
bind
=
engine_mysql
)
DBsession_mysql
=
scoped_session
(
DBsession_mysql
)
DBsession_postgre
=
sessionmaker
(
bind
=
engine_postgre
)
DBsession_postgre
=
scoped_session
(
DBsession_postgre
)
# 创建session_mysql对象:
session_mysql
=
DBsession_mysql
()
session_mysql
.
expire_on_commit
=
False
session_postgre
=
DBsession_postgre
()
session_postgre
.
expire_on_commit
=
False
# # 创建对象的基类:
# Base = declarative_base()
#
# # 初始化数据库连接:
# engine_mysql = create_engine('mysql+mysqlconnector://root:Huituo@123@192.168.28.111:3306/waytous')
#
# engine_postgre = create_engine('postgresql://postgres:Huituo@123@192.168.28.111:5432/shenbao_2021520')
#
# # 创建DBsession_mysql类型:
# DBsession_mysql = sessionmaker(bind=engine_mysql)
#
...
...
@@ -69,7 +52,63 @@ session_postgre.expire_on_commit = False
# # 创建session_mysql对象:
# session_mysql = DBsession_mysql()
#
# session_mysql.expire_on_commit = False
#
# session_postgre = DBsession_postgre()
#
# session_postgre.expire_on_commit = False
# 创建对象的基类:
Base
=
declarative_base
()
sql_str
=
str
(
"mysql+mysqlconnector://"
+
mysql_config
[
"user"
]
+
":
%
s@"
+
mysql_config
[
"host"
]
+
\
":"
+
mysql_config
[
"port"
]
+
"/"
+
mysql_config
[
"database"
])
postgre_str
=
str
(
"postgresql://"
+
postgre_config
[
"user"
]
+
":
%
s@"
+
postgre_config
[
"host"
]
+
\
":"
+
postgre_config
[
"port"
]
+
"/"
+
postgre_config
[
"database"
])
try
:
engine_mysql
=
create_engine
(
# "mysql+mysqlconnector://root:%s@192.168.28.111:3306/waytous"
# % quote("Huituo@123")
# "mysql+mysqlconnector://" + mysql_config["user"] + ":" + mysql_config["password"] + "@" + mysql_config[
# "host"] + ":" + mysql_config["port"] + "/" + mysql_config["database"]
sql_str
%
quote
(
mysql_config
[
"password"
])
)
engine_postgre
=
create_engine
(
# "postgresql://postgres:%s@192.168.28.111:5432/shenbao_2021520"
# % quote("Huituo@123")
# "postgresql://" + postgre_config["user"] + ":" + postgre_config["password"] + "@" + postgre_config[
# "host"] + ":" + postgre_config["port"] + "/" + postgre_config["database"]
postgre_str
%
quote
(
postgre_config
[
"password"
])
)
# 创建DBsession_mysql类型:
DBsession_mysql
=
sessionmaker
(
bind
=
engine_mysql
)
DBsession_mysql
=
scoped_session
(
DBsession_mysql
)
DBsession_postgre
=
sessionmaker
(
bind
=
engine_postgre
)
DBsession_postgre
=
scoped_session
(
DBsession_postgre
)
# 创建session_mysql对象:
session_mysql
=
DBsession_mysql
()
session_mysql
.
expire_on_commit
=
False
session_postgre
=
DBsession_postgre
()
session_postgre
.
expire_on_commit
=
False
except
Exception
as
es
:
logger
.
error
(
"数据库连接失败"
)
logger
.
error
(
es
)
# 定义对象:
...
...
traffic_flow/traffic_flow_info.py
View file @
435b229f
...
...
@@ -13,6 +13,7 @@ from equipment.excavator import ExcavatorInfo
from
equipment.dump
import
DumpInfo
from
equipment.truck
import
TruckInfo
# 车流规划类
class
Traffic_para
(
WalkManage
):
def
__init__
(
self
,
num_of_load_area
,
num_of_unload_area
,
num_of_excavator
,
num_of_dump
,
truck
):
...
...
@@ -160,22 +161,36 @@ class Traffic_para(WalkManage):
cost_to_dump
=
self
.
path_planner
.
cost_to_dump
cost_to_excavator
=
self
.
path_planner
.
cost_to_excavator
logger
.
info
(
"cost_to_dump"
)
logger
.
info
(
cost_to_dump
)
logger
.
info
(
"cost_to_excavator"
)
logger
.
info
(
cost_to_excavator
)
logger
.
info
(
"self.goto_excavator_factor"
)
logger
.
info
(
self
.
goto_excavator_factor
)
logger
.
info
(
"self.goto_dump_factor"
)
logger
.
info
(
self
.
goto_dump_factor
)
logger
.
info
(
"dynamic_dump_num"
)
logger
.
info
(
get_value
(
"dynamic_dump_num"
))
logger
.
info
(
"dynamic_excavator_num"
)
logger
.
info
(
get_value
(
"dynamic_excavator_num"
))
# ga
# 路网信息读取
for
dump_index
in
range
(
get_value
(
"dynamic_dump_num"
)):
for
excavator_index
in
range
(
get_value
(
"dynamic_excavator_num"
)):
for
dump_index
in
range
(
get_value
(
"dynamic_dump_num"
)
-
1
):
for
excavator_index
in
range
(
get_value
(
"dynamic_excavator_num"
)
-
1
):
self
.
goto_excavator_factor
[
dump_index
][
excavator_index
]
=
\
(
cost_to_excavator
[
dump_index
][
excavator_index
]
/
(
empty_speed
*
1000
))
/
self
.
payload
self
.
goto_dump_factor
[
excavator_index
][
dump_index
]
=
\
(
cost_to_dump
[
excavator_index
][
dump_index
]
/
(
heavy_speed
*
1000
))
/
self
.
payload
logger
.
info
(
"self.goto_dump_factor"
)
logger
.
info
(
self
.
goto_dump_factor
)
logger
.
info
(
"self.goto_dump_factor"
)
logger
.
info
(
self
.
goto_dump_factor
)
#
logger.info("self.goto_dump_factor")
#
logger.info(self.goto_dump_factor)
#
logger.info("self.goto_dump_factor")
#
logger.info(self.goto_dump_factor)
except
Exception
as
es
:
logger
.
error
(
es
)
logger
.
error
(
"车流规划信息计算异常"
)
logger
.
error
(
es
)
# 初始化车流规划类
...
...
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