Skip to content

Toggles Sub-Module

t3co.input_data.toggles

Cost-component toggles loaded from cost_toggles.json.

Each toggle switches one cost component, or a model feature such as running FASTSim or fetching EIA fuel prices, on or off for a run.

Toggles dataclass

Class object that contains various toggles for TCO calculations.

Source code in src/t3co/input_data/toggles.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@dataclass
class Toggles:
    """
    Class object that contains various toggles for TCO calculations.
    """

    msrp: bool = True
    purchase_tax: bool = True
    purchasing_downpayment: bool = True
    mark_up: bool = True
    residual_cost: bool = True
    fuel_cost: bool = True
    eia_fuel_prices: bool = True
    maintenance_oper_cost: bool = True
    insurance_cost: bool = True
    purchasing_cost: bool = True
    fueling_dwell_labor: bool = True
    payload_oppy_cost: bool = True
    fueling_dwell_oppy_cost: bool = True
    mr_downtime_oppy_cost: bool = True
    run_fastsim: bool = True

    @classmethod
    def from_json(
        cls,
        cost_toggles_file: Union[Path, str] = gl.RESOURCES_FOLDERPATH
        / "cost_toggles.json",
    ) -> Self:
        """
        Creates a Toggles instance from a JSON file.

        Args:
            cost_toggles_file (Union[Path, str]): Path to the JSON file containing toggle settings.

        Returns:
            Toggles: An instance of the Toggles class.
        """
        with open(cost_toggles_file, "r") as f:
            toggles_dict = json.load(f)

        toggles_dict = to_flat_dict(toggles_dict, include_prefix=False, delimiter="")
        # print(toggles_dict)
        return cls(**toggles_dict)

from_json(cost_toggles_file=gl.RESOURCES_FOLDERPATH / 'cost_toggles.json') classmethod

Creates a Toggles instance from a JSON file.

Parameters:

Name Type Description Default
cost_toggles_file Union[Path, str]

Path to the JSON file containing toggle settings.

RESOURCES_FOLDERPATH / 'cost_toggles.json'

Returns:

Name Type Description
Toggles Self

An instance of the Toggles class.

Source code in src/t3co/input_data/toggles.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@classmethod
def from_json(
    cls,
    cost_toggles_file: Union[Path, str] = gl.RESOURCES_FOLDERPATH
    / "cost_toggles.json",
) -> Self:
    """
    Creates a Toggles instance from a JSON file.

    Args:
        cost_toggles_file (Union[Path, str]): Path to the JSON file containing toggle settings.

    Returns:
        Toggles: An instance of the Toggles class.
    """
    with open(cost_toggles_file, "r") as f:
        toggles_dict = json.load(f)

    toggles_dict = to_flat_dict(toggles_dict, include_prefix=False, delimiter="")
    # print(toggles_dict)
    return cls(**toggles_dict)