libIEC61850
0.8.4
Open-source IEC 61850 MMS/GOOSE server and client library
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
iec61850
inc
iec61850_model.h
Go to the documentation of this file.
1
/*
2
* model.h
3
*
4
* Copyright 2013, 2014 Michael Zillgith
5
*
6
* This file is part of libIEC61850.
7
*
8
* libIEC61850 is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* libIEC61850 is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
20
*
21
* See COPYING file for the complete license text.
22
*/
23
24
#ifndef MODEL_H_
25
#define MODEL_H_
26
27
#include "
iec61850_common.h
"
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
46
typedef
struct
sModelNode
ModelNode;
47
51
typedef
struct
sDataAttribute
DataAttribute;
52
56
typedef
struct
sDataObject
DataObject;
57
61
typedef
struct
sLogicalNode
LogicalNode;
62
66
typedef
struct
sLogicalDevice
LogicalDevice;
67
71
typedef
struct
sIedModel
IedModel;
72
73
typedef
struct
sDataSet
DataSet;
74
typedef
struct
sReportControlBlock
ReportControlBlock;
75
79
typedef
struct
sSettingGroupControlBlock
SettingGroupControlBlock;
80
81
typedef
struct
sGSEControlBlock
GSEControlBlock;
82
83
84
typedef
enum
{
85
BOOLEAN
= 0,
/* int */
86
INT8
= 1,
/* int8_t */
87
INT16
= 2,
/* int16_t */
88
INT32
= 3,
/* int32_t */
89
INT64
= 4,
/* int64_t */
90
INT128
= 5,
/* no native mapping! */
91
INT8U
= 6,
/* uint8_t */
92
INT16U
= 7,
/* uint16_t */
93
INT24U
= 8,
/* uint32_t */
94
INT32U
= 9,
/* uint32_t */
95
FLOAT32
= 10,
/* float */
96
FLOAT64
= 11,
/* double */
97
ENUMERATED
= 12,
98
OCTET_STRING_64
= 13,
99
OCTET_STRING_6
= 14,
100
OCTET_STRING_8
= 15,
101
VISIBLE_STRING_32
= 16,
102
VISIBLE_STRING_64
= 17,
103
VISIBLE_STRING_65
= 18,
104
VISIBLE_STRING_129
= 19,
105
VISIBLE_STRING_255
= 20,
106
UNICODE_STRING_255
= 21,
107
TIMESTAMP
= 22,
108
QUALITY
= 23,
109
CHECK
= 24,
110
CODEDENUM
= 25,
111
GENERIC_BITSTRING
= 26,
112
CONSTRUCTED
= 27,
113
ENTRY_TIME
= 28,
114
PHYCOMADDR
= 29
115
}
DataAttributeType
;
116
117
typedef
enum
{
118
LogicalDeviceModelType
,
119
LogicalNodeModelType
,
120
DataObjectModelType
,
121
DataAttributeModelType
122
}
ModelNodeType
;
123
124
struct
sIedModel
{
125
char
*
name
;
126
LogicalDevice*
firstChild
;
127
DataSet*
dataSets
;
128
ReportControlBlock*
rcbs
;
129
GSEControlBlock*
gseCBs
;
130
SettingGroupControlBlock*
sgcbs
;
131
void (*
initializer
) (void);
132
};
133
134
struct
sLogicalDevice
{
135
ModelNodeType
modelType
;
136
char
*
name
;
137
ModelNode*
parent
;
138
ModelNode*
sibling
;
139
ModelNode*
firstChild
;
140
};
141
142
struct
sModelNode
{
143
ModelNodeType
modelType
;
144
char
*
name
;
145
ModelNode*
parent
;
146
ModelNode*
sibling
;
147
ModelNode*
firstChild
;
148
};
149
150
struct
sLogicalNode
{
151
ModelNodeType
modelType
;
152
char
*
name
;
153
ModelNode*
parent
;
154
ModelNode*
sibling
;
155
ModelNode*
firstChild
;
156
};
157
158
struct
sDataObject
{
159
ModelNodeType
modelType
;
160
char
*
name
;
161
ModelNode*
parent
;
162
ModelNode*
sibling
;
163
ModelNode*
firstChild
;
164
165
int
elementCount
;
/* > 0 if this is an array */
166
};
167
168
struct
sDataAttribute
{
169
ModelNodeType
modelType
;
170
char
*
name
;
171
ModelNode*
parent
;
172
ModelNode*
sibling
;
173
ModelNode*
firstChild
;
174
175
int
elementCount
;
/* > 0 if this is an array */
176
177
FunctionalConstraint
fc
;
178
DataAttributeType
type
;
179
180
uint8_t
triggerOptions
;
/* TRG_OPT_DATA_CHANGED | TRG_OPT_QUALITY_CHANGED | TRG_OPT_DATA_UPDATE */
181
182
MmsValue
*
mmsValue
;
183
184
uint32_t
sAddr
;
185
};
186
187
typedef
struct
sDataSetEntry {
188
char
*
logicalDeviceName
;
189
bool
isLDNameDynamicallyAllocated
;
190
char
*
variableName
;
191
int
index
;
192
char
*
componentName
;
193
MmsValue
*
value
;
194
struct
sDataSetEntry*
sibling
;
195
}
DataSetEntry
;
196
197
struct
sDataSet
{
198
char
*
logicalDeviceName
;
199
char
*
name
;
/* eg. MMXU1$dataset1 */
200
int
elementCount
;
201
DataSetEntry
*
fcdas
;
202
DataSet*
sibling
;
203
};
204
205
struct
sReportControlBlock
{
206
LogicalNode*
parent
;
207
char
*
name
;
208
char
*
rptId
;
209
bool
buffered
;
210
char
*
dataSetName
;
/* pre loaded with relative name in logical node */
211
212
uint32_t
confRef
;
/* ConfRef - configuration revision */
213
uint8_t
trgOps
;
/* TrgOps - trigger conditions */
214
uint8_t
options
;
/* OptFlds */
215
uint32_t
bufferTime
;
/* BufTm - time to buffer events until a report is generated */
216
uint32_t
intPeriod
;
/* IntgPd - integrity period */
217
218
ReportControlBlock*
sibling
;
/* next control block in list or NULL if this is the last entry */
219
};
220
221
struct
sSettingGroupControlBlock
{
222
LogicalNode*
parent
;
223
224
uint8_t
actSG
;
/* value from SCL file */
225
uint8_t
numOfSGs
;
/* value from SCL file */
226
227
uint8_t
editSG
;
/* 0 at power-up */
228
bool
cnfEdit
;
/* false at power-up */
229
uint64_t
timestamp
;
230
uint16_t
resvTms
;
231
232
SettingGroupControlBlock*
sibling
;
/* next control block in list or NULL if this is the last entry */
233
};
234
235
typedef
struct
{
236
uint8_t
vlanPriority
;
237
uint16_t
vlanId
;
238
uint16_t
appId
;
239
uint8_t dstAddress[6];
240
}
PhyComAddress
;
241
242
struct
sGSEControlBlock
{
243
LogicalNode*
parent
;
244
char
*
name
;
245
char
*
appId
;
246
char
*
dataSetName
;
/* pre loaded with relative name in logical node */
247
uint32_t
confRef
;
/* ConfRef - configuration revision */
248
bool
fixedOffs
;
/* fixed offsets */
249
PhyComAddress
*
address
;
/* GSE communication parameters */
250
251
GSEControlBlock*
sibling
;
/* next control block in list or NULL if this is the last entry */
252
};
253
262
int
263
ModelNode_getChildCount
(ModelNode*
self
);
264
273
ModelNode*
274
ModelNode_getChild
(ModelNode*
self
,
const
char
* name);
275
289
ModelNode*
290
ModelNode_getChildWithFc
(ModelNode*
self
,
const
char
* name,
FunctionalConstraint
fc);
291
301
char
*
302
ModelNode_getObjectReference
(ModelNode*
self
,
char
* objectReference);
303
313
void
314
IedModel_setIedName
(IedModel*
self
,
const
char
* iedName);
315
328
ModelNode*
329
IedModel_getModelNodeByObjectReference
(IedModel* model,
const
char
* objectReference);
330
343
ModelNode*
344
IedModel_getModelNodeByShortObjectReference
(IedModel* model,
const
char
* objectReference);
345
357
ModelNode*
358
IedModel_getModelNodeByShortAddress
(IedModel* model, uint32_t shortAddress);
359
368
LogicalNode*
369
LogicalDevice_getLogicalNode
(LogicalDevice* device,
const
char
* lnName);
370
378
SettingGroupControlBlock*
379
LogicalDevice_getSettingGroupControlBlock
(LogicalDevice* device);
380
391
void
392
IedModel_setAttributeValuesToNull
(IedModel* iedModel);
393
394
LogicalDevice*
395
IedModel_getDevice
(IedModel* model,
const
char
* deviceName);
396
397
/*
398
* \param dataSetReference MMS mapping object reference! e.g. ied1Inverter/LLN0$dataset1
399
*/
400
DataSet*
401
IedModel_lookupDataSet
(IedModel* model,
const
char
* dataSetReference);
402
403
int
404
IedModel_getLogicalDeviceCount
(IedModel* iedModel);
405
406
int
407
LogicalDevice_getLogicalNodeCount
(LogicalDevice* logicalDevice);
408
409
bool
410
LogicalNode_hasFCData
(LogicalNode* node,
FunctionalConstraint
fc);
411
412
bool
413
LogicalNode_hasBufferedReports
(LogicalNode* node);
414
415
bool
416
LogicalNode_hasUnbufferedReports
(LogicalNode* node);
417
418
bool
419
DataObject_hasFCData
(DataObject* dataObject,
FunctionalConstraint
fc);
420
421
DataAttribute*
422
IedModel_lookupDataAttributeByMmsValue
(IedModel* model,
MmsValue
* value);
423
424
#ifdef __cplusplus
425
}
426
#endif
427
428
429
#endif
/* MODEL_H_ */
Generated on Mon Feb 9 2015 11:48:53 for libIEC61850 by
1.8.4