Zone6 for Bad neuenahr

This commit is contained in:
Gerhard Hoffmann 2024-04-30 14:09:48 +02:00
parent 1dd81d4a56
commit f8fef12b55

View File

@ -37,11 +37,11 @@ extern "C" char* strptime(const char* s,
#define SZEGED (0) #define SZEGED (0)
#define SCHOENAU_KOENIGSEE (0) #define SCHOENAU_KOENIGSEE (0)
#define NEUHAUSER_KORNEUBURG (0) #define NEUHAUSER_KORNEUBURG (0)
#define NEUHAUSER_LINSINGER_MASCHINENBAU (1) #define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0) #define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
#define NEUHAUSER_BILEXA_GALTUER (0) #define NEUHAUSER_BILEXA_GALTUER (0)
#define NEUHAUSER_KIRCHDORF (0) #define NEUHAUSER_KIRCHDORF (0)
#define BAD_NEUENAHR_AHRWEILER (0) #define BAD_NEUENAHR_AHRWEILER (1)
#define NEUHAUSER_CHRISTOPH_REISEN (0) #define NEUHAUSER_CHRISTOPH_REISEN (0)
#define NEUHAUSER_PERNEGG_AN_DER_MUR (0) #define NEUHAUSER_PERNEGG_AN_DER_MUR (0)
@ -366,7 +366,7 @@ int main() {
int pop_carry_over; int pop_carry_over;
int pop_carry_over_time_range_id; int pop_carry_over_time_range_id;
for (int zone=2; zone < 3; ++zone) { for (int zone=6; zone < 7; ++zone) {
//for (int t=6; t < 7; t+=20) { //for (int t=6; t < 7; t+=20) {
switch (zone) { switch (zone) {
case 1: { case 1: {
@ -589,6 +589,216 @@ int main() {
} }
} }
} }
if (zone == 3) {
pop_min_time = get_minimal_parkingtime(&cfg);
pop_max_time = get_maximal_parkingtime(&cfg);
pop_min_price = get_minimal_parkingprice(&cfg);
pop_max_price = get_maximal_parkingprice(&cfg);
pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price;
qCritical() << " pop_min_time: " << pop_min_time;
qCritical() << " pop_max_time: " << pop_max_time;
qCritical() << " pop_min_price: " << pop_min_price;
qCritical() << " pop_max_price: " << pop_max_price;
qCritical() << "pop_daily_card_price: " << pop_daily_card_price;
static QList<int> const stepsConfigured
= QList(std::initializer_list<int>{20, 40, 60, 80, 100, 120});
static QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
qCritical() << "TimeSteps" << timeSteps;
if (stepsConfigured != timeSteps) {
qCritical() << "TIME-STEPS SHOULD BE" << stepsConfigured;
return -1;
}
bool fail;
QDateTime start;
for (int i=0; i < 5; ++i) {
switch (i) {
case 0:
start = QDateTime(QDate(2024, 5, 1), QTime(16, 0, 0)); // holiday
fail = false;
break;
case 1:
start = QDateTime(QDate(2024, 4, 21), QTime(16, 0, 0)); // sunday
fail = false;
break;
case 2:
start = QDateTime(QDate(2024, 4, 22), QTime(8, 0, 0)); // monday
fail = false;
break;
case 3:
start = QDateTime(QDate(2024, 4, 23), QTime(17, 30, 0)); // tuesday
fail = true;
break;
case 4:
start = QDateTime(QDate(2024, 4, 24), QTime(7, 30, 0)); // wednesday
fail = true;
break;
default:;
}
QDateTime end;
struct price_t price;
//start = QDateTime::currentDateTime();
QList<int> timeSteps;
int paymentOptionIndex = cfg.getPaymentOptionIndex(start);
if (paymentOptionIndex != -1) {
qCritical() << "paymentOptionIndex" << paymentOptionIndex;
timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg, paymentOptionIndex);
qCritical() << "TimeSteps" << timeSteps;
QList<int>::const_iterator step;
for (step = timeSteps.cbegin(); step != timeSteps.cend(); ++step) {
double cost = 0;
CalcState cs;
if ((cs = compute_price_for_parking_ticket(&cfg, start, *step, end, &price))) {
cost = price.netto;
qCritical() << "step" << *step << ": cost" << cost;
} else {
if (fail == false) {
qCritical() << "<<<ERROR>>> cs =" << QString(cs);
}
}
}
} else {
qCritical() << "ERROR paymentOptionIndex =" << paymentOptionIndex;
}
}
}
if (zone == 4) {
pop_min_time = get_minimal_parkingtime(&cfg);
pop_max_time = get_maximal_parkingtime(&cfg);
pop_min_price = get_minimal_parkingprice(&cfg);
pop_max_price = get_maximal_parkingprice(&cfg);
pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price;
qCritical() << " pop_min_time: " << pop_min_time;
qCritical() << " pop_max_time: " << pop_max_time;
qCritical() << " pop_min_price: " << pop_min_price;
qCritical() << " pop_max_price: " << pop_max_price;
qCritical() << "pop_daily_card_price: " << pop_daily_card_price;
static QList<int> const stepsConfigured
= QList(std::initializer_list<int>{20, 40, 60, 80, 100, 120});
static QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
qCritical() << "TimeSteps" << timeSteps;
if (stepsConfigured != timeSteps) {
qCritical() << "TIME-STEPS SHOULD BE" << stepsConfigured;
return -1;
}
bool fail;
QDateTime start;
for (int i=4; i < 5; ++i) {
switch (i) {
case 0:
start = QDateTime(QDate(2024, 5, 1), QTime(16, 0, 0)); // holiday
fail = false;
break;
case 1:
start = QDateTime(QDate(2024, 4, 21), QTime(16, 0, 0)); // sunday
fail = false;
break;
case 2:
start = QDateTime(QDate(2024, 4, 22), QTime(8, 0, 0)); // monday
fail = false;
break;
case 3:
start = QDateTime(QDate(2024, 4, 23), QTime(17, 30, 0)); // tuesday
fail = true;
break;
case 4:
start = QDateTime(QDate(2024, 4, 24), QTime(7, 30, 0)); // wednesday
fail = true;
break;
default:;
}
QDateTime end;
struct price_t price;
//start = QDateTime::currentDateTime();
QList<int> timeSteps;
int paymentOptionIndex = cfg.getPaymentOptionIndex(start);
if (paymentOptionIndex != -1) {
qCritical() << "paymentOptionIndex" << paymentOptionIndex;
timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg, paymentOptionIndex);
qCritical() << "TimeSteps" << timeSteps;
QList<int>::const_iterator step;
for (step = timeSteps.cbegin(); step != timeSteps.cend(); ++step) {
double cost = 0;
CalcState cs;
if ((cs = compute_price_for_parking_ticket(&cfg, start, *step, end, &price))) {
cost = price.netto;
qCritical() << "step" << *step << ": cost" << cost;
} else {
if (fail == false) {
qCritical() << "<<<ERROR>>> cs =" << QString(cs);
}
}
}
} else {
qCritical() << "ERROR paymentOptionIndex =" << paymentOptionIndex;
}
}
}
if (zone == 5) {
}
if (zone == 6) { // sondertarif: 24h ticket wohnmobile
pop_min_time = get_minimal_parkingtime(&cfg);
pop_max_time = get_maximal_parkingtime(&cfg);
pop_min_price = get_minimal_parkingprice(&cfg);
pop_max_price = get_maximal_parkingprice(&cfg);
pop_daily_card_price = cfg.getPaymentOptions().pop_daily_card_price;
qCritical() << zone << " pop_min_time: " << pop_min_time;
qCritical() << zone << " pop_max_time: " << pop_max_time;
qCritical() << zone << " pop_min_price: " << pop_min_price;
qCritical() << zone << " pop_max_price: " << pop_max_price;
qCritical() << zone << "pop_daily_card_price: " << pop_daily_card_price;
QDateTime start = QDateTime::currentDateTime();
start.setTime(QTime(0, 0, 0));
for (int i=0; i<1440; ++i) {
QDateTime productStart;
QDateTime productEnd;
int v = compute_product_price(&cfg, PERMIT_TYPE::TWENTY_FOUR_HOURS_TICKET, start, &productStart, &productEnd);
if (v != 800) {
qCritical() << "ERROR [" << i << "]" << "price 24h-ticket"
<< v << productStart.toString(Qt::ISODate)
<< productEnd.toString(Qt::ISODate);
exit(-1);
} else {
qCritical() << v << productStart.toString(Qt::ISODate)
<< productEnd.toString(Qt::ISODate);
}
start = start.addSecs(60);
}
}
if (zone == 7) {
}
} }
} }
#endif #endif