kalibrace per pole
Some checks failed
CI and deploy / migration-check (push) Failing after 9s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-22 22:17:28 +02:00
parent 3cd8e44d37
commit 568b584748
12 changed files with 705 additions and 267 deletions

View File

@@ -117,6 +117,7 @@ export async function getForecastPvSlotsRange(
return Array.isArray(data?.slots) ? data.slots : []
}
/** Řádek z GET /sites/{id}/forecast/pv-slots-corrected — backend může doplnit další pole. */
export type ForecastPvSlotCorrectedRow = {
interval_start: string
pv_forecast_total_w?: number | null
@@ -124,6 +125,26 @@ export type ForecastPvSlotCorrectedRow = {
slot_of_day?: number | null
}
/** Jedna položka slot profilu z `ems.fn_pv_forecast_delta_profile` (JSON). */
export type PvDeltaProfileSlotEntry = {
slot_of_day: number
delta_w: number
sample_count: number
}
/** Volitelný JSON profilu delty (ladění / budoucí UI); `deltas` = součet přes pole, `deltas_by_array` = per pole. */
export type PvForecastDeltaProfileJson = {
site_id?: number
data_from?: string
data_to?: string
delta_learn_min_ts?: string
half_life_days?: number
threshold_w?: number
top_n_days?: number | null
deltas?: PvDeltaProfileSlotEntry[]
deltas_by_array?: Record<string, { deltas: PvDeltaProfileSlotEntry[] }>
}
export type ForecastPvSlotsCorrectedParams = {
delta_from?: string
delta_to?: string
@@ -144,6 +165,28 @@ export async function getForecastPvSlotsRangeCorrected(
return Array.isArray(data?.slots) ? data.slots : []
}
export type PvDeltaProfileQueryParams = {
half_life_days?: number
threshold_w?: number
top_n_days?: number | null
non_top_day_factor?: number | null
day_weight_gamma?: number | null
}
/** GET /sites/{id}/forecast/pv-delta-profile — přímo JSON z `ems.fn_pv_forecast_delta_profile`. */
export async function getPvForecastDeltaProfile(
siteId: number,
fromIso: string,
toIso: string,
params?: PvDeltaProfileQueryParams,
): Promise<PvForecastDeltaProfileJson> {
const { data } = await client.get<PvForecastDeltaProfileJson>(
`/sites/${siteId}/forecast/pv-delta-profile`,
{ params: { from: fromIso, to: toIso, ...params }, timeout: 45_000 },
)
return data != null && typeof data === 'object' ? data : {}
}
export type Telemetry15mRow = {
slot_start: string
site_id: number