mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
some style improvements
This commit is contained in:
parent
54037c89e5
commit
c635f112e3
2 changed files with 19 additions and 6 deletions
|
@ -87,6 +87,8 @@ public:
|
|||
char const* name() const;
|
||||
// get equivalent IEC104 type without timestamp (e.g. for general interrogation response)
|
||||
ASDUData::Type typeWithoutTimestamp() const;
|
||||
// get equivalent ASDUData without timestamp (e.g. for general interrogation response)
|
||||
ASDUData withoutTimestamp() const;
|
||||
// corresponding signal type
|
||||
SignalType signalType() const;
|
||||
// check if ASDU contains this data
|
||||
|
|
|
@ -113,6 +113,11 @@ ASDUData::Type ASDUData::typeWithoutTimestamp() const
|
|||
return this->descriptor.type_without_timestamp;
|
||||
}
|
||||
|
||||
ASDUData ASDUData::withoutTimestamp() const
|
||||
{
|
||||
return ASDUData::lookupType(this->typeWithoutTimestamp(), this->ioa).value();
|
||||
}
|
||||
|
||||
SignalType ASDUData::signalType() const
|
||||
{
|
||||
return this->descriptor.signal_type;
|
||||
|
@ -438,10 +443,15 @@ bool SlaveNode::onInterrogation(IMasterConnection connection, CS101_ASDU asdu, u
|
|||
for (unsigned i = 0; i < mapping.size(); i++) {
|
||||
auto asdu_data = mapping[i];
|
||||
auto last_value = last_values[i];
|
||||
auto asdu_data_without_timestamp = ASDUData::lookupType(asdu_data.typeWithoutTimestamp(), asdu_data.ioa).value();
|
||||
|
||||
if (asdu_data.type() == asdu_type)
|
||||
asdu_data_without_timestamp.addSampleToASDU(signal_asdu, ASDUData::Sample { last_value, IEC60870_QUALITY_GOOD, std::nullopt });
|
||||
asdu_data
|
||||
.withoutTimestamp()
|
||||
.addSampleToASDU(signal_asdu, ASDUData::Sample {
|
||||
last_value,
|
||||
IEC60870_QUALITY_GOOD,
|
||||
std::nullopt
|
||||
});
|
||||
}
|
||||
|
||||
assert(CS101_ASDU_getNumberOfElements(signal_asdu) > 0);
|
||||
|
@ -488,10 +498,11 @@ int SlaveNode::_write(Sample *samples[], unsigned sample_count)
|
|||
signalTypeToString(sample_format(sample,signal))
|
||||
);
|
||||
|
||||
mapping[signal].addSampleToASDU(
|
||||
asdu,
|
||||
ASDUData::Sample { sample->data[signal], IEC60870_QUALITY_GOOD, timestamp }
|
||||
);
|
||||
mapping[signal].addSampleToASDU(asdu, ASDUData::Sample {
|
||||
sample->data[signal],
|
||||
IEC60870_QUALITY_GOOD,
|
||||
timestamp
|
||||
});
|
||||
|
||||
asdu_elements++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue