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

pull/6/head
Michael Zillgith 11 years ago
parent b04b11d886
commit 8cfb9d99a0

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

@ -220,6 +220,7 @@ INPUT += "iec61850/inc/iec61850_cdc.h"
INPUT += "goose/goose_subscriber.h" INPUT += "goose/goose_subscriber.h"
INPUT += "mms/inc/mms_device_model.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/mms_server.h"
INPUT += "mms/inc/iso_server.h" INPUT += "mms/inc/iso_server.h"
INPUT += "mms/inc/mms_named_variable_list.h" INPUT += "mms/inc/mms_named_variable_list.h"

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

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

@ -514,11 +514,28 @@ DataSet_addEntry(DataSet* self, DataSetEntry* newEntry)
} }
DataSetEntry* 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)); 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) if (component != NULL)
self->componentName = copyString(component); self->componentName = copyString(component);
@ -526,7 +543,7 @@ DataSetEntry_create(DataSet* dataSet, char* variable, int index, char* component
self->componentName = NULL; self->componentName = NULL;
self->index = index; self->index = index;
self->logicalDeviceName = dataSet->logicalDeviceName;
self->sibling = NULL; self->sibling = NULL;
DataSet_addEntry(dataSet, self); DataSet_addEntry(dataSet, self);
@ -622,6 +639,9 @@ IedModel_destroy(IedModel* model)
GLOBAL_FREEMEM(dse->variableName); GLOBAL_FREEMEM(dse->variableName);
if (dse->isLDNameDynamicallyAllocated)
GLOBAL_FREEMEM(dse->logicalDeviceName);
GLOBAL_FREEMEM(dse); GLOBAL_FREEMEM(dse);
dse = nextDse; dse = nextDse;

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

@ -122,7 +122,7 @@ public class DynamicModelGenerator {
} }
for (DataSet dataSet : logicalNode.getDataSets()) for (DataSet dataSet : logicalNode.getDataSets())
exportDataSet(output, dataSet); exportDataSet(output, dataSet, logicalNode);
for (ReportControlBlock rcb : logicalNode.getReportControlBlocks()) { for (ReportControlBlock rcb : logicalNode.getReportControlBlocks()) {
@ -217,7 +217,7 @@ public class DynamicModelGenerator {
output.println(");"); output.println(");");
} }
private void exportDataSet(PrintStream output, DataSet dataSet) { private void exportDataSet(PrintStream output, DataSet dataSet, LogicalNode logicalNode) {
output.print("DS(" + dataSet.getName() + "){\n"); output.print("DS(" + dataSet.getName() + "){\n");
for (FunctionalConstraintData fcda : dataSet.getFcda()) { for (FunctionalConstraintData fcda : dataSet.getFcda()) {
String mmsVariableName = ""; String mmsVariableName = "";
@ -237,7 +237,21 @@ public class DynamicModelGenerator {
if (fcda.getDaName() != null) if (fcda.getDaName() != null)
mmsVariableName += "$" + toMmsString(fcda.getDaName()); 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("}"); output.println("}");
} }

Loading…
Cancel
Save