Skip to content

weekly_points

Python reference for nagasim.build.weekly_points.

Return a repeating points schedule from 168 hourly values.

The first value is Monday 00:00. Each run of equal hours becomes one [duration, value] point, the duration in unit. Runs are not merged across the end of the week, so Monday 00:00 stays at time 0 and the period is one week. Use it as {"name": ..., "kind": ..., **weekly_points(values)} in schedules.

Parameters:

Name Type Description Default
values_168 list of float

Exactly 168 numbers, one per hour of the week from Monday 00:00.

required
unit str

"minutes" (default) or "seconds", the model's time unit.

'minutes'

Returns:

Type Description
dict

{"points": [[duration, value], ...], "repeat": True}.

See Also

nagasim.build.Model : Takes the schedule in schedules.

Examples:

>>> from nagasim import build as nb
>>> nb.weekly_points([0] * 8 + [2] * 160)["points"]
[[480, 0], [9600, 2]]