Download page Importing and Exporting a State Variable.
Importing and Exporting a State Variable
You may find it useful to save the three parts of your script to a single file so that you can use a more sophisticated editor for building and editing your scripts. The Export function is very useful for this purpose. It will add comment lines to the file to label each section script code for the tab it belongs to. If you leave those comment lines intact during your external editing, you can use the Import function to bring your edited scripts back into the state variable's tabs in ResSim. This process is much easier and less error prone than using Ctrl+A to select all, then Ctrl+C to copy the contents of a tab to the Windows clipboard, then Ctrl+V to paste the clipboard contents into the external editor. Then you would have to reverse those steps to return the edited code back into the state variable ResSim.
To write the three scripts of your state variable to a file:
Select the state variable you want to export from the Name selector in the State Variable Editor.
Select Export from the State Variable menu.
An Export State Variable Script file browser will open. Use the browser to select the folder where you want to save the file and enter a filename in the File name field at the bottom. Note—although the browser has a field for Files of type: which defaults to Python Scripts, it does not use this setting to append an extension to the filename you entered; instead, it uses the file type to filter the list of files it shows. For convenience when you later want to Import your script file, we recommend that you add the extension .py to your exported script filenames.
Click the Export button to complete the export process and close the browser.
To read the three scripts of your state variable from a file that you had previously exported and place them into their respective tabs in the State Variable Editor:
Select the state variable you want to import from the Name selector in the State Variable Editor.
Select Import from the State Variable menu.
An Import State Variable Script file browser will open. Use the browser to locate and select the file you want to import. Note—the browser has a field for Files of type: which defaults to Python Scripts. It uses the file type to filter the list of files it shows; Python scripts use .py as the file extension.
Click the Import button to complete the import process and close the browser.
The contents of the three tabs of your current state variable will be replaced with the contents of the associated section from selected file.