Skip to content

Simulation Engine

Attributes

airlines instance-attribute

airlines: Iterator[Airline]

base_time instance-attribute

base_time: int

The base time of the simulation.

bucketnames instance-attribute

bucketnames: Iterator[str]

buckets instance-attribute

buckets: Iterator[Bucket]

burn_samples instance-attribute

burn_samples: int

config instance-attribute

config: Config | None

demands instance-attribute

demands: Iterator[Demand]

disable_ap instance-attribute

disable_ap: bool

dwm_lite instance-attribute

dwm_lite: bool

fares instance-attribute

fares: Iterator[Fare]

iteration instance-attribute

iteration: int

last_dcp instance-attribute

last_dcp: int

last_event_time instance-attribute

last_event_time: int

legs instance-attribute

legs: Iterator[Leg]

manual_paths instance-attribute

manual_paths: bool

max_connect_time instance-attribute

max_connect_time: int

mkt_k_factor instance-attribute

mkt_k_factor: float

name instance-attribute

name: str

num_dcps instance-attribute

num_dcps: int

num_samples instance-attribute

num_samples: int

num_trials instance-attribute

num_trials: int

pathclasses instance-attribute

pathclasses: Iterator[PathClass]

paths instance-attribute

paths: Iterator[Path]

pax_type_k_factor instance-attribute

pax_type_k_factor: float

prorate_revenue instance-attribute

prorate_revenue: bool

When set to True, O&D revenue is prorated by mileage to the leg level

random_generator instance-attribute

random_generator: Generator

revenue instance-attribute

revenue: float

rm_start_sample instance-attribute

rm_start_sample: int

sample instance-attribute

sample: int

save_timeframe_details instance-attribute

save_timeframe_details: bool

snapshot_filters instance-attribute

snapshot_filters: list[SnapshotFilter] | None

sys_k_factor instance-attribute

sys_k_factor: float

tf_k_factor instance-attribute

tf_k_factor: float

Timeframe k-factor, controls variance in the passenger arrival curves

tf_z_factor instance-attribute

tf_z_factor: float

trial instance-attribute

trial: int

Functions

__init__

__init__(name: str = 'Incognito', random_generator=None)

add_airline

add_airline(airline: Airline) -> None

Add an Airline to the simulation

add_dcp

add_dcp(dcp_index: int, days_prior: int) -> None

Add dcp_index and days_prior. Must be added in ascending order of dcp_index

add_demand

add_demand(dmd: Demand) -> None

Add a Market Segment demand to the simulation.

add_event

add_event(e: Event) -> None

Add a user Event to the simulation.

add_fare

add_fare(fare: Fare) -> None

Add a Fare to the simulation.

add_frat5

add_frat5(frat5: Frat5) -> None

Add a Frat5 curve to the simulation.

add_leg

add_leg(leg: Leg) -> None

Add a Leg to the simulation.

add_path

add_path(path: Path) -> None

Add a Path to the simulation.

allocate_demand_to_tf

allocate_demand_to_tf(
    dmd: Demand,
    num_pax: int,
    tf_k_factor: float,
    endTS: int,
    debug: bool = False,
) -> tuple[int]

Generate events for a single demand

Parameters:

  • dmd (Demand) –
  • num_pax (int) –
  • tf_k_factor (float) –
  • endTS (int) –
  • debug (bool, default: False ) –

Returns:

  • int

    Number of events allocated.

allocate_demand_to_tf_pods

allocate_demand_to_tf_pods(
    dmd: Demand,
    num_pax: int,
    tf_k_factor: float,
    endTS: int,
    debug: bool = False,
) -> tuple[int]

Generate events for a single demand (used to simulate PODS processing)

Parameters:

  • dmd (Demand) –
  • num_pax (int) –
  • tf_k_factor (float) –
  • endTS (int) –
  • debug (bool, default: False ) –

Returns:

  • tuple[int]

    Number of events allocated by DCP.

build_connections

build_connections() -> None

Build connections for the demands.

build_expiration

build_expiration() -> datetime.datetime

Get the expiration time for this build.

final_write_to_sqlite

final_write_to_sqlite(cnx: sqlite3.Connection)

Write final summary details to sqlite

get_days_prior

get_days_prior(dcp_index: int) -> int

Get days_prior for this dcp_index

go

go() -> Any

Run the simulation.

license_info

license_info(user_cert=None) -> str

Access license info as a human-readable string.

Parameters:

  • user_cert (Certificate, default: None ) –

    The license.

Returns:

  • str

num_events

num_events() -> int

Return the number of events currently on the event queue.

path_2_leg

path_2_leg(airline: str) -> None

Aggregate PathClass forecasts to Leg/Bucket

reset_counters

reset_counters() -> None

Reset counters for sold & revenue, for demands and legs.

set_parm

set_parm(name: str, value: float) -> None

Set a simulation parameter by name and value

update_db_write_flags

update_db_write_flags()

Update database writing flags based on config.

validate_license

validate_license(user_cert=None, future: int = 0) -> None

Validate a user's license certificate.

Parameters:

  • user_cert (Certificate, default: None ) –

    The license.

  • future (int, default: 0 ) –

    Validate as if it is this many days in the future. This is primarily used for debugging and testing. This is treated as an unsigned integer internally, so negative values will not go back in time.

Raises:

  • RuntimeError

    If the license certificate is not valid.

write_to_sqlite

write_to_sqlite(
    cnx: sqlite3.Connection,
    dcp: int,
    store_bid_prices: bool = True,
    intermediate_day: bool = False,
)

Write details to sqlite