gtopt/cell_partition.hpp file

Cell partition of a stage: periods / days as unions of cells.

Every stage is a partition of its period into cells [τ_{k−1}, τ_k] with τ_k = Σ_{j≤k} w_j and w_k the block's real duration. On block stages the cells are the blocks; on point stages (Stage.sampling = "point") w_k is the quadrature weight of node t_k (Clenshaw–Curtis, trapezoid/Voronoi, Gauss, user supplied) and validation requires t_k ∈ [τ_{k−1}, τ_k].

Duration logic (commitment periods, min up/down windows, max_cycles_day days) groups whole cells: cell k belongs to group ⌊mid_k / P⌋, mid_k = (τ_{k−1} + τ_k)/2. Equivalently a nominal boundary m·P falling inside a cell snaps to the nearer cell end (a boundary exactly at the cell midpoint puts the cell in the later group). Group durations are sums of cell lengths, consistent with the energy / cost quadrature; the snapping error |τ_boundary − m·P| is at most half the cell that contained m·P.

Backward compatibility: block stages with uniform durations keep the legacy tumbling accumulator (a group closes once Σw ≥ P), which equals the midpoint rule whenever the duration divides P.

Namespaces

namespace gtopt