![]() |
Documentation of UrbanFireXDT
Documentation of UrbanFireXDT
|
Classes | |
| struct | SimulationControlUnitState |
| Represents the state of a single control unit during a simulation time step. More... | |
| struct | SimulationEVState |
| Represents the state of a single EV during a simulation time step. More... | |
Functions | |
| void | initialize_simulation (pybind11::dict args) |
| Initializes and starts the simulation from Python. | |
| unsigned long | get_next_timestep_id () |
| Returns the timestep ID of the next time step. | |
| bool | simulation_finished () |
| Checks if the simulation reached its end. | |
| SimulationControlUnitState | getState (unsigned long controlUnitID) |
| Retrieves the state of a control unit. | |
| void | sendCommands (unsigned long controlUnitID, pybind11::dict commands) |
| Sends a control command to a given control unit. | |
| void | run_one_step () |
| Executes a single simulation time step. | |
| void | reset_simulation_to_start () |
| Resets the simulation and all internal states to the first time step. | |
| void | vacuum () |
| Cleans up the simulation, finished the working thread and releases resources. | |
Variables | |
| std::thread | g_sim_worker |
| The worker thread for the simulation that is started by pyconn::initialize_simulation() | |
| std::atomic< bool > | g_sim_started {false} |
| States if the working thread for the simulation has been started. | |
| std::atomic< bool > | g_sim_finished {false} |
| States if the simulation has reached its final state (and cannot proceed anymore, or must be reseted to proceed) | |
| std::atomic< bool > | g_simulation_main_part_started |
| Flag indicating whether the simulation has finished the SAC planning and addition. | |
| std::atomic< bool > | g_simulation_idling |
| Flag indicating whether the simulation is currently idling or working. | |
| std::mutex | g_mtx_simulation |
| Mutex protecting synchronization between the simulation thread and Python calls. | |
| std::condition_variable | g_cv_sim_state_update |
| Condition variable to notify and to wait for changes in the simulation / python code state. | |
| std::atomic< bool > | g_next_step_requested |
| Flag indicating that a new simulation step should be executed. | |
| std::atomic< bool > | g_worker_threads_shutdown_cmd {false} |
| Flag indicating that all worker threads should shoutdown and the simulation should be finished. After that, no reset is possible anymore. | |
| std::atomic< unsigned long > | g_atomic_next_tsID |
| Shared variable indicating the next time step ID to be executed when calling pyconn::run_one_step() | |
| std::atomic< bool > | g_restart_simulation {false} |
| Flag indicating to restart the simulation after a reset of all internal states. | |
| float | expansion_matrix_rel_freq [16][16] = {0} |
| Variable storing the expansion matrix with relative frequencies - if using as stand-alone simulation, this is placed inside main and no global variable. | |
| unsigned long | expansion_matrix_abs_freq [16][16] = {0} |
| Variable storing the expansion matrix with absolute frequencies - if using as stand-alone simulation, this is placed inside main and no global variable. | |
| unsigned long | scenario_id |
| Variable storing the selected scenario ID - if using as stand-alone simulation, this is placed inside main and no global variable. | |
|
inline |
Returns the timestep ID of the next time step.
|
inline |
Retrieves the state of a control unit.
Returns information about the simulated components associated with the given control unit ID.
| controlUnitID | The external (public) ID of the control unit. |
|
inline |
Initializes and starts the simulation from Python.
This function sets up the simulation environment based on a dictionary of options, equivalent to command line arguments used in the standalone executable. Supported options include:
| args | A Python dictionary containing simulation options. |
| std::invalid_argument | If invalid options are provided. |
| std::runtime_error | If required files cannot be loaded or variables remain uninitialized. |
|
inline |
Resets the simulation and all internal states to the first time step.
All information and collected metrics inside the control units are deleted.
|
inline |
Executes a single simulation time step.
Advances the simulation by one time step and halts once new control commands can be accepted from Python.
This function returns control back to Python once the step is complete and the system is ready for new interactions.
|
inline |
Sends a control command to a given control unit.
This function can be used from Python to override or inject control signals into the simulation during runtime at the level of the control units (see class ControlUnit for details).
| controlUnitID | The external (public) ID of the control unit. |
| command | The control value/command to be applied. |
|
inline |
Checks if the simulation reached its end.
If the simulation can proceed, the function run_one_step() can be executed.
|
inline |
Cleans up the simulation, finished the working thread and releases resources.
This function should be called once a simulation is finished.
|
inline |
Variable storing the expansion matrix with absolute frequencies - if using as stand-alone simulation, this is placed inside main and no global variable.
|
inline |
Variable storing the expansion matrix with relative frequencies - if using as stand-alone simulation, this is placed inside main and no global variable.
|
inline |
Shared variable indicating the next time step ID to be executed when calling pyconn::run_one_step()
|
inline |
Condition variable to notify and to wait for changes in the simulation / python code state.
|
inline |
Mutex protecting synchronization between the simulation thread and Python calls.
|
inline |
Flag indicating that a new simulation step should be executed.
|
inline |
Flag indicating to restart the simulation after a reset of all internal states.
|
inline |
States if the simulation has reached its final state (and cannot proceed anymore, or must be reseted to proceed)
|
inline |
States if the working thread for the simulation has been started.
|
inline |
The worker thread for the simulation that is started by pyconn::initialize_simulation()
|
inline |
Flag indicating whether the simulation is currently idling or working.
|
inline |
Flag indicating whether the simulation has finished the SAC planning and addition.
|
inline |
Flag indicating that all worker threads should shoutdown and the simulation should be finished. After that, no reset is possible anymore.
|
inline |
Variable storing the selected scenario ID - if using as stand-alone simulation, this is placed inside main and no global variable.