Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Rousselle
bliss
Commits
6ed99602
Commit
6ed99602
authored
Dec 02, 2016
by
Jose Tiago Macara Coutinho
Browse files
wip 1
parent
d60d63db
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/flowbus/flowbus.py
View file @
6ed99602
...
...
@@ -315,11 +315,13 @@ TYPE_MAP = {
class
Param
(
object
):
def
__init__
(
self
,
param_info
):
def
__init__
(
self
,
param_info
,
encode
=
None
,
decode
=
None
):
self
.
info
=
param_info
dtype
=
TYPE_MAP
[
param_info
[
'type'
]]
self
.
info
[
'dtype'
]
=
dtype
self
.
name
=
param_info
[
'DDE'
]
self
.
encode
=
encode
self
.
decode
=
decode
def
__getitem__
(
self
,
item
):
return
self
.
info
[
item
]
...
...
@@ -330,19 +332,17 @@ class Param(object):
result
=
obj
.
putget
(
cmd
)
_check_error
(
result
)
value
=
decode
(
result
,
dtype
=
dtype
)
scale
=
self
[
'scale'
]
if
scale
:
value
/=
scale
if
self
.
decode
:
value
=
self
.
decode
(
value
)
obj
.
cache
[
self
.
name
]
=
value
return
value
def
write
(
self
,
obj
,
value
):
scale
=
self
[
'scale'
]
dtype
=
self
[
'dtype'
]
if
s
cale
is
not
Non
e
:
value
*
=
s
cale
if
dtype
!=
DataType
.
FLOAT32
:
value
=
int
(
value
)
if
s
elf
.
encod
e
:
value
=
s
elf
.
encode
(
value
)
el
if
dtype
!=
DataType
.
FLOAT32
:
value
=
int
(
value
)
cmd
=
encode_write
(
obj
.
node
,
self
[
'process'
],
self
[
'parameter'
],
dtype
,
value
)
result
=
obj
.
putget
(
cmd
)
...
...
@@ -371,6 +371,9 @@ class Param(object):
return
self
.
set
(
obj
,
value
)
from
.mapping
import
PARAM_DDE_MAP
class
FlowBusNode
(
object
):
def
__init__
(
self
,
flowbus
,
node
,
auto_init
=
True
):
...
...
@@ -388,13 +391,11 @@ class FlowBusNode(object):
assert
(
self
.
node
==
pna
)
def
__str__
(
self
):
return
'Node(pna={0.pna}, nna={0.nna}, type={0.DeviceType}, '
\
'model={0.ModelNum}, ID={0.identstrng}, SerialNb={0.SerialNum})'
\
return
'Node(pna={0.pna}, nna={0.nna}, ID={0.identstrng})'
\
.
format
(
self
)
def
__repr__
(
self
):
return
'FlowBusNode(pna={0.pna}, nna={0.nna}, type={0.DeviceType}, '
\
'model={0.ModelNum}, ID={0.identstrng}, SerialNb={0.SerialNum}) '
\
return
'FlowBusNode(pna={0.pna}, nna={0.nna}, ID={0.identstrng}) '
\
'object at 0x{1:x}'
.
format
(
self
,
id
(
self
))
def
putget
(
self
,
cmd
):
...
...
@@ -404,8 +405,8 @@ class FlowBusNode(object):
def
flowbus
(
self
):
return
self
.
__flowbus
()
identstrng
=
Param
(
PARAM_DDE_MAP
[
'identstrng'
],
decode
=
lambda
x
:
x
[
1
:])
from
.mapping
import
PARAM_DDE_MAP
for
param_name
,
param_info
in
PARAM_DDE_MAP
.
items
():
if
hasattr
(
FlowBusNode
,
param_name
):
...
...
bliss/controllers/flowbus/mapping.py
View file @
6ed99602
This diff is collapsed.
Click to expand it.
bliss/controllers/flowbus/parameter_properties.csv
View file @
6ed99602
This diff is collapsed.
Click to expand it.
bliss/controllers/flowbus/parameter_properties.ods
deleted
100644 → 0
View file @
d60d63db
File deleted
Write
Preview
Supports
Markdown
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