nrel.hive.app.hive_cosim

Module Contents

Classes

CrankResult

Typed version of namedtuple.

Functions

load_scenario(→ nrel.hive.runner.RunnerPayload)

load a HIVE scenario from file and return the initial simulation state

crank(→ CrankResult)

advances the previous HIVE state some number of time steps

close(runner_payload)

closes a hive simulation, finalizing all logging.

Attributes

T

nrel.hive.app.hive_cosim.T
nrel.hive.app.hive_cosim.load_scenario(scenario_file: pathlib.Path, custom_instruction_generators: Tuple[T, Ellipsis] | None = None, custom_init_functions: Iterable[nrel.hive.initialization.initialize_simulation.InitFunction] | None = None, output_suffix: str | None = None) nrel.hive.runner.RunnerPayload[source]

load a HIVE scenario from file and return the initial simulation state :param scenario_file: the HIVE scenario file to read :return: the initial simulation state payload :raises: Error when issues with files

class nrel.hive.app.hive_cosim.CrankResult[source]

Bases: NamedTuple

Typed version of namedtuple.

Usage in Python versions >= 3.6:

class Employee(NamedTuple):
    name: str
    id: int

This is equivalent to:

Employee = collections.namedtuple('Employee', ['name', 'id'])

The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:

Employee = NamedTuple('Employee', name=str, id=int)

In Python versions <= 3.5 use:

Employee = NamedTuple('Employee', [('name', str), ('id', int)])
runner_payload: nrel.hive.runner.RunnerPayload
sim_time: nrel.hive.model.sim_time.SimTime
nrel.hive.app.hive_cosim.crank(runner_payload: nrel.hive.runner.RunnerPayload, time_steps: int, progress_bar: bool = False, flush_events: bool = True) CrankResult[source]

advances the previous HIVE state some number of time steps :param runner_payload: the previous HIVE state :param time_steps: the number of steps to take, using the timestep size set in the HiveConfig :param progress_bar: show a progress bar in the console :param flush_events: write all requested event logs to their file destinations

Returns:

the updated simulation state and all charge events that occurred

nrel.hive.app.hive_cosim.close(runner_payload: nrel.hive.runner.RunnerPayload)[source]

closes a hive simulation, finalizing all logging. does not need to be called, but, can only be called at most once as it will close file handlers. :param runner_payload: the final HIVE state to commit to logging