Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
c62f5d5f
Commit
c62f5d5f
authored
Nov 29, 2011
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #106 from cakeller98/Time_Estimater
Fixed the time estimator in pronsole.py
parents
02f14d50
cc40719e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
45 deletions
+48
-45
pronsole.py
pronsole.py
+48
-45
No files found.
pronsole.py
View file @
c62f5d5f
...
@@ -90,22 +90,26 @@ def get_coordinate_value(axis, parts):
...
@@ -90,22 +90,26 @@ def get_coordinate_value(axis, parts):
def
estimate_duration
(
g
):
def
estimate_duration
(
g
):
extra_cost_per_movement
=
0.02
extra_cost_per_movement
=
0.02
total_duration
=
0
total_duration
=
0.0
feedrate
=
0
feedrate
=
0.0
X_last_position
=
0
avg_feedrate
=
0.0
Y_last_position
=
0
last_feedrate
=
0.0
X_last_position
=
0.0
Y_last_position
=
0.0
Z_last_position
=
0.0
for
i
in
g
:
for
i
in
g
:
i
=
i
.
split
(
";"
)[
0
]
i
=
i
.
split
(
";"
)[
0
]
if
"G1"
in
i
and
(
"X"
in
i
or
"Y"
in
i
or
"F"
in
i
or
"E"
in
i
):
if
"G1"
in
i
and
(
"X"
in
i
or
"Y"
in
i
or
"F"
in
i
or
"E"
in
i
):
#if "G1" in i and ("X" in i or "Y" in i or "Z" in i or "F" in i or "E" in i):
parts
=
i
.
split
(
" "
)
parts
=
i
.
split
(
" "
)
X
=
get_coordinate_value
(
"X"
,
parts
[
1
:])
X
=
get_coordinate_value
(
"X"
,
parts
[
1
:])
Y
=
get_coordinate_value
(
"Y"
,
parts
[
1
:])
Y
=
get_coordinate_value
(
"Y"
,
parts
[
1
:])
#Z = get_coordinate_value("Z", parts[1:])
F
=
get_coordinate_value
(
"F"
,
parts
[
1
:])
F
=
get_coordinate_value
(
"F"
,
parts
[
1
:])
E
=
get_coordinate_value
(
"E"
,
parts
[
1
:])
E
=
get_coordinate_value
(
"E"
,
parts
[
1
:])
if
(
F
is
not
None
):
if
(
F
is
not
None
):
feedrate
=
F
/
60
feedrate
=
(
last_feedrate
+
(
F
/
60.0
))
/
2.0
distance
=
0
distance
=
0
if
(
X
is
None
and
Y
is
None
and
E
is
not
None
):
if
(
X
is
None
and
Y
is
None
and
E
is
not
None
):
distance
=
abs
(
E
)
distance
=
abs
(
E
)
...
@@ -121,21 +125,20 @@ def estimate_duration(g):
...
@@ -121,21 +125,20 @@ def estimate_duration(g):
distance
=
sqrt
(
X_distance
*
X_distance
+
Y_distance
*
Y_distance
)
distance
=
sqrt
(
X_distance
*
X_distance
+
Y_distance
*
Y_distance
)
X_last_position
=
X
X_last_position
=
X
Y_last_position
=
Y
Y_last_position
=
Y
#if (Z is not None):
# Z_distance = Z - Z_last_position
# if not(distance == 0.0):
# distance = sqrt(Z_distance * Z_distance + distance * distance )
# else:
# distance = Z_distance
# Z_last_position = Z
if
(
feedrate
==
0
or
distance
==
0
):
continue
if
(
feedrate
==
0.0
or
distance
==
0.
0
):
continue
time_for_move
=
distance
/
feedrate
time_for_move
=
distance
/
feedrate
acceleration
=
feedrate
/
time_for_move
total_duration
+=
time_for_move
+
extra_cost_per_movement
halfway_feedrate
=
acceleration
*
time_for_move
/
2
if
(
F
is
not
None
):
feedrate
=
F
/
60.0
duration
=
halfway_feedrate
*
2
/
acceleration
return
time
.
strftime
(
'
%
H:
%
M:
%
S'
,
time
.
gmtime
(
total_duration
/
60.0
))
total_duration
+=
duration
+
extra_cost_per_movement
mod_minutes
=
total_duration
%
(
60
*
60
)
mod_seconds
=
mod_minutes
%
60
return
"{0:02d}h{1:02d}m"
.
format
(
int
((
total_duration
-
mod_minutes
)
/
(
60
*
60
)),
int
((
mod_minutes
-
mod_seconds
)
/
60
))
class
Settings
:
class
Settings
:
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
#def _temperature_validate(self,v):
#def _temperature_validate(self,v):
...
...
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