Applicable to SunDAT Pro


Overview

Speed up the process of doing repetitive tasks with Scripting especially when you have to run the same scenarios for multiple projects.  Scripting allows you to run table creation and PV layout with a few clicks.  You can also create your own script similar to recording a macro in Excel.


TABLE OF CONTENTS

Interface


IDDescriptionIDDescription
1.File path of the script file
4.Run Script - Press to run the script
2.Open script button - open script in the console
5.Export script button - export your script
3.Doc - Opens SunDAT Scripting Guide
6.
Console


Jump to top of article


Step by Step Guide

Run a script

  1. Go to the Scripting tab to open the Scripting interface
  2. In the Scripting interface, click Open script button
  3. Select the JSON file you want to run.  SunDAT will tell you if it is a valid or invalid script.  In the console says Valid JSON file and commands, then you are able to run the script.
  4. Press the Run Script button and the script will start running in the console.
  5. The process will be complete when the console says Script file run successfully


Export your own script

  1. Start with a blank project and open SunDAT which will automatically start the process of record your steps to create a script
  2. Run through the process of creating a project in site configuration, table creation, block creation (optional), and then PV Layout.  
  3. After running through the steps of creating a layout, go to the Scripting tab.
  4. Press the Export Script to save the JSON file.


Tip: Another way to create your own script is to use one of the examples attached with this article


Jump to top of article


FAQ

What features can I script for

Site configuration, table creation, block creation and PV Layout  


What file format does the script have to be?

The script file format has to be in JavaScript Object Notation (JSON)


Do you have example scripts?

See the attached files with this article


How do I edit a script?

JSON format files can be opened in text editor programs like Notepad, Word Pad, or Sublime text.  From there you will be to edit and save the JSON file which can be imported into SunDAT. 

Is there a guide to explain the lines of code in a script?

You can refer to the SunDAT Scripting Guide in SunDAT, which provide descriptions and the attributes


Do I have to do anything to start recording my scripts?

SunDAT autamatically starts recording your actions the moment SunDAT is started and until SunDAT is closed.  


Jump to top of article


Troubleshooting

IssueCauseSolution
Exception: No such file or directory @ rb_sysopen - 
Script has not been loaded into the console
Press the Open Script to select your script.  If it is a valid script, then you can press Run script to begin the run.
Script file (JSON) was moved
Place the JSON file back into the original location or Press Open Script button to select the script in the new location.
Invalid JSON
The script file (JSON) has errors in its code.
Correct the error in the script file (JSON).  Refer to the SunDAT Scripting Guide to h
Exception : unable to find module name or Exception : unable to find inverter name 
Equipment is not in the Global library or in the User library
If using a custom equipment, make sure that the name of the equipment in the script matches exactly with the one in the User library


Jump to top of article