Skip to content

good first issue: 提供一个最简预测算法 demo(移动平均/相似日) #1

Description

@XM-Vance

背景

OpenPTS 的负荷/价格预测端点目前是接入点(默认 501,DEMO_MODE 返回合成数据)。为了帮助二次开发者理解如何接入自己的算法,提供一个最简的真实算法 demo 会非常有价值。

目标

backend/internal/handler/load.goForecast 方法中,实现一个最简的预测算法(非 demo 合成,而是基于历史数据的真实计算),例如:

  • 移动平均:取最近 N 天同时刻的负荷均值作为预测
  • 相似日法:找历史中相同星期几的日期,取其曲线

算法不需要多精准,目的是演示接入流程:取历史数据 → 计算 → 填充 algoForecastResponse → 返回。

接入点

  • 文件:backend/internal/handler/load.goForecast 方法
  • 历史数据:h.repo.GetRecentCurves(ctx, customerID, targetDate, 30)
  • 响应 DTO:algoForecastResponse(已定义)
  • 文件顶部有 // 接入指引 注释

验证

  • go build ./... 通过
  • 用 demo 环境 bash scripts/demo.sh 起服务后,POST /api/v1/load/forecast 返回基于历史的预测(method 字段不再是 demo-synthetic)

欢迎提问!这个 issue 适合想了解 OpenPTS 算法接入机制的开发者。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions