A SimulationWorkspace is a registry that holds all loaded
OmnetppProject and SimulationProject instances. It is the top-level
container in the opp_repl object hierarchy.
opp_repl creates a default workspace automatically at startup. Every
.opp file loaded via --load on the command line (or load_opp_file()
at runtime) is registered here. You rarely need to interact with the
workspace directly — the module-level helper functions delegate to it
behind the scenes:
get_default_simulation_workspace() # access it explicitly if needed
get_simulation_project("inet") # delegates to the default workspace
get_simulation_project_names() # lists all registered project namesProjects enter the workspace through .opp descriptor files. There are
several ways to load them:
# Load a single file
load_opp_file("~/workspace/inet/inet.opp")
# Load all *.opp files from a directory
load_opp_file("~/workspace/omnetpp/samples/aloha")
# Load with a glob pattern
load_opp_file("~/workspace/omnetpp/samples/*/*.opp")
# Load the bundled .opp files shipped with opp_repl
load_opp_file("@opp")
# Scan an entire workspace directory (loads all *.opp under it)
load_workspace("~/workspace")When loading multiple files, OmnetppProject files are always processed first, so that simulation projects can reference them by name.
Projects are registered as (name, version) pairs. Most of the time the
version is None (meaning "the only version"), and you look up projects by
name:
p = get_simulation_project("inet")When multiple versions of the same project are loaded, pass the version explicitly:
p = get_simulation_project("inet", version="4.5")The resolve_simulation_project() function accepts flexible designator
strings:
- Name —
"inet"looks up the registered project. - Name:version —
"inet:4.5"looks up a specific version. - Folder path —
"../inet-baseline"or an absolute path finds the project at that location (auto-loading its.oppfile if not already registered).
This is used internally by functions like compare_simulations() that
accept a project designator for the comparison target.
One project in the workspace is designated as the default. It is set automatically at startup to the project whose root folder contains the current working directory. It can also be set explicitly:
set_default_simulation_project(inet_project)Functions like run_simulations(), run_fingerprint_tests(), and
build_project() use the default project when no simulation_project
argument is given.
The workspace also tracks a default OmnetppProject. It is set
automatically as a side effect of set_default_simulation_project(),
but only when the default OMNeT++ project is currently None —
i.e., the inference fires once at startup and is not overwritten by
subsequent set_default_simulation_project() calls. If you have
already explicitly chosen a non-default OMNeT++ project, later calls
to set_default_simulation_project() will not change it.
When the inference does run, it goes:
- If the simulation project references a specific
OmnetppProject(viaomnetpp_project), that one becomes the default. - Otherwise, the project registered under the name
"omnetpp"is used as a fallback. - If neither exists, the default remains
None.
It can also be set explicitly:
set_default_omnetpp_project(omnetpp_project)
get_default_omnetpp_project() # retrieve the current defaultThe default OMNeT++ project is used by simulation projects that do not
specify their own omnetpp_project parameter.