- added support for data sets that span multiple logical devices with server configuration file (see feature #271)

This commit is contained in:
Michael Zillgith 2015-01-19 14:29:03 +01:00
parent b04b11d886
commit 8cfb9d99a0
8 changed files with 67 additions and 10 deletions

View file

@ -1,7 +1,6 @@
MODEL(simpleIO){
LD(GenericIO){
LN(LLN0){
SG(1 2)
DO(Mod 0){
DA(q 0 23 0 2 0);
DA(t 0 22 0 0 0);
@ -36,7 +35,7 @@ DE(GGIO1$MX$AnIn2);
DE(GGIO1$MX$AnIn3);
DE(GGIO1$MX$AnIn4);
}
RC(EventsRCB01 - 0 Events 1 8 111 50 1000);
RC(EventsRCB01 Events 0 Events 1 8 111 50 1000);
RC(AnalogValuesRCB01 AnalogValues 0 AnalogValues 1 8 111 50 1000);
GC(gcbEvents events Events 2 0){
PA(4 111 1000 010ccd010001);

View file

@ -219,7 +219,8 @@ INPUT += "iec61850/inc/iec61850_config_file_parser.h"
INPUT += "iec61850/inc/iec61850_cdc.h"
INPUT += "goose/goose_subscriber.h"
INPUT += "mms/inc/mms_device_model.h"
INPUT += "mms/inc/mms_types.h"
INPUT += "mms/inc/mms_types.h"
INPUT += "mms/inc/mms_common.h"
INPUT += "mms/inc/mms_server.h"
INPUT += "mms/inc/iso_server.h"
INPUT += "mms/inc/mms_named_variable_list.h"

View file

@ -238,7 +238,7 @@ DataSetEntry_getNext(DataSetEntry* self);
* \return the new data set entry instance
*/
DataSetEntry*
DataSetEntry_create(DataSet* dataSet, char* variable, int index, char* component);
DataSetEntry_create(DataSet* dataSet, const char* variable, int index, const char* component);
/**@}*/

View file

@ -186,6 +186,7 @@ struct sDataAttribute {
typedef struct sDataSetEntry {
char* logicalDeviceName;
bool isLDNameDynamicallyAllocated;
char* variableName;
int index;
char* componentName;

View file

@ -514,11 +514,28 @@ DataSet_addEntry(DataSet* self, DataSetEntry* newEntry)
}
DataSetEntry*
DataSetEntry_create(DataSet* dataSet, char* variable, int index, char* component)
DataSetEntry_create(DataSet* dataSet, const char* variable, int index, const char* component)
{
DataSetEntry* self = (DataSetEntry*) GLOBAL_MALLOC(sizeof(DataSetEntry));
self->variableName = copyString(variable);
char variableName[130];
strncpy(variableName, variable, 129);
char* separator = strchr(variableName, '/');
if (separator != NULL) {
*separator = 0;
self->variableName = copyString(separator + 1);
self->logicalDeviceName = copyString(variableName);
self->isLDNameDynamicallyAllocated = true;
}
else {
self->variableName = copyString(variable);
self->logicalDeviceName = dataSet->logicalDeviceName;
self->isLDNameDynamicallyAllocated = false;
}
if (component != NULL)
self->componentName = copyString(component);
@ -526,7 +543,7 @@ DataSetEntry_create(DataSet* dataSet, char* variable, int index, char* component
self->componentName = NULL;
self->index = index;
self->logicalDeviceName = dataSet->logicalDeviceName;
self->sibling = NULL;
DataSet_addEntry(dataSet, self);
@ -622,6 +639,9 @@ IedModel_destroy(IedModel* model)
GLOBAL_FREEMEM(dse->variableName);
if (dse->isLDNameDynamicallyAllocated)
GLOBAL_FREEMEM(dse->logicalDeviceName);
GLOBAL_FREEMEM(dse);
dse = nextDse;

View file

@ -42,6 +42,13 @@ typedef enum
MMS_ERROR, MMS_INITIATE, MMS_CONFIRMED_REQUEST, MMS_OK, MMS_CONCLUDE
} MmsIndication;
/**
* \addtogroup common_api_group
*/
/**@{*/
typedef enum
{
/* generic error codes */
@ -107,21 +114,33 @@ typedef enum
typedef enum ATTRIBUTE_PACKED
{
/*! this represents all MMS array types (arrays contain uniform elements) */
MMS_ARRAY = 0,
/*! this represents all complex MMS types (structures) */
MMS_STRUCTURE = 1,
/*! boolean value */
MMS_BOOLEAN = 2,
/*! bit string */
MMS_BIT_STRING = 3,
/*! represents all signed integer types */
MMS_INTEGER = 4,
/*! represents all unsigned integer types */
MMS_UNSIGNED = 5,
/*! represents all float type (32 and 64 bit) */
MMS_FLOAT = 6,
/*! octet string (unstructured bytes) */
MMS_OCTET_STRING = 7,
/*! MMS visible string */
MMS_VISIBLE_STRING = 8,
MMS_GENERALIZED_TIME = 9,
MMS_BINARY_TIME = 10,
MMS_BCD = 11,
MMS_OBJ_ID = 12,
/*! MMS unicode string */
MMS_STRING = 13,
/*! MMS UTC time type */
MMS_UTC_TIME = 14,
/*! This represents an error code as returned by MMS read services */
MMS_DATA_ACCESS_ERROR = 15
} MmsType;
@ -146,6 +165,9 @@ typedef struct
typedef struct sMmsNamedVariableList* MmsNamedVariableList;
typedef struct sMmsAccessSpecifier* MmsNamedVariableListEntry;
/**@}*/
#ifdef __cplusplus
}
#endif

Binary file not shown.

View file

@ -122,7 +122,7 @@ public class DynamicModelGenerator {
}
for (DataSet dataSet : logicalNode.getDataSets())
exportDataSet(output, dataSet);
exportDataSet(output, dataSet, logicalNode);
for (ReportControlBlock rcb : logicalNode.getReportControlBlocks()) {
@ -217,7 +217,7 @@ public class DynamicModelGenerator {
output.println(");");
}
private void exportDataSet(PrintStream output, DataSet dataSet) {
private void exportDataSet(PrintStream output, DataSet dataSet, LogicalNode logicalNode) {
output.print("DS(" + dataSet.getName() + "){\n");
for (FunctionalConstraintData fcda : dataSet.getFcda()) {
String mmsVariableName = "";
@ -237,7 +237,21 @@ public class DynamicModelGenerator {
if (fcda.getDaName() != null)
mmsVariableName += "$" + toMmsString(fcda.getDaName());
output.print("DE(" + mmsVariableName + ");\n");
String logicalDeviceName = null;
if (fcda.getLdInstance() != null) {
if (!fcda.getLdInstance().equals(logicalNode.getParentLogicalDevice().getInst())) {
logicalDeviceName = fcda.getLdInstance();
}
}
if (logicalDeviceName != null)
output.print("DE(" + logicalDeviceName + "/" + mmsVariableName + ");\n");
else
output.print("DE(" + mmsVariableName + ");\n");
}
output.println("}");
}