- IEC 61850 client: reporting - support data set entries with multiple reasons for inclusion

pull/239/head
Michael Zillgith 5 years ago
parent b3c5ecdcf2
commit d85b7ac777

@ -47,14 +47,17 @@ namespace IEC61850
return newRCB; return newRCB;
} }
internal void RemoveRCB(ReportControlBlock rcb) { internal void RemoveRCB(ReportControlBlock rcb)
if (activeRCBs != null) { {
if (activeRCBs != null)
{
activeRCBs.Remove(rcb); activeRCBs.Remove(rcb);
} }
} }
} }
[Flags]
public enum ReasonForInclusion public enum ReasonForInclusion
{ {
/** the element is not included in the received report */ /** the element is not included in the received report */
@ -67,16 +70,16 @@ namespace IEC61850
REASON_QUALITY_CHANGE = 2, REASON_QUALITY_CHANGE = 2,
/** the element is included due to an update of the data value */ /** the element is included due to an update of the data value */
REASON_DATA_UPDATE = 3, REASON_DATA_UPDATE = 4,
/** the element is included due to a periodic integrity report task */ /** the element is included due to a periodic integrity report task */
REASON_INTEGRITY = 4, REASON_INTEGRITY = 8,
/** the element is included due to a general interrogation by the client */ /** the element is included due to a general interrogation by the client */
REASON_GI = 5, REASON_GI = 16,
/** the reason for inclusion is unknown */ /** the reason for inclusion is unknown */
REASON_UNKNOWN = 6 REASON_UNKNOWN = 32
} }
/// <summary> /// <summary>
@ -284,7 +287,8 @@ namespace IEC61850
/// </returns> /// </returns>
public MmsValue GetDataSetValues() public MmsValue GetDataSetValues()
{ {
if (dataSetValues == IntPtr.Zero) { if (dataSetValues == IntPtr.Zero)
{
dataSetValues = ClientReport_getDataSetValues(self); dataSetValues = ClientReport_getDataSetValues(self);
if (dataSetValues == IntPtr.Zero) if (dataSetValues == IntPtr.Zero)
@ -307,7 +311,8 @@ namespace IEC61850
/// </param> /// </param>
public ReasonForInclusion GetReasonForInclusion(int index) public ReasonForInclusion GetReasonForInclusion(int index)
{ {
if (values == null) { if (values == null)
{
GetDataSetValues(); GetDataSetValues();
if (values == null) if (values == null)
@ -375,7 +380,8 @@ namespace IEC61850
if (entryIdRef == IntPtr.Zero) if (entryIdRef == IntPtr.Zero)
return null; return null;
else { else
{
MmsValue entryId = new MmsValue(entryIdRef); MmsValue entryId = new MmsValue(entryIdRef);
return entryId.getOctetString(); return entryId.getOctetString();

@ -716,16 +716,18 @@ iedConnection_handleReport(IedConnection self, MmsValue* value)
goto exit_function; goto exit_function;
} }
matchingReport->reasonForInclusion[i] = 0;
if (MmsValue_getBitStringBit(reasonForInclusion, 1) == true) if (MmsValue_getBitStringBit(reasonForInclusion, 1) == true)
matchingReport->reasonForInclusion[i] = IEC61850_REASON_DATA_CHANGE; matchingReport->reasonForInclusion[i] |= IEC61850_REASON_DATA_CHANGE;
else if (MmsValue_getBitStringBit(reasonForInclusion, 2) == true) if (MmsValue_getBitStringBit(reasonForInclusion, 2) == true)
matchingReport->reasonForInclusion[i] = IEC61850_REASON_QUALITY_CHANGE; matchingReport->reasonForInclusion[i] |= IEC61850_REASON_QUALITY_CHANGE;
else if (MmsValue_getBitStringBit(reasonForInclusion, 3) == true) if (MmsValue_getBitStringBit(reasonForInclusion, 3) == true)
matchingReport->reasonForInclusion[i] = IEC61850_REASON_DATA_UPDATE; matchingReport->reasonForInclusion[i] |= IEC61850_REASON_DATA_UPDATE;
else if (MmsValue_getBitStringBit(reasonForInclusion, 4) == true) if (MmsValue_getBitStringBit(reasonForInclusion, 4) == true)
matchingReport->reasonForInclusion[i] = IEC61850_REASON_INTEGRITY; matchingReport->reasonForInclusion[i] |= IEC61850_REASON_INTEGRITY;
else if (MmsValue_getBitStringBit(reasonForInclusion, 5) == true) if (MmsValue_getBitStringBit(reasonForInclusion, 5) == true)
matchingReport->reasonForInclusion[i] = IEC61850_REASON_GI; matchingReport->reasonForInclusion[i] |= IEC61850_REASON_GI;
} }
else { else {
matchingReport->reasonForInclusion[i] = IEC61850_REASON_UNKNOWN; matchingReport->reasonForInclusion[i] = IEC61850_REASON_UNKNOWN;

@ -1116,16 +1116,16 @@ typedef enum {
IEC61850_REASON_QUALITY_CHANGE = 2, IEC61850_REASON_QUALITY_CHANGE = 2,
/** the element is included due to an update of the data value */ /** the element is included due to an update of the data value */
IEC61850_REASON_DATA_UPDATE = 3, IEC61850_REASON_DATA_UPDATE = 4,
/** the element is included due to a periodic integrity report task */ /** the element is included due to a periodic integrity report task */
IEC61850_REASON_INTEGRITY = 4, IEC61850_REASON_INTEGRITY = 8,
/** the element is included due to a general interrogation by the client */ /** the element is included due to a general interrogation by the client */
IEC61850_REASON_GI = 5, IEC61850_REASON_GI = 16,
/** the reason for inclusion is unknown (e.g. report is not configured to include reason-for-inclusion) */ /** the reason for inclusion is unknown (e.g. report is not configured to include reason-for-inclusion) */
IEC61850_REASON_UNKNOWN = 6 IEC61850_REASON_UNKNOWN = 32
} ReasonForInclusion; } ReasonForInclusion;
#define REASON_NOT_INCLUDED IEC61850_REASON_NOT_INCLUDED #define REASON_NOT_INCLUDED IEC61850_REASON_NOT_INCLUDED

Loading…
Cancel
Save