Starting the Program

For PyMoskito to start, an application needs to launch the toolbox and execute it. To do so, create a file in the same directory as the model and name it:

main.py

Copy the following code into your main file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# -*- coding: utf-8 -*-
import pymoskito as pm

# import custom modules
import model


if __name__ == '__main__':
    # register model
    pm.register_simulation_module(pm.Model, model.PendulumModel)

    # start the program
    pm.run()

Note the import command in line 5, which includes the earlier implemented model file in the application. The command in line 10 registers the model to the toolbox. This lets PyMoskito know that this module is available and adds it to the eligible options in the interface. Line 13 finally starts our application.

Use the command line to navigate to the directory of the main file and the model file and start the toolbox with the command:

$ python main.py

The upstarting interface of PyMoskito gives you the possibility to test the implemented model in the next step.