powersync-energy-plugin-etm/energyplugin/schedulingstrategies/aistrategy.h

75 lines
2.5 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright (C) 2013 - 2024, nymea GmbH
* Copyright (C) 2024 - 2025, chargebyte austria GmbH
*
* This file is part of nymea-energy-plugin-nymea.
*
* nymea-energy-plugin-nymea.s free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nymea-energy-plugin-nymea.s distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with nymea-energy-plugin-nymea. If not, see <https://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef AISTRATEGY_H
#define AISTRATEGY_H
#include "ischedulingstrategy.h"
// Stub AI strategy — reserves extension point for a future ML model (ONNX / HTTP).
//
// Current behaviour: always returns an empty schedule with a human-readable
// fallback message, and reports itself as unavailable.
//
// Future extension hooks:
// - setModelPath(path) → load ONNX model
// - setRemoteEndpoint(url, apiKey) → delegate to HTTP inference service
// - When a model is loaded, override isAvailable() to return true and
// implement computeSchedule() to call the model.
class AIStrategy : public ISchedulingStrategy
{
Q_OBJECT
public:
explicit AIStrategy(QObject *parent = nullptr);
QString strategyId() const override;
QString displayName() const override;
QString description() const override;
// Always false until a real model is wired in
bool isAvailable() const override;
QList<EnergyTimeSlot> computeSchedule(
const QList<EnergyTimeSlot> &forecast,
const QList<FlexibleLoad> &loads,
const SchedulerConfig &config
) override;
QString explainDecision(
const EnergyTimeSlot &slot,
const FlexibleLoad &load
) const override;
// --- Future extension hooks (no-op until model is wired) ---
void setModelPath(const QString &path);
void setRemoteEndpoint(const QString &url, const QString &apiKey);
private:
QString m_modelPath;
QString m_remoteEndpoint;
QString m_apiKey;
};
#endif // AISTRATEGY_H