20-sim comes with a Scripting Folder that contains documentation of all scripting functions, the function library and example scripts. You have to install this folder to use scripting.
1. | Open the Install Scripting program from the Windows Start menu (located under 20-sim 5.1) - or - Go to the folder where 20-sim is installed (e.g. C:\Program Files (x86)\20-sim 5.1\Scripting or C:\Program Files (x86)\20-sim 5.1\Scripting) and open 20simScripting.exe |
2. | This will open a dialog where you can choose where to extract the 20-sim scripting files. Change the path to a local working folder of your choice (for example: C:\Users\yourusername\Documents\20simscripting) |
20-sim Scripts extraction
Note: To write/modify scripts, the scripting folder should be accessible and writable by the user. Do not install the scripting folder on C:\Program Files (x86) or C:\Program Files.
For the remainder of this chapter, we use the name scripting working folder when we refer to the folder where you just extracted the 20-sim scripting files.
Your newly created scripting working folder contains a number of subfolders:
1. | Models: This folder contains the 20-sim models and data files that are used for the example and tutorial scripts . |
2. | Octave and Octave-patch: These folders contain Octave/Matlab scripting functionality and documentation (see the Scripting in Octave/Matlab section for more information) |
3. | Python: This folder contains all Python scripting functionality and documentation: |
a. | controllab: Folder containing the Python classes that allow communication with 20-sim. |
b. | documentation: This folder contains the scripting API documentation: a list of supported functions and their syntax. It is a copy of the help file that you can open in the 20-sim Editor by selecting Help - Python Scripting API. |
c. | examples: This folder contains some more advanced scripts. |
d. | tutorials: This folder contains basis scripts with a step by step explanation. You can use these scripts as a base for your own scripts. |