Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VILLASnode
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
VILLASframework
VILLASnode
Commits
6ce9b47f
Commit
6ce9b47f
authored
7 years ago
by
Steffen Vogel
Browse files
Options
Downloads
Patches
Plain Diff
iec61850-9-2: added type descriptors
parent
2be839ea
Branches
Hotfix/xxxx-lock
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/villas/nodes/iec61850_sv.h
+15
-0
15 additions, 0 deletions
include/villas/nodes/iec61850_sv.h
lib/nodes/iec61850_sv.c
+47
-0
47 additions, 0 deletions
lib/nodes/iec61850_sv.c
with
62 additions
and
0 deletions
include/villas/nodes/iec61850_sv.h
+
15
−
0
View file @
6ce9b47f
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include
"list.h"
#include
"list.h"
enum
{
enum
{
/* According to IEC 61850-7-2 */
IEC61850_TYPE_BOOLEAN
,
IEC61850_TYPE_BOOLEAN
,
IEC61850_TYPE_INT8
,
IEC61850_TYPE_INT8
,
IEC61850_TYPE_INT16
,
IEC61850_TYPE_INT16
,
...
@@ -52,11 +53,25 @@ enum {
...
@@ -52,11 +53,25 @@ enum {
IEC61850_TYPE_CODED_ENUM
,
IEC61850_TYPE_CODED_ENUM
,
IEC61850_TYPE_OCTET_STRING
,
IEC61850_TYPE_OCTET_STRING
,
IEC61850_TYPE_VISIBLE_STRING
,
IEC61850_TYPE_VISIBLE_STRING
,
IEC61850_TYPE_OBJECTNAME
,
IEC61850_TYPE_OBJECTREFERENCE
,
IEC61850_TYPE_TIMESTAMP
,
IEC61850_TYPE_TIMESTAMP
,
IEC61850_TYPE_ENTRYTIME
,
IEC61850_TYPE_ENTRYTIME
,
/* According to IEC 61850-8-1 */
IEC61850_TYPE_BITSTRING
IEC61850_TYPE_BITSTRING
}
type
;
}
type
;
struct
iec61850_type_descriptor
{
enum
iec61850_type
type
;
const
char
*
name
;
unsigned
size
;
/* Functions pointers */
double
(
*
subscriber_get
)(
SVClientASDU
self
,
int
index
);
int
(
*
publisher_add
)(
SV_ASDU
self
);
void
(
*
publisher_set
)(
SV_ASDU
self
,
int
index
,
int8_t
value
);
};
struct
iec61850_sv_mapping
{
struct
iec61850_sv_mapping
{
SV_ASDU
*
asdu
;
SV_ASDU
*
asdu
;
...
...
This diff is collapsed.
Click to expand it.
lib/nodes/iec61850_sv.c
+
47
−
0
View file @
6ce9b47f
...
@@ -25,6 +25,39 @@
...
@@ -25,6 +25,39 @@
#include
"nodes/iec61850_sv.h"
#include
"nodes/iec61850_sv.h"
#include
"plugin.h"
#include
"plugin.h"
struct
iec61850_type_descriptor
type_descrptors
[]
=
{
[
IEC61850_TYPE_BOOLEAN
]
=
{
"boolean"
,
1
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_INT8
]
=
{
"int8"
,
1
,
SVClientASDU_getINT8
,
SV_ASDU_addINT8
,
SV_ASDU_setINT8
},
[
IEC61850_TYPE_INT16
]
=
{
"int16"
,
2
,
SVClientASDU_getINT16
,
NULL
,
NULL
},
[
IEC61850_TYPE_INT32
]
=
{
"int32"
,
4
,
SVClientASDU_getINT32
,
SV_ASDU_addINT32
,
SV_ASDU_setINT32
},
[
IEC61850_TYPE_INT64
]
=
{
"int64"
,
8
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_INT8U
]
=
{
"int8u"
,
1
,
SVClientASDU_getINT8U
,
NULL
,
NULL
},
[
IEC61850_TYPE_INT16U
]
=
{
"int16u"
,
2
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_INT24U
]
=
{
"int24u"
,
3
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_INT32U
]
=
{
"int32u"
,
4
,
SVClientASDU_getINT32U
,
NULL
,
NULL
},
[
IEC61850_TYPE_FLOAT32
]
=
{
"float32"
,
4
,
SVClientASDU_getFLOAT32
,
SV_ASDU_addFLOAT
,
SV_ASDU_setFLOAT
},
[
IEC61850_TYPE_FLOAT64
]
=
{
"float64"
,
8
,
SVClientASDU_getFLOAT64
,
SV_ASDU_addFLOAT64
,
SV_ASDU_setFLOAT64
},
[
IEC61850_TYPE_ENUMERATED
]
=
{
"enumerated"
,
4
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_CODED_ENUM
]
=
{
"coded_enum"
,
4
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_OCTET_STRING
]
=
{
"octect_string"
,
20
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_VISIBLE_STRING
]
=
{
"visible_string"
,
35
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_OBJECTNAME
]
=
{
"objectname"
20
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_OBJECTREFERENCE
]
=
{
"objectreference"
,
20
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_TIMESTAMP
]
=
{
"timestamp"
,
8
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_ENTRYTIME
]
=
{
"entrytime"
,
6
,
NULL
,
NULL
,
NULL
},
[
IEC61850_TYPE_BITSTRING
]
=
{
"bitstring"
,
4
,
NULL
,
NULL
,
NULL
}
};
struct
iec61850_type_descriptor
*
iec61850_type_lookup
(
const
char
*
name
)
{
for
(
int
i
=
0
;
i
<
ARRAY_LEN
(
type_descriptors
);
i
++
)
{
if
(
!
strcmp
(
name
,
type_descriptors
[
i
].
name
))
return
&
type_descriptors
[
i
];
}
return
NULL
;
}
int
iec61850_sv_reverse
(
struct
node
*
n
)
int
iec61850_sv_reverse
(
struct
node
*
n
)
{
{
struct
iec61850_sv
*
i
__attribute__
((
unused
))
=
n
->
_vd
;
struct
iec61850_sv
*
i
__attribute__
((
unused
))
=
n
->
_vd
;
...
@@ -35,6 +68,20 @@ int iec61850_sv_reverse(struct node *n)
...
@@ -35,6 +68,20 @@ int iec61850_sv_reverse(struct node *n)
int
iec61850_sv_parse
(
struct
node
*
n
,
config_setting_t
*
cfg
)
int
iec61850_sv_parse
(
struct
node
*
n
,
config_setting_t
*
cfg
)
{
{
struct
iec61850_sv
*
i
__attribute__
((
unused
))
=
n
->
_vd
;
struct
iec61850_sv
*
i
__attribute__
((
unused
))
=
n
->
_vd
;
config_setting_t
*
cfg_in
,
*
cfg_out
;
cfg_in
=
config_setting_get_member
(
cfg
,
"in"
);
if
(
cfg_in
)
{
if
()
cerror
(
cfg_out
,
"Failed to parse input for node %s"
,
node_name
(
n
));
}
cfg_out
=
config_setting_get_member
(
cfg
,
"out"
);
if
(
cfg_out
)
{
if
()
cerror
(
cfg_out
,
"Failed to parse output for node %s"
,
node_name
(
n
));
}
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment