Installation#
First, install Python on your computer. On Windows and Mac systems, you can install it from the Python official website. On Linux systems, Python is typically preinstalled.
For plotting figures in Python, a graphical user interface (GUI) library is required. The Tkinter GUI library comes by default with Python on Windows and Mac systems. On some Linux systems, you may need to install it separately. On Ubuntu, you can install it with the command:
sudo apt install python3-tk
Alternatively, you can use another GUI library such as PyQt6.
Install motulator using one of the following options.
Option 1: Use pip#
The simplest way to install motulator is to use pip
. Ensure that you have the latest pip
, which can be updated with the command:
pip install --upgrade pip
Then, install motulator:
pip install motulator
Note
Instead of global installation described above, using a virtual environment is generally recommended. Virtual environments are easiest to create and manage using some integrated development environment (IDE), see Option 2 below.
Option 2: Clone the Repository#
For developers and advanced users, we recommend cloning the repository from GitHub. This option allows you to get the most recent version of the repository. Furthermore, you can then modify the system models and example controllers. It is also advisable to use a virtual environment to avoid conflicts with other Python packages.
Several powerful open-source IDEs are available for Python. The following instructions are for VS Code:
Install VS Code, Python, and
git
on your computer. Install also the recommended Python extensions in VS Code.Clone the project (or fork it first and then clone your fork) using the command:
git clone https://github.com/Aalto-Electric-Drives/motulator
This will create a folder called motulator in your current directory.
Launch VS Code from the cloned project’s root directory on the command line (or choose the proper directory after launching VS Code).
Create a virtual environment in the workspace.
Enable installation of optional dependencies from
pyproject.toml
(selecting at leastdev
is recommended). Alternatively, for installing the project with its core dependencies, you may run the commandpip install .
in the VS Code terminal after the virtual environment is created and activated (or to include optional dependencies, runpip install .[dev,doc]
).
After completing the above steps, the virtual environment can be found in the .venv
directory at the root of the repository. Now you should be able to run all the examples as well as to modify the existing code. When you start VS Code next time, it will automatically detect the virtual environment and use it. If you installed the dev
dependencies, you can also use the interactive IPython console (click on the Play button dropdown menu in VS Code).
If you use Windows, you may need to change the default terminal from the PowerShell to the Command Prompt (press Ctrl+Shift+P for the command palette and search for Terminal: Select Default Profile). We hope that these instructions allow you to create a virtual environment and start working on the project. Similar steps can be followed for other IDEs.