Demod mosaik adapter
This repository contains adapter classes for all demod classes into mosaik.
This works with mosaik versions 2 and 3.
demod
Demod is a Python library for assembling bottom-up domestic energy demand models.
mosaik
Mosaik’s main goal is to use existing simulators in a common context in order to perform a coordinated simulation of a given (Smart Grid) scenario.
Usage
demo.py show usage example inside a mosaik simulation script.
Adapting a new simulator
If you want to adapt a new demod simulator, you can follow this instruction.
- Import the abstract adapter. If the demod simulator simulates various households, use the Household module. For a single value simulated (ex. climate), use The SingleValue module.
from mosaikdemod.adaptors import AbstractHouseholdsModule
from mosaikdemod.adaptors import AbstractSingleValueModule
- import demod library
import demod
- Inherit from the abstract module
class ComponentSimulator(AbstractHouseholdsModule):
- Specify the attributes of the simulator that can be accessed
attributes_dict = {
'attr_name_in_mosaik': 'get_demod_getter',
'other__attr': 'get_smth_else',
...
}
- Specify the inputs of the simulator that can be accessed
step_inputs_dict = {
'attr_name_in_mosaik': 'step_input_demod',
'other_input': 'input_other',
...
}
- Override the
__init__()method
def __init__(
self,
simulated_component='CompName', # Name of what is simulated used for mosaik instances
default_simulator=demod.simulators.example_simulators.ExampleSimulator, # The simulator class you want to simulate
step_size=60 # The mosaik step size (depend on your definition)
):
super().__init__(simulated_component, default_simulator, step_size)
- Import your simulator to your mosaik scenario script.
# Define the Simulator
sim_config = {
...
'CompNameSimulator': {
'python': 'python_file_of_the_sim:ComponentSimulator',
},
...
}
# Instantiate the simulator
sim = world.start('CompNameSimulator')
# Instantiate the households with parameters
component = actsim.HouseholdsGroupCompName(
inputs_params={ # demod init params of sim
'n_households': n_households,
'start_datetime': START_DATETIME,
...
}
)
# OR instantiate a SingleValue simulator (remove HouseholdsGroup)
component = actsim.CompName(
inputs_params={ # demod init params of sim
'start_datetime': START_DATETIME,
...
}
)
- Connect the simulators. You can connect a whole household group to another one if you use 2 demod components. Or you can also connect all the households individually by calling the children method
# Connect 2 demod components
# comp1 passes attr to comp2
world.connect(component1, component2, 'attr_name_in_mosaik')
# Connect 2 demod components with single value
# component_single_value passes attr to comp2
world.connect(component_single_value, component2, 'attr_name_in_mosaik')
# Connect a single household using the children
world.connect(component.children[42], other_mosaik_comp, 'attr_name_in_mosaik')
Examples
Some examples can be found in simulator_mosaik_modular.py.
Metadata
Release files for mosaikdemod 0.1.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mosaikdemod-0.1.post1.tar.gz | 18.1 kB | Without provenance | Details for mosaikdemod-0.1.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mosaikdemod-0.1.post1-py3-none-any.whl | Python 3 | none | any | Details for mosaikdemod-0.1.post1-py3-none-any.whl |
Total release size: 36.2 kB
Release files / mosaikdemod-0.1.post1.tar.gz
| Download URL | mosaikdemod-0.1.post1.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12da3d6ef0753dbca3317de49cfbe3bb9d212c9d3b6ea1e397abaa469914766f
|
|
BLAKE2b-256 checksum How to use checksums |
4595755869e2e357d4eab8f926cc21441fa7d07542f1af45a64767bd1efdb552
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0
|
Release files / mosaikdemod-0.1.post1-py3-none-any.whl
| Download URL | mosaikdemod-0.1.post1-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6863bd997a7aef30710b6bf6a32ca1cc7488df45550755e32a875a1a85b788c
|
|
BLAKE2b-256 checksum How to use checksums |
ec815bb9589e9c208efcd69085ed27e93da4077d1e6888fdcedfe17aa72945c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0
|
Security for mosaikdemod 0.1.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.