Page MenuHomePhorge

No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None
diff --git a/apps/ccam/configuration.h b/apps/ccam/configuration.h
index 3058baa..3ba9cd1 100644
--- a/apps/ccam/configuration.h
+++ b/apps/ccam/configuration.h
@@ -1,97 +1,103 @@
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
// clang-tidy off
// clang-format off
#include "nlohmann/json.hpp"
// clang-format on
// clang-tidy on
#include "rosa/config/version.h"
#include "rosa/app/Application.hpp"
#include <fstream>
using namespace rosa;
using nlohmann::json;
enum DataInterfaceTypes { CSV, MQTT };
struct SignalConfiguration {
std::string Name;
std::string InputPath;
std::string MQTTTopic;
DataInterfaceTypes DataInterfaceType;
bool Output;
float InnerBound;
float OuterBound;
float InnerBoundDrift;
float OuterBoundDrift;
uint32_t SampleHistorySize;
uint32_t DABSize;
uint32_t DABHistorySize;
+ bool ControlData;
+ std::string ControlDataPath;
+ uint32_t ResetDABhistory;
};
struct AppConfiguration {
std::string OutputFilePath;
uint32_t BrokenCounter;
uint32_t NumberOfSimulationCycles;
uint32_t DownsamplingRate;
std::vector<SignalConfiguration> SignalConfigurations;
};
void from_json(const json &J, SignalConfiguration &SC) {
J.at("Name").get_to(SC.Name);
if (J.contains("InputPath")) {
J.at("InputPath").get_to(SC.InputPath);
SC.DataInterfaceType = DataInterfaceTypes::CSV;
} else if (J.contains("MQTTTopic")) {
J.at("MQTTTopic").get_to(SC.MQTTTopic);
SC.DataInterfaceType = DataInterfaceTypes::MQTT;
}
J.at("Output").get_to(SC.Output);
J.at("InnerBound").get_to(SC.InnerBound);
J.at("OuterBound").get_to(SC.OuterBound);
J.at("InnerBoundDrift").get_to(SC.InnerBoundDrift);
J.at("OuterBoundDrift").get_to(SC.OuterBoundDrift);
J.at("SampleHistorySize").get_to(SC.SampleHistorySize);
J.at("DABSize").get_to(SC.DABSize);
J.at("DABHistorySize").get_to(SC.DABHistorySize);
+ J.at("ControlData").get_to(SC.ControlData);
+ J.at("ControlDataPath").get_to(SC.ControlDataPath);
+ J.at("ResetDABhistory").get_to(SC.ResetDABhistory);
}
void from_json(const json &J, AppConfiguration &AC) {
J.at("OutputFilePath").get_to(AC.OutputFilePath);
J.at("BrokenCounter").get_to(AC.BrokenCounter);
J.at("NumberOfSimulationCycles").get_to(AC.NumberOfSimulationCycles);
J.at("DownsamplingRate").get_to(AC.DownsamplingRate);
J.at("SignalConfigurations").get_to(AC.SignalConfigurations);
}
AppConfiguration AppConfig;
bool readConfigFile(std::string ConfigPath) {
LOG_INFO("READING CONFIG FILE");
LOG_INFO_STREAM << "Looking for config file at \"" << ConfigPath << "\"\n";
std::ifstream ConfigFile;
ConfigFile.open(ConfigPath);
if (!ConfigFile) {
LOG_ERROR("Unable to open config file");
return false;
}
json ConfigObj;
ConfigFile >> ConfigObj;
LOG_INFO_STREAM << "Read JSON file as \"" << ConfigObj << "\"\n";
try {
ConfigObj.get_to(AppConfig);
} catch (nlohmann::detail::type_error ex) {
LOG_ERROR("Misformatted Config File");
return false;
}
return true;
}
#endif // CONFIGURATION_H
diff --git a/apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/config.json b/apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/config.json
index 510e291..396c6ed 100644
--- a/apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/config.json
+++ b/apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/config.json
@@ -1,35 +1,25 @@
{
"OutputFilePath" : "out.csv",
"BrokenCounter" : 20,
"NumberOfSimulationCycles" : 2000,
"DownsamplingRate" : 1,
"SignalConfigurations" :
[
{
"Name" : "value",
"InputPath" : "value.csv",
"Output" : false,
"Control" : false,
"InnerBound" : 0.01,
"OuterBound" : 0.14,
"InnerBoundDrift" : 0.00001,
"OuterBoundDrift" : 0.0001,
"SampleHistorySize" : 10,
"DABSize" : 10,
- "DABHistorySize" : 5
- }
- {
- "Name" : "ctrl_signal",
- "InputPath" : "signal.csv",
- "Output" : false,
- "Control" : true,
- "InnerBound" : 0.01,
- "OuterBound" : 0.14,
- "InnerBoundDrift" : 0.00001,
- "OuterBoundDrift" : 0.0001,
- "SampleHistorySize" : 10,
- "DABSize" : 10,
- "DABHistorySize" : 5
+ "DABHistorySize" : 5,
+ "ControlData" : true,
+ "ControlPath" : "ctrSignal.csv",
+ "ResetDABhistory" : 1
}
]
}
diff --git a/apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/signal.csv b/apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/ctrSignal.csv
similarity index 100%
rename from apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/signal.csv
rename to apps/ccam/sample_data/20200525_1125/splitted_data/values_20200525_1125_1/ctrSignal.csv

File Metadata

Mime Type
text/x-diff
Expires
Sat, May 17, 7:24 AM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
141515
Default Alt Text
(5 KB)

Event Timeline