Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
m500-pressure
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李远洪
m500-pressure
Commits
9b558d2c
Commit
9b558d2c
authored
Aug 31, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了一个bug2
parent
4b0339f8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
626470 additions
and
54 deletions
+626470
-54
data/log1.txt
data/log1.txt
+4481
-44
lib/socket/ClientSocket.py
lib/socket/ClientSocket.py
+1
-1
lib/socket/service/M500PressureServer.py
lib/socket/service/M500PressureServer.py
+5
-6
result.txt
result.txt
+621980
-0
start.py
start.py
+3
-3
No files found.
data/log1.txt
View file @
9b558d2c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
lib/socket/ClientSocket.py
View file @
9b558d2c
...
@@ -60,7 +60,7 @@ class ClientSocket(SocketBase):
...
@@ -60,7 +60,7 @@ class ClientSocket(SocketBase):
#####################################################
#####################################################
def
close
(
self
):
def
close
(
self
):
# self.client.send("_end".encode()) //发送一个socket断开的命令
# self.client.send("_end".encode()) //发送一个socket断开的命令
self
.
client
.
shutdown
()
self
.
client
.
shutdown
(
socket
.
SHUT_RDWR
)
self
.
client
.
close
()
self
.
client
.
close
()
self
.
status
=
0
self
.
status
=
0
...
...
lib/socket/service/M500PressureServer.py
View file @
9b558d2c
...
@@ -104,7 +104,6 @@ class M500PressureServer():
...
@@ -104,7 +104,6 @@ class M500PressureServer():
startTime
=
self
.
startTime
startTime
=
self
.
startTime
while
self
.
serviceStatus
==
1
:
while
self
.
serviceStatus
==
1
:
time
.
sleep
(
self
.
sendDur
)
time
.
sleep
(
self
.
sendDur
)
gpsMsg
=
""
gpsMsg
=
""
OBDMsg
=
""
OBDMsg
=
""
if
self
.
travelStatus
==
0
:
if
self
.
travelStatus
==
0
:
...
@@ -342,15 +341,15 @@ class M500PressureServer():
...
@@ -342,15 +341,15 @@ class M500PressureServer():
self
.
serviceTravel
()
self
.
serviceTravel
()
########################################################
########################################################
# 停止行驶的服务
# 停止行驶的服务
(同时会停止线程)
########################################################
########################################################
def
stopTravelService
(
self
):
def
stopTravelService
(
self
):
#
self.fireOff()
self
.
fireOff
()
self
.
serviceStatus
=
0
self
.
serviceStatus
=
0
self
.
gpsLine
=
[]
self
.
gpsLine
=
[]
self
.
gpsLineIndex
=
0
self
.
gpsLineIndex
=
0
self
.
travelStatus
=
0
self
.
travelStatus
=
0
#
self.socket.close()
self
.
socket
.
close
()
########################################################
########################################################
#接收消息方法
#接收消息方法
...
@@ -415,7 +414,7 @@ class M500PressureServer():
...
@@ -415,7 +414,7 @@ class M500PressureServer():
self
.
startTime
=
int
(
time
.
time
())
self
.
startTime
=
int
(
time
.
time
())
while
True
:
while
True
:
endTime
=
int
(
time
.
time
())
endTime
=
int
(
time
.
time
())
if
(
self
.
startTime
-
end
Time
)
>
self
.
durTime
:
if
(
endTime
-
self
.
start
Time
)
>
self
.
durTime
:
break
break
try
:
try
:
self
.
sn
=
1
self
.
sn
=
1
...
@@ -441,7 +440,7 @@ class M500PressureServer():
...
@@ -441,7 +440,7 @@ class M500PressureServer():
self
.
writeToFile
(
"data/log1.txt"
,
err
,
type
=
1
)
self
.
writeToFile
(
"data/log1.txt"
,
err
,
type
=
1
)
print
(
self
.
threadName
+
"线程出现异常
\n
"
)
print
(
self
.
threadName
+
"线程出现异常
\n
"
)
self
.
writeToFile
(
"data/log1.txt"
,
self
.
threadName
+
"线程出现异常
\n
"
,
type
=
1
)
self
.
writeToFile
(
"data/log1.txt"
,
self
.
threadName
+
"线程出现异常
\n
"
,
type
=
1
)
if
(
self
.
startTime
-
endTime
)
>
180
:
if
(
self
.
durTime
-
(
endTime
-
self
.
startTime
)
)
>
180
:
time
.
sleep
(
180
)
time
.
sleep
(
180
)
else
:
else
:
break
break
...
...
result.txt
View file @
9b558d2c
This diff is collapsed.
Click to expand it.
start.py
View file @
9b558d2c
...
@@ -15,8 +15,8 @@ def writeToFile(path,data,type=1): #1:代表追加 0:代表覆盖
...
@@ -15,8 +15,8 @@ def writeToFile(path,data,type=1): #1:代表追加 0:代表覆盖
with
open
(
path
,
"w"
,
encoding
=
'utf-8'
)
as
fi
:
with
open
(
path
,
"w"
,
encoding
=
'utf-8'
)
as
fi
:
fi
.
write
(
data
)
fi
.
write
(
data
)
carNums
=
1
00
#模拟器数量
carNums
=
40
00
#模拟器数量
durTime
=
600
#线程持续的时间
durTime
=
3
600
#线程持续的时间
startDin
=
202008280000
#开始的车机号
startDin
=
202008280000
#开始的车机号
info
=
{}
#存放脚本运行时的信息
info
=
{}
#存放脚本运行时的信息
info
[
"threadsObj"
]
=
{}
#用于运行线程的字典
info
[
"threadsObj"
]
=
{}
#用于运行线程的字典
...
@@ -34,7 +34,7 @@ def startSimulaterService():
...
@@ -34,7 +34,7 @@ def startSimulaterService():
autoCarObj
.
setHost
(
"172.19.7.6"
)
autoCarObj
.
setHost
(
"172.19.7.6"
)
autoCarObj
.
setPort
(
49008
)
autoCarObj
.
setPort
(
49008
)
autoCarObj
.
setInfo
(
info
)
autoCarObj
.
setInfo
(
info
)
autoCarObj
.
setSendDur
(
1
)
autoCarObj
.
setSendDur
(
5
)
autoCarObj
.
setCarId
(
carId
)
autoCarObj
.
setCarId
(
carId
)
autoCarObj
.
setDurTime
(
durTime
)
autoCarObj
.
setDurTime
(
durTime
)
threadId
=
"thread_"
+
str
(
i
)
threadId
=
"thread_"
+
str
(
i
)
...
...
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