pakutz79 69246618ee fix: test forecast uses UTC hour for solar/price lookup
buildWinterForecast was indexing solarW[] and winterPrices[] by slot
position h instead of actual UTC hour. When a forecast starts at 18:00,
h=8 (02:00 AM) was getting solarW[8]=1200W, giving midnight slots a
false solar bonus in RuleBasedStrategy::slotScore(). The strategy
correctly chose those slots, but countSlotsInCheapestN (price-only)
reported them as outside the 6 cheapest hours → test 1 failed.

Fix: index both arrays by slot.start.toUTC().time().hour() so solar
peaks at noon and prices reflect the real time-of-day. All 11 tests pass.

Also includes the INCLUDEPATH += \$\$PWD fix in energyplugin.pri that
makes relative includes work for test builds consuming the .pri.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 06:53:20 +01:00

80 lines
2.7 KiB
Plaintext

# All files in energyplugin use relative includes (e.g. "types/foo.h").
# Consumers of this .pri must have the energyplugin root on their include path.
INCLUDEPATH += $$PWD
greaterThan(QT_MAJOR_VERSION, 5) {
message("Building using Qt6 support")
CONFIG *= c++17
QMAKE_LFLAGS *= -std=c++17
QMAKE_CXXFLAGS *= -std=c++17
} else {
message("Building using Qt5 support")
CONFIG *= c++11
QMAKE_LFLAGS *= -std=c++11
QMAKE_CXXFLAGS *= -std=c++11
DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00
}
coverage {
message(Building with code coverage enabled)
# --coverage option contains: -fprofile-arcs -ftest-coverage -lgcov
QMAKE_CXXFLAGS *= --coverage
QMAKE_LDFLAGS *= --coverage
LIBS += -lgcov
}
HEADERS += \
$$PWD/energymanagerconfiguration.h \
$$PWD/energysettings.h \
$$PWD/evcharger.h \
$$PWD/nymeaenergyjsonhandler.h \
$$PWD/rootmeter.h \
$$PWD/schedulermanager.h \
$$PWD/schedulersettings.h \
$$PWD/smartchargingmanager.h \
$$PWD/spotmarket/spotmarketdataprovider.h \
$$PWD/spotmarket/spotmarketdataproviderawattar.h \
$$PWD/spotmarket/spotmarketmanager.h \
$$PWD/schedulingstrategies/ischedulingstrategy.h \
$$PWD/schedulingstrategies/rulebasedstrategy.h \
$$PWD/schedulingstrategies/aistrategy.h \
$$PWD/schedulingstrategies/manualstrategy.h \
$$PWD/types/chargingaction.h \
$$PWD/types/charginginfo.h \
$$PWD/types/chargingprocessinfo.h \
$$PWD/types/chargingschedule.h \
$$PWD/types/energytimeslot.h \
$$PWD/types/flexibleload.h \
$$PWD/types/manualslotconfig.h \
$$PWD/types/schedulerconfig.h \
$$PWD/types/scoreentry.h \
$$PWD/types/smartchargingstate.h \
$$PWD/types/timeframe.h \
SOURCES += \
$$PWD/energymanagerconfiguration.cpp \
$$PWD/energysettings.cpp \
$$PWD/evcharger.cpp \
$$PWD/nymeaenergyjsonhandler.cpp \
$$PWD/rootmeter.cpp \
$$PWD/schedulermanager.cpp \
$$PWD/schedulersettings.cpp \
$$PWD/smartchargingmanager.cpp \
$$PWD/spotmarket/spotmarketdataprovider.cpp \
$$PWD/spotmarket/spotmarketdataproviderawattar.cpp \
$$PWD/spotmarket/spotmarketmanager.cpp \
$$PWD/schedulingstrategies/rulebasedstrategy.cpp \
$$PWD/schedulingstrategies/aistrategy.cpp \
$$PWD/schedulingstrategies/manualstrategy.cpp \
$$PWD/types/chargingaction.cpp \
$$PWD/types/charginginfo.cpp \
$$PWD/types/chargingprocessinfo.cpp \
$$PWD/types/chargingschedule.cpp \
$$PWD/types/energytimeslot.cpp \
$$PWD/types/flexibleload.cpp \
$$PWD/types/manualslotconfig.cpp \
$$PWD/types/schedulerconfig.cpp \
$$PWD/types/scoreentry.cpp \
$$PWD/types/smartchargingstate.cpp \
$$PWD/types/timeframe.cpp \