Scripting allows you to run tasks in 20-sim automatically using specialized scripting functions. With these functions you can open models, run simulations, change parameters, process the results and much more.
Watch the videos on scripting to get a quick overview.
Python is a general-purpose high-level programming language with an emphasis on code readability and writing algorithms in fewer lines of code than other programming languages.20-sim scripting functions can be run from a python program. 20-sim scripting has been tested with the following versions of Python: Python 2.7.x, Python 3.4.x and Python 3.5.x (32-bit and 64-bit). All Python functions can be found here.
With the installation of 20-sim, you can optionally install the Python 3.4 package. This installation provides just enough support to get started with 20-sim scripting. However, it does not provide a development IDE or an extensive set of scientific and mathematical libraries.
Matlab / Octave
20-sim scripting functions can be run as m-files in Matlab or GNU Octave. GNU Octave is a open source environment that allows you to run m-files similar to Matlab. If you don’t have a valid Matlab license, GNU Octave will be a useful alternative. All Octave functions can be found here.
Functions are available to open and simulate a 20-sim model, export parameters values to a 20-sim model, run simulations and store the results and much more. Combining multiple functions in m-files allows you to:
- read parameters from spreadsheets and load them into a 20-sim model,
- run calculations to deteremine parameter values and load them into a 20-sim model,
- run simulations and store the results on file,
- run simulations and perform calculations on the results,
- run multiple-scenario’s with 20-sim models,
- and more ..
20-sim comes with a set of example scripts:
- Read prarameters and run a simulation
- Model verification
- Compare simulation results
- Perform a Polynomial fit
- Create a bode plot out of simulation data
- Print to pdf-file
Example script with data import from Excel and bode plots generated from 20-sim simulation results.