Skip to content

Commit

Permalink
Fix deprecation error in docs and add more docstrings to SimulationMo…
Browse files Browse the repository at this point in the history
…dule
  • Loading branch information
cklb committed Oct 18, 2024
1 parent 4baee8f commit b8553cb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/simulation_core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Simulation Core
===============

.. automodule:: pymoskito.simulation_core
:members:
:members:
10 changes: 10 additions & 0 deletions docs/modules/simulation_modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Simulation Modules
==================



.. automodule:: pymoskito.simulation_modules
:members:
:private-members:
:exclude-members: SimulationModule

.. autoclass:: SimulationModule
:members:

.. autoproperty:: public_settings

.. automethod:: calc_output(self)
32 changes: 31 additions & 1 deletion pymoskito/simulation_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SimulationException(Exception):

class SimulationModule(QObject, metaclass=SimulationModuleMeta):
"""
Smallest unit pof the simulation framework.
Base unit of the simulation framework.
This class provides necessary functions like output calculation and holds
all settings that can be accessed by the user.
Expand Down Expand Up @@ -71,6 +71,12 @@ def __init__(self, settings):
@property
@abstractmethod
def public_settings(self):
"""
Dict of public settings.
This contains all settings that will be shown and can be edited
in the GUI.
"""
pass

@property
Expand All @@ -79,10 +85,27 @@ def settings(self):

@property
def tick_divider(self):
"""
Simulation tick divider.
This property controls the frequency at which this Module is evaluated
in the main simulation loop. If e.g. a value of `2` is provided, the
module will be evaluated at every 2nd step that the solver makes.
This feature comes in handy if discrete setups with different sample rates
are simulated.
"""
return self._settings["tick divider"]

@property
def step_width(self):
"""
The discrete step width that this module is called with.
This parameter will be set when the simulation is initialised
and is based on the solver step size and the selected tick
divider of the module.
"""
return self._settings["step width"]

@step_width.setter
Expand All @@ -91,6 +114,13 @@ def step_width(self, value):

@abstractmethod
def calc_output(self, input_vector):
"""
Main evaluation routine.
Every time the solver has made the amount of steps specified in `tick_divider`,
this method will be called to compute the next output of the module.
This is typically where the main logic of a module is implemented.
"""
pass


Expand Down

0 comments on commit b8553cb

Please sign in to comment.