Skip to content

Commit

Permalink
Merge pull request #24 from fledge-power/mz_refactoring
Browse files Browse the repository at this point in the history
- fixed problem with time stamp handling of spontaneous messages
  • Loading branch information
aklira authored Oct 5, 2022
2 parents 6563df8 + 4f6af8e commit a3028c6
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 24 deletions.
5 changes: 2 additions & 3 deletions include/iec104_datapoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ class IEC104DataPoint
unsigned int active : 1;
unsigned int refIoa : 24;
} param_mv; /* IEC60870_TYPE_PARAM_MV_... */

struct sCP56Time2a ts;

} m_value;

struct sCP56Time2a m_ts;
};

#endif /* IEC104_DATAPOINT_H */
26 changes: 13 additions & 13 deletions src/iec104.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ IEC104Server::m_updateDataPoint(IEC104DataPoint* dp, IEC60870_5_TypeID typeId, D
dp->m_value.sp.quality = quality;

if (typeId == M_SP_TB_1) {
setTimestamp(&(dp->m_value.ts), ts);
setTimestamp(&(dp->m_ts), ts);
}
}

Expand All @@ -269,7 +269,7 @@ IEC104Server::m_updateDataPoint(IEC104DataPoint* dp, IEC60870_5_TypeID typeId, D
dp->m_value.dp.quality = quality;

if (typeId == M_DP_TB_1) {
setTimestamp(&(dp->m_value.ts), ts);
setTimestamp(&(dp->m_ts), ts);
}
}

Expand All @@ -286,7 +286,7 @@ IEC104Server::m_updateDataPoint(IEC104DataPoint* dp, IEC60870_5_TypeID typeId, D
dp->m_value.stepPos.quality = quality;

if (typeId == M_ST_TB_1) {
setTimestamp(&(dp->m_value.ts), ts);
setTimestamp(&(dp->m_ts), ts);
}
}
break;
Expand All @@ -301,7 +301,7 @@ IEC104Server::m_updateDataPoint(IEC104DataPoint* dp, IEC60870_5_TypeID typeId, D
dp->m_value.mv_normalized.quality = quality;

if (typeId == M_ME_TD_1) {
setTimestamp(&(dp->m_value.ts), ts);
setTimestamp(&(dp->m_ts), ts);
}
}

Expand All @@ -317,7 +317,7 @@ IEC104Server::m_updateDataPoint(IEC104DataPoint* dp, IEC60870_5_TypeID typeId, D
dp->m_value.mv_scaled.quality = quality;

if (typeId == M_ME_TE_1) {
setTimestamp(&(dp->m_value.ts), ts);
setTimestamp(&(dp->m_ts), ts);
}
}

Expand All @@ -333,7 +333,7 @@ IEC104Server::m_updateDataPoint(IEC104DataPoint* dp, IEC60870_5_TypeID typeId, D
dp->m_value.mv_short.quality = quality;

if (typeId == M_ME_TF_1) {
setTimestamp(&(dp->m_value.ts), ts);
setTimestamp(&(dp->m_ts), ts);
}
}

Expand Down Expand Up @@ -361,19 +361,19 @@ IEC104Server::m_enqueueSpontDatapoint(IEC104DataPoint* dp, CS101_CauseOfTransmis

case M_SP_TB_1:
{
io = (InformationObject)SinglePointWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.sp.value, dp->m_value.sp.quality, &(dp->m_value.ts));
io = (InformationObject)SinglePointWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.sp.value, dp->m_value.sp.quality, &(dp->m_ts));
}
break;

case M_DP_NA_1:
{
io = (InformationObject)DoublePointInformation_create(NULL, dp->m_ioa, (DoublePointValue)dp->m_value.dp.quality, dp->m_value.dp.quality);
io = (InformationObject)DoublePointInformation_create(NULL, dp->m_ioa, (DoublePointValue)dp->m_value.dp.value, dp->m_value.dp.quality);
}
break;

case M_DP_TB_1:
{
io = (InformationObject)DoublePointWithCP56Time2a_create(NULL, dp->m_ioa, (DoublePointValue)dp->m_value.dp.quality, dp->m_value.dp.quality, &(dp->m_value.ts));
io = (InformationObject)DoublePointWithCP56Time2a_create(NULL, dp->m_ioa, (DoublePointValue)dp->m_value.dp.value, dp->m_value.dp.quality, &(dp->m_ts));
}
break;

Expand All @@ -385,7 +385,7 @@ IEC104Server::m_enqueueSpontDatapoint(IEC104DataPoint* dp, CS101_CauseOfTransmis

case M_ST_TB_1:
{
io = (InformationObject)StepPositionWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.stepPos.posValue, dp->m_value.stepPos.transient, dp->m_value.stepPos.quality, &(dp->m_value.ts));
io = (InformationObject)StepPositionWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.stepPos.posValue, dp->m_value.stepPos.transient, dp->m_value.stepPos.quality, &(dp->m_ts));
}
break;

Expand All @@ -397,7 +397,7 @@ IEC104Server::m_enqueueSpontDatapoint(IEC104DataPoint* dp, CS101_CauseOfTransmis

case M_ME_TD_1:
{
io = (InformationObject)MeasuredValueNormalizedWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.mv_normalized.value, dp->m_value.mv_normalized.quality, &(dp->m_value.ts));
io = (InformationObject)MeasuredValueNormalizedWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.mv_normalized.value, dp->m_value.mv_normalized.quality, &(dp->m_ts));
}
break;

Expand All @@ -409,7 +409,7 @@ IEC104Server::m_enqueueSpontDatapoint(IEC104DataPoint* dp, CS101_CauseOfTransmis

case M_ME_TE_1:
{
io = (InformationObject)MeasuredValueScaledWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.mv_normalized.value, dp->m_value.mv_normalized.quality, &(dp->m_value.ts));
io = (InformationObject)MeasuredValueScaledWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.mv_scaled.value, dp->m_value.mv_scaled.quality, &(dp->m_ts));
}
break;

Expand All @@ -421,7 +421,7 @@ IEC104Server::m_enqueueSpontDatapoint(IEC104DataPoint* dp, CS101_CauseOfTransmis

case M_ME_TF_1:
{
io = (InformationObject)MeasuredValueShortWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.mv_short.value, dp->m_value.mv_short.quality, &(dp->m_value.ts));
io = (InformationObject)MeasuredValueShortWithCP56Time2a_create(NULL, dp->m_ioa, dp->m_value.mv_short.value, dp->m_value.mv_short.quality, &(dp->m_ts));
}
break;

Expand Down
Loading

0 comments on commit a3028c6

Please sign in to comment.