Skip to content

Cycle class

Bases: _Entity, _Labeled

An iteration of a recurrent work pattern.

Many business operations are periodic, such as weekly predictions of sales data, monthly master planning of supply chains, quarterly financial reports, yearly budgeting, etc. The data applications to solve these business problems often require modeling the corresponding periods (i.e., cycles).

For this purpose, a Cycle represents a single iteration of such a time pattern. Each cycle has a start date and a duration. Examples of cycles are:

  • Monday, 2. January 2023 as a daily cycle
  • Week 01 2023, from 2. January as a weekly cycle
  • January 2023 as a monthly cycle
  • etc.

Cycles are created along with the Scenarios that are attached to them. At its creation, a new scenario is attached to a single cycle, the one that matches its optional frequency and its creation_date.

The possible frequencies are:

  • Frequency.DAILY
  • Frequency.WEEKLY
  • Frequency.MONTHLY
  • Frequency.QUARTERLY
  • Frequency.YEARLY

Example for January cycle

cycles

Let's assume an end-user publishes production orders (i.e., a production plan) every month. During each month (the cycle), he/she will be interested in experimenting with different scenarios until only one of those scenarios is selected as the official production plan to be published. Each month is modeled as a cycle, and each cycle can contain one or more scenarios.

The picture on the left shows the tree of entities: Cycles, Scenarios, and their associated Sequence(s). There is an existing past cycle for December and a current cycle for January containing a single scenario.

When comes the end of a cycle (start date + duration), only one of the scenarios is applied in production. This "official" scenario is called the primary scenario. Only one primary scenario per cycle is allowed.

Example for February cycle

cycles Now the user starts working on the February work cycle. He or she creates two scenarios for the February cycle (one with a low capacity assumption and one with a high capacity assumption). The user can then decide to elect the low capacity scenario as the "official" scenario for February. To accomplish that, he just needs to promote the low capacity scenario as primary for the February cycle.

The tree of entities resulting from the various scenarios created is represented in the picture on the left. The underlined scenarios are primary.

Note

For a scenario, cycles are optional. If a scenario has no Frequency, it will not be attached to any cycle.

Attributes

creation_date property writable

creation_date: datetime

The date and time of the creation of this cycle.

end_date property writable

end_date: datetime

The date and time of the end of this cycle.

frequency property writable

frequency: Frequency

The frequency of this cycle.

id instance-attribute

id: CycleId = id or _new_id(_name)

The unique identifier of the cycle.

name property writable

name: str

The name of this cycle.

properties property

properties: _Properties

A dictionary of additional properties.

start_date property writable

start_date: datetime

The date and time of the start of this cycle.

Methods

get_label()

get_label() -> str

Returns the cycle label.

Returns:

Type Description
str

The label of the cycle as a string.

get_simple_label()

get_simple_label() -> str

Returns the cycle simple label.

Returns:

Type Description
str

The simple label of the cycle as a string.