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\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: This folder contains all Octave/Matlab scripting functionality and documentation |
a. | 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 - Octave Scripting API. Note: the API documentation is also accessible from the Windows Start menu under 20-sim 5.1\Scripting API documentation |
b. | library: This folder contains the core scripting functions. |
c. | tutorials: This folder contains basis scripts with a step by step explanation. You can use these scripts as a base for your own scripts. |
d. | examples: This folder contains some more advanced scripts. |
3. | Octave-patch: This folder contains modified Octave scripts for certain Octave versions to fix bugs in the core Octave scripts that are not yet fixed in the latest release (currently 4.0.3) |
4. | Python: This folder contains all Python scripting functionality and documentation (see the Scripting in Python section for more information). |