src.system.projection.Projection

class src.system.projection.Projection(projection_parameters: ProjectionParameters, data_sources: DataSourcesRoot)

Abstract class that represents a projection moving forward through time. Inherit this class to implement a projection.

Inheritance Diagram

Inheritance diagram of Projection

Variables & Properties

projection_parameters

Projection parameters.

time_steps

Projection-wide timekeeping object.

data_sources

Data sources to be read at runtime.

output_dir_path

Output directory path to place projection output.

Methods

__init__(projection_parameters, data_sources)

Constructor method.

halt_projection()

By default, evaluating this method can trigger a halt in the main projection loop.

project_time_step()

Abstract method that is called every time step.

run_projection()

Runs the main projection loop, projecting forward one time step at a time.

setup_output()

Abstract method that sets up the projection's output structure.

write_output()

Convenience method that writes output for projection entity members.

Details

__init__(projection_parameters: ProjectionParameters, data_sources: DataSourcesRoot)

Constructor method. Sets the starting time step and declares projection entities. Override this method to declare additional projection entities.

Parameters:
  • projection_parameters – Set of projection parameters.

  • data_sources – Data sources to be read at runtime.

data_sources: DataSourcesRoot

Data sources to be read at runtime.

halt_projection() bool

By default, evaluating this method can trigger a halt in the main projection loop. Override this method to define custom halt logic. For example, halting when the policy count reaches zero.

The default behavior is to never halt the projection.

Returns:

Boolean to indicate whether the projection should be halted.

output_dir_path: str

Output directory path to place projection output.

abstract project_time_step() None

Abstract method that is called every time step. Its purpose is to define a calculation order within a single time step by calling methods from various projection entities. Override this method to define what occurs within a single time step.

Returns:

Nothing.

projection_parameters: ProjectionParameters

Projection parameters.

run_projection() None

Runs the main projection loop, projecting forward one time step at a time. Override this method to create a custom projection loop.

Returns:

Nothing.

abstract setup_output() None

Abstract method that sets up the projection’s output structure. Method is called serially for each projection before the projection starts running to avoid race conditions in parallel projection run setups.

Returns:

Nothing.

time_steps: TimeSteps

Projection-wide timekeeping object.

write_output() None

Convenience method that writes output for projection entity members. Note that this function behaves recursively, and will write output for nested projection entity members as well.

Returns:

Nothing.