Page MenuHomePhorge

No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None
diff --git a/Version_Max_07_05_2018_CMake/src/AverageValue.cpp b/Version_Max_07_05_2018_CMake/src/AverageValue.cpp
index 8162c9b..acc2683 100755
--- a/Version_Max_07_05_2018_CMake/src/AverageValue.cpp
+++ b/Version_Max_07_05_2018_CMake/src/AverageValue.cpp
@@ -1,39 +1,39 @@
#include "AverageValue.h"
#include <stdio.h>
AverageValue :: AverageValue() {
resetAverageValue();
}
void AverageValue :: resetAverageValue() {
avgValue = 0;
injectedValuesCounter = 0;
}
void AverageValue ::injectAndCalculateAverageValue(float value) {
if(injectedValuesCounter > 0) {
avgValue = (avgValue*injectedValuesCounter + value) / (injectedValuesCounter + 1);
}
else {
avgValue = value;
}
injectedValuesCounter++;
}
float AverageValue ::getAverageValue() {
return avgValue;
}
unsigned int AverageValue :: getInjectedValuesCounter() {
return injectedValuesCounter;
}
bool AverageValue::averageValueIsValid() {
- printf(" ------------------- hier\n");
+ //printf(" ------------------- hier\n");
if (injectedValuesCounter > 0) {
- printf(" --- injVal %u\n", injectedValuesCounter);
+ //printf(" --- injVal %u\n", injectedValuesCounter);
return true;
}
return false;
}
\ No newline at end of file
diff --git a/Version_Max_07_05_2018_CMake/src/attach_modules.cpp b/Version_Max_07_05_2018_CMake/src/attach_modules.cpp
index 7e29b3f..67198ba 100755
--- a/Version_Max_07_05_2018_CMake/src/attach_modules.cpp
+++ b/Version_Max_07_05_2018_CMake/src/attach_modules.cpp
@@ -1,48 +1,60 @@
#include "attach_modules.h"
#include "rlutil.h"
+//#define PRINT
+
using namespace rlutil;
bool attach_historyModuleToSensorSlotInAgent(Agent* agent, Sensor* sensor, Channel* inputPort, HistoryModule* historyModule) {
if(agent != NULL && inputPort != NULL && historyModule != NULL) {
SensorSlotOfAgent* sensorSlotOfAgent = agent->get_sensorHandlerOfAgent()->get_sensorSlotAddress(inputPort);
if(sensorSlotOfAgent != NULL) {
+#ifdef PRINT
printf(" > HistoryModule ");
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", historyModule->get_name());
setColor(TXTCOLOR_GREY);
printf("(id: %03u) ", historyModule->get_id());
+#endif // PRINT
if(sensorSlotOfAgent->set_historyModule(historyModule)) {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTGREEN);
printf("attached ");
setColor(TXTCOLOR_GREY);
printf("to Sensor ");
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", sensor->get_name());
setColor(TXTCOLOR_GREY);
printf("(id: %03u) in Agent ", sensor->get_id());
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", agent->get_name());
setColor(TXTCOLOR_GREY);
printf("(id: %03u)\n", agent->get_id());
+#endif // PRINT
return true;
}
else {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf("Couldn't attach the HistoryModule!\n");
setColor(TXTCOLOR_GREY);
+#endif // PRINT
}
}
else {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the HistoryModule because Sensor isn't mounted in %s (id: %03u)!\n", agent->get_name(), agent->get_id());
setColor(TXTCOLOR_GREY);
+#endif // PRINT
}
}
else {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the HistoryModule because Agent, Channel, or HistoryModule is not valid!\n");
setColor(TXTCOLOR_GREY);
+#endif // PRINT
}
return false;
}
\ No newline at end of file
diff --git a/Version_Max_07_05_2018_CMake/src/attach_modulesToTestbench.cpp b/Version_Max_07_05_2018_CMake/src/attach_modulesToTestbench.cpp
index 5ebe7f2..25405c9 100755
--- a/Version_Max_07_05_2018_CMake/src/attach_modulesToTestbench.cpp
+++ b/Version_Max_07_05_2018_CMake/src/attach_modulesToTestbench.cpp
@@ -1,50 +1,62 @@
#include "attach_modulesToTestbench.h"
#include "rlutil.h"
#include "SensorSlotOfTestbench.h"
+//#define PRINT
+
using namespace rlutil;
bool attach_csvReaderModuleToSensorSlotInAgent(Testbench* testbench, Sensor* sensor, CSVreaderModule* csvReaderModule) {
if(testbench != NULL && sensor != NULL && csvReaderModule != NULL) {
SensorSlotOfTestbench* sensorSlot = testbench->get_sensorSlotAddressOfTestbench(sensor);
if(sensorSlot != NULL) {
+#ifdef PRINT
printf(" > CSV-Reader ");
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", csvReaderModule->get_name());
setColor(TXTCOLOR_GREY);
printf("(id: %03u) ", csvReaderModule->get_id());
+#endif // PRINT
if(sensorSlot->set_csvReaderModule(csvReaderModule)) {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTGREEN);
printf("attached ");
setColor(TXTCOLOR_GREY);
printf("to Sensor ");
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", sensor->get_name());
setColor(TXTCOLOR_GREY);
printf("(id: %03u) in Testbench ", sensor->get_id());
setColor(TXTCOLOR_LIGHTCYAN);
printf("%s ", testbench->get_name());
setColor(TXTCOLOR_GREY);
printf("(id: %03u)\n", testbench->get_id());
+#endif // PRINT
return true;
}
else {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf("Couldn't attach the CSVreaderModule!\n");
setColor(TXTCOLOR_GREY);
+#endif // PRINT
}
}
else {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the CSVreaderModule because Sensor isn't registered in %s (id: %03u)!\n", testbench->get_name(), testbench->get_id());
setColor(TXTCOLOR_GREY);
+#endif // PRINT
}
}
else {
+#ifdef PRINT
setColor(TXTCOLOR_LIGHTRED);
printf(" > Couldn't attach the CSVreaderModule because Testbench, Sensorm or CSVreaderModule is not valid!\n");
setColor(TXTCOLOR_GREY);
+#endif // PRINT
}
return false;
}
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Sun, Apr 27, 10:30 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
134492
Default Alt Text
(5 KB)

Event Timeline