libIEC61850
0.8.2
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
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
char
*
variableName
;
190
int
index
;
191
char
*
componentName
;
192
MmsValue
*
value
;
193
struct
sDataSetEntry*
sibling
;
194
}
DataSetEntry
;
195
196
struct
sDataSet
{
197
char
*
logicalDeviceName
;
198
char
*
name
;
/* eg. MMXU1$dataset1 */
199
int
elementCount
;
200
DataSetEntry
*
fcdas
;
201
DataSet*
sibling
;
202
};
203
204
struct
sReportControlBlock
{
205
LogicalNode*
parent
;
206
char
*
name
;
207
char
*
rptId
;
208
bool
buffered
;
209
char
*
dataSetName
;
/* pre loaded with relative name in logical node */
210
211
uint32_t
confRef
;
/* ConfRef - configuration revision */
212
uint8_t
trgOps
;
/* TrgOps - trigger conditions */
213
uint8_t
options
;
/* OptFlds */
214
uint32_t
bufferTime
;
/* BufTm - time to buffer events until a report is generated */
215
uint32_t
intPeriod
;
/* IntgPd - integrity period */
216
217
ReportControlBlock*
sibling
;
/* next control block in list or NULL if this is the last entry */
218
};
219
220
struct
sSettingGroupControlBlock
{
221
LogicalNode*
parent
;
222
223
uint8_t
actSG
;
/* value from SCL file */
224
uint8_t
numOfSGs
;
/* value from SCL file */
225
226
uint8_t
editSG
;
/* 0 at power-up */
227
bool
cnfEdit
;
/* false at power-up */
228
uint64_t
timestamp
;
229
uint16_t
resvTms
;
230
231
SettingGroupControlBlock*
sibling
;
/* next control block in list or NULL if this is the last entry */
232
};
233
234
typedef
struct
{
235
uint8_t
vlanPriority
;
236
uint16_t
vlanId
;
237
uint16_t
appId
;
238
uint8_t dstAddress[6];
239
}
PhyComAddress
;
240
241
struct
sGSEControlBlock
{
242
LogicalNode*
parent
;
243
char
*
name
;
244
char
*
appId
;
245
char
*
dataSetName
;
/* pre loaded with relative name in logical node */
246
uint32_t
confRef
;
/* ConfRef - configuration revision */
247
bool
fixedOffs
;
/* fixed offsets */
248
PhyComAddress
*
address
;
/* GSE communication parameters */
249
250
GSEControlBlock*
sibling
;
/* next control block in list or NULL if this is the last entry */
251
};
252
261
int
262
ModelNode_getChildCount
(ModelNode* modelNode);
263
272
ModelNode*
273
ModelNode_getChild
(ModelNode* modelNode,
const
char
* name);
274
284
char
*
285
ModelNode_getObjectReference
(ModelNode* node,
char
* objectReference);
286
296
void
297
IedModel_setIedName
(IedModel*
self
,
const
char
* iedName);
298
311
ModelNode*
312
IedModel_getModelNodeByObjectReference
(IedModel* model,
const
char
* objectReference);
313
326
ModelNode*
327
IedModel_getModelNodeByShortObjectReference
(IedModel* model,
const
char
* objectReference);
328
340
ModelNode*
341
IedModel_getModelNodeByShortAddress
(IedModel* model, uint32_t shortAddress);
342
351
LogicalNode*
352
LogicalDevice_getLogicalNode
(LogicalDevice* device,
const
char
* lnName);
353
361
SettingGroupControlBlock*
362
LogicalDevice_getSettingGroupControlBlock
(LogicalDevice* device);
363
374
void
375
IedModel_setAttributeValuesToNull
(IedModel* iedModel);
376
377
LogicalDevice*
378
IedModel_getDevice
(IedModel* model,
const
char
* deviceName);
379
380
/*
381
* \param dataSetReference MMS mapping object reference! e.g. ied1Inverter/LLN0$dataset1
382
*/
383
DataSet*
384
IedModel_lookupDataSet
(IedModel* model,
const
char
* dataSetReference);
385
386
int
387
IedModel_getLogicalDeviceCount
(IedModel* iedModel);
388
389
int
390
LogicalDevice_getLogicalNodeCount
(LogicalDevice* logicalDevice);
391
392
bool
393
LogicalNode_hasFCData
(LogicalNode* node,
FunctionalConstraint
fc);
394
395
bool
396
LogicalNode_hasBufferedReports
(LogicalNode* node);
397
398
bool
399
LogicalNode_hasUnbufferedReports
(LogicalNode* node);
400
401
bool
402
DataObject_hasFCData
(DataObject* dataObject,
FunctionalConstraint
fc);
403
404
DataAttribute*
405
IedModel_lookupDataAttributeByMmsValue
(IedModel* model,
MmsValue
* value);
406
407
#ifdef __cplusplus
408
}
409
#endif
410
411
412
#endif
/* MODEL_H_ */
Generated on Tue Nov 25 2014 15:20:11 for libIEC61850 by
1.8.4