Page tree
Skip to end of metadata
Go to start of metadata

Example 1 showed how to execute a test sequence that had only hardcoded values. Example 2 focused on the use of variables to define some parameters in the model. Example 3 will focus on the use of Excel to define the parameters of a test. This example will not go into much details regarding the blocks that were used in the first examples. It is recommended to do the two other examples before this one.

The starting point is the end of the Quick Start tutorial (Link to the Quick Start tutorial). Your TestView should now look like the Figure below.

Starting Point: Example 3

This example will modify the resistance of Ld2 in the example HVAC_500kV_6Bus model and try different faults.

Similarly to example 1 and 2, let’s start by making sure that the options Start simulation and Disable Time Events are checked and unchecked, respectively in the HYPERSIM Settings block and let’s add a sleep of 1 second.

To make a complete example, add a 'take snapshot' command to the script before adding a loop (in auto-detect mode and operation option enabled). The script should now look like the Figure below.

After adding the loop command

In the loop, it will be the execution section of the script. Therefore, we need to create the Excel file before going any further. Create a new Excel (xlsx) file anywhere. For this example, the Excel file was created inside the TestView project directory and named 'example3.xlsx'. 

There are different ways to right the values of the parameters in the Excel file. Please consult this section for more information.

In the newly created file, fill it out like in the Figure below.

The next step is to define two named range: the first one is for the inputs and the second one is for the results. To define the input named range, select all the data (including the header), right-click and select 'Define Name...'.  Any name can be given. In this example, we use 'inputs_testview'. Press OK.

Repeat the same steps, but with another range (that is empty) and define its name to 'output_testview'. This is were the results will be written by the 'TableOut' command. You do not need to select the exact size, TestView will automatically resize the range if the defined range is too small.

To verify that the named range were properly defined in Excel, go to the 'Formulas' ribbon and click on 'Name Manager'. Make sure the defined range are not overlapping. Save and close the Excel file.

Back to TestView! Double click on the Excel command, click of the '...', select the Excel file that was created, press 'Import from Excel' and the data from Excel should appear in the parameter section, as presented below. Press Apply.

Add a snapshot command to load the snapshot taken previously. Add the same processing command as example 2 (fastest way is to copy-paste it from the previous example).

The test sequence should now look like the Figure below.

The last step is to add a TableOut command to export the results to Excel. To do so, double-click on 'TableOut' in the Palette tab. Select the 'Export to Excel' option, get the directory of the Excel file, change to 'named range' and type 'output_testview' and add the desired results. Press apply.

Be careful that the 'TableOut' block is not inside the the loop! The script should now look like:

You can now run the test sequence. Once the test sequence is done, you can open the Excel file to see that the results were properly written:

  • No labels