Add test for NEUHAUSER_BILEXA_GALTUER
This commit is contained in:
parent
b8a5803613
commit
b4940e98fe
@ -36,10 +36,40 @@ extern "C" char* strptime(const char* s,
|
||||
#define SZEGED (0)
|
||||
#define NEUHAUSER_KORNEUBURG (0)
|
||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (1)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
|
||||
#define NEUHAUSER_BILEXA_GALTUER (1)
|
||||
|
||||
|
||||
int main() {
|
||||
#if NEUHAUSER_BILEXA_GALTUER==1
|
||||
std::ifstream input("/opt/ptu5/opt/customer_745/etc/psa_tariff/tariff01.json");
|
||||
|
||||
std::stringstream sstr;
|
||||
while(input >> sstr.rdbuf());
|
||||
std::string json(sstr.str());
|
||||
|
||||
Configuration cfg;
|
||||
|
||||
bool isParsed = cfg.ParseJson(&cfg, json.c_str());
|
||||
cout << endl;
|
||||
|
||||
if (isParsed) {
|
||||
QDateTime start = QDateTime::currentDateTime();
|
||||
start.setTime(QTime(start.time().hour(), start.time().minute(), 0));
|
||||
Calculator calculator(start);
|
||||
QList<int> timeSteps = calculator.GetTimeSteps(&cfg);
|
||||
qCritical() << timeSteps;
|
||||
|
||||
for (int i=0; i<timeSteps.size(); ++i) {
|
||||
uint32_t price = calculator.GetPriceForTimeStep(&cfg, timeSteps.at(i));
|
||||
uint32_t duration = calculator.GetDurationForPrice(&cfg, price);
|
||||
qCritical() << "nextTimeStep relative to start:"
|
||||
<< duration << start.addSecs(duration * 60)
|
||||
<< "(price so far:" << price << ")";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM==1
|
||||
std::ifstream input("/tmp/tariff_naz.json");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user