Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nrm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
argo
nrm
Commits
e992a7f1
Commit
e992a7f1
authored
Dec 05, 2018
by
Valentin Reis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logging power, works.
parent
42999a1f
Pipeline
#4560
failed with stages
in 2 minutes and 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
20 deletions
+26
-20
nrm/controller.py
nrm/controller.py
+25
-19
nrm/daemon.py
nrm/daemon.py
+1
-1
No files found.
nrm/controller.py
View file @
e992a7f1
from
__future__
import
print_function
import
logging
import
time
logger
=
logging
.
getLogger
(
'nrm'
)
logger_power
=
logging
.
getLogger
(
'power'
)
class
Action
(
object
):
...
...
@@ -55,24 +56,29 @@ class Controller(object):
def
planify
(
self
,
target
,
machineinfo
):
"""Plan the next action for the control loop."""
total_power
=
machineinfo
[
'energy'
][
'power'
][
'total'
]
direction
=
None
if
total_power
<
target
:
direction
=
'i'
elif
total_power
>
target
:
direction
=
'd'
if
direction
:
actions
=
[]
for
act
in
self
.
actuators
:
newactions
=
act
.
available_actions
(
direction
)
actions
.
extend
([(
a
,
act
)
for
a
in
newactions
])
if
actions
:
# TODO: better choice
actions
.
sort
(
key
=
lambda
x
:
x
[
0
].
delta
)
return
actions
.
pop
(
0
)
else
:
return
(
None
,
None
)
# current_e = float(machineinfo['energy']['energy']['cumulative']['package-0'])/(1000*1000) # in joules
current_p
=
float
(
machineinfo
[
'energy'
][
'power'
][
'p0'
])
/
(
1000
*
1000
)
# in joules
current_p
=
float
(
machineinfo
[
'energy'
][
'power'
][
'p1'
])
/
(
1000
*
1000
)
# in joules
logger_power
.
info
(
"%s %s %s"
%
(
time
.
time
(),
current_p
,
current_p
))
return
(
None
,
None
)
# direction = None
# if total_power < target:
# direction = 'i'
# elif total_power > target:
# direction = 'd'
# if direction:
# actions = []
# for act in self.actuators:
# newactions = act.available_actions(direction)
# actions.extend([(a, act) for a in newactions])
# if actions:
# # TODO: better choice
# actions.sort(key=lambda x: x[0].delta)
# return actions.pop(0)
# else:
# return (None, None)
def
execute
(
self
,
action
,
actuator
):
"""Build the action for the appropriate manager."""
...
...
nrm/daemon.py
View file @
e992a7f1
...
...
@@ -20,7 +20,7 @@ RPC_MSG = MSGTYPES['up_rpc_rep']
PUB_MSG
=
MSGTYPES
[
'up_pub'
]
logger
=
logging
.
getLogger
(
'nrm'
)
logger_power
=
logging
.
getLogger
(
'power'
)
class
Daemon
(
object
):
...
...
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