3. Running an example

The Python packages pyfmi and pyjmi each contain a folder called examples in which there are several Python example scripts. The scripts demonstrate compilation, loading and simulation or optimization of models. The corresponding model files are located in the subdirectory files. The following code demonstrates how to run such an example. First a Python session must be started, see Section 2, “Starting a Python session” above. The example scripts are preferably run in the pylab Python shell.

The following code will run the RLC example and plot some results.

# Import the RLC example
from pyjmi.examples import RLC

# Run the RLC example and plot results

Open RLC.py in a text editor and look at the Python code to see what happens when the script is run.