create_scenario() function
Create and return a new scenario based on a scenario configuration.
This function checks and locks the configuration, manages application's version, and creates a new scenario from the scenario configuration provided.
If the scenario belongs to a cycle, the cycle (corresponding to the creation_date and the configuration frequency attribute) is created if it does not exist yet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
ScenarioConfig
|
The scenario configuration used to create a new scenario. |
required |
creation_date |
Optional[datetime]
|
The creation date of the scenario. If None, the current date time is used. |
None
|
name |
Optional[str]
|
The displayable name of the scenario. |
None
|
Returns:
Type | Description |
---|---|
Scenario
|
The new scenario. |
Raises:
Type | Description |
---|---|
SystemExit
|
If the configuration check returns some errors. |