From eab521a8eef7cc74a86291e51dc8235cc8234bef Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Tue, 30 Jul 2024 10:31:14 +0200 Subject: [PATCH] improve comments Signed-off-by: Niklas Eiling --- dpsim-models/include/dpsim-models/Attribute.h | 2 +- dpsim-villas/examples/cxx/FpgaExample.cpp | 3 ++- dpsim-villas/src/InterfaceVillasQueueless.cpp | 10 +++++----- dpsim-villas/src/InterfaceWorkerVillas.cpp | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dpsim-models/include/dpsim-models/Attribute.h b/dpsim-models/include/dpsim-models/Attribute.h index 36581bbf9..2fafa6e0f 100644 --- a/dpsim-models/include/dpsim-models/Attribute.h +++ b/dpsim-models/include/dpsim-models/Attribute.h @@ -353,7 +353,7 @@ class Attribute : public AttributeBase, AttributeBase::Ptr cloneValueOntoNewAttribute() override { return AttributePointer( AttributeStatic::make(this->get())); - //TODO: This is in the real time path. We should not use heap here. + // TODO: This is in the real time path. We should not use heap here. }; /** diff --git a/dpsim-villas/examples/cxx/FpgaExample.cpp b/dpsim-villas/examples/cxx/FpgaExample.cpp index de62a68de..bde17e424 100644 --- a/dpsim-villas/examples/cxx/FpgaExample.cpp +++ b/dpsim-villas/examples/cxx/FpgaExample.cpp @@ -199,7 +199,8 @@ int main(int argc, char *argv[]) { Simulation sim(args.name, args); sim.setSystem(sys); sim.addInterface(intf); - //sim.addLogger(logger); + // If you want to add loggging (slows down the execution) add + // sim.addLogger(logger); sim.run(); CPS::Logger::get("FpgaExample")->info("Simulation finished."); diff --git a/dpsim-villas/src/InterfaceVillasQueueless.cpp b/dpsim-villas/src/InterfaceVillasQueueless.cpp index 9f61ac3a4..7599b5096 100644 --- a/dpsim-villas/src/InterfaceVillasQueueless.cpp +++ b/dpsim-villas/src/InterfaceVillasQueueless.cpp @@ -138,8 +138,8 @@ void InterfaceVillasQueueless::open() { createNode(); createSignals(); - mNode->getFactory()->start( - nullptr); //We have no SuperNode, so just hope type_start doesnt use it... + // We have no SuperNode, so just hope type_start doesn't use it... + mNode->getFactory()->start(nullptr); auto ret = mNode->start(); if (ret < 0) { @@ -343,17 +343,17 @@ void InterfaceVillasQueueless::writeToVillas() { "Failed to write samples to InterfaceVillas. Write returned code {}", ret); - /* Don't throw here, because we managed to send something */ + // Don't throw here, because we managed to send something } } void InterfaceVillasQueueless::syncImports() { - //Block on read until all attributes with syncOnSimulationStart are read + // Block on read until all attributes with syncOnSimulationStart are read mSequenceToDpsim = this->readFromVillas(); } void InterfaceVillasQueueless::syncExports() { - //Just push all the attributes + // Just push all the attributes this->writeToVillas(); } diff --git a/dpsim-villas/src/InterfaceWorkerVillas.cpp b/dpsim-villas/src/InterfaceWorkerVillas.cpp index 8b49a7c03..fbb9bcc5f 100644 --- a/dpsim-villas/src/InterfaceWorkerVillas.cpp +++ b/dpsim-villas/src/InterfaceWorkerVillas.cpp @@ -289,14 +289,14 @@ void InterfaceWorkerVillas::readValuesFromEnv( void InterfaceWorkerVillas::writeValuesToEnv( std::vector &updatedAttrs) { - //Update export sequence IDs + // Update export sequence IDs for (const auto &packet : updatedAttrs) { if (std::get<1>(mExports[packet.attributeId]) < packet.sequenceId) { std::get<1>(mExports[packet.attributeId]) = packet.sequenceId; } } - //Remove outdated packets + // Remove outdated packets auto beginOutdated = std::remove_if( updatedAttrs.begin(), updatedAttrs.end(), [this](auto packet) { return std::get<1>(mExports[packet.attributeId]) > packet.sequenceId;