Performance editor comes with simple, yet powerful script editor. You can “program” the test to be done here.
Script editor features:
- It has very simple, but complete set of keywords to automate your tests
- All operators which supported by the Math Parser can be used in your scripts
- Keywords and variables are not case sensitive to minimize the syntax errors
- Nested If statements are supported.
- Nested loops are supported
List of Keywords supported by the Script Editor:
Note that keywords are not case sensitive.
Keywords by their usage
Keywords can be categorized as follows based on their usage:
- Comment mark-up (%)
- Getting information about the test from the user (GetTestName, GetLocationName, GetVehicleName, GetTesterName, GetNote)
- Configuring the Performance monitor window
- Configuring graph on the results section (Graph)
- Configuring to show a value of a variable (Display)
- Handling variables
- Variables (Declare, TEMP_)
- Change variable values during run time (GetVariable)
- Defining Main test section (StartTest, EndTest)
- Prompt Instructions to the user (OpenPromptWindow, ClosePromptWindow)
- Conditional Execution (If, EndIf, Wait) – If statements can be nested
- Repeating sections of code (Repeat, EndRepeat) – can be nested
- Writing test results to the disk (RecordResult)
- Adding descriptive text to the result to make them easy to understand. (RecordText)
- giving audible alert (PlayAudio)
This keyword tells Script Editor to ignore the words that follow it. Comments can follow a statement on the same line or can occupy an entire line. Both are shown below.
% This is a comment that begins at the left edge of the script editor window.
Wait VAR_0015==0 %Wait until the given condition is met
StartTest and EndTest keywords collectively define the main test block of a performance monitor script.
StartTest instructs the performance monitor to start logging the RUN data and test results. You must close this block with the EndTest keyword.
There are two ways to use the variables inside the script editor.
Variables defined using both of these methods can hold any type of values including integer, float, string, long, double, etc...
1. Use the Temp_ keyword to use variables on the fly without declaring them.
Values between 0000 and 4000 are valid for XXXX.
TEMP_0247 = VAR_0001
In the above example we assign the time (from channel VAR_0001) to the TEMP_0247 variable.
2. Using the Declare keyword to declare a variable with a given name.
Basically there is no difference between variables defined using Declare and TEMP_. But your script will be much more readable when using meaningful names to variables that match their intended use.
It is more readable if we declare the variables first and use them later in the script.
Declare StartTime, EndTime, TotalTimeTaken
TotalTimeTaken = EndTime - StartTime
Instead of using the following even if does the same job as the previous:
TEMP_0022 = TEMP_0021 – TEMP_0020
Note: Note that the Variables are not case sensitive.
Display an Input box, and ask user a value for a given variable during runtime. Variables declared with TEMP_ or Declare statements can be used here.
GetVariable (Enter value for variable, TEMP_2000)
GetVariable (Enter start time, StartTime)
This keyword is used to configure performance monitor to show a value of a variable on performance monitor window. Once the test starts, performance monitor starts updating the value.
Display "<Text>", <Variable ID>, <Decimal Places>, <Font Size>
Display "Speed", VAR_0015,2
The Prompt keyword is intended to be used to send information to the user to take some action, for example "Pull away now", "Start braking" etc.
To display the information on the PC, the prompt area must have been previously opened with the OpenPromptWindow command.
As well as displaying the information on the PC, the prompt will also be displayed on a DASH4, if this is included in the system. For example a typical setup might be:
- PC connected to a SPEEDBOX over USB
- DASH4PRO connected to a SPEEDBOX via its serial port
For syntax of the command is:
Prompt "Text Here", <optional Font Size>, <optional timeout when displaying on external DASH4PRO>, <optional value to display>
The timeout only relates to the DASH4PRO display, it has no effect on what is displayed on the PC. The timeout is in seconds, a value of 0 means it is displayed until the user presses set to clear it
The value to display can be a single variable, or a formula
For example, to display "Brake Now" in 18 point font on the PC and a display time for 5 seconds on the DASH4PRO:
Prompt "Brake Now", 18, 5
To display the difference between a target speed of 40 and the actual speed, you could use, and display it on the DASH4PRO until the set button is pressed:
Prompt "Exit Speed Error", 18, 0, (40-VAR_0015)
The Wait keyword holds the script execution until a given condition is met.
Wait VAR_0015 >=100
In the above example system waits until speed become 100 kph
The RecordResult keyword saves results to the disk and at the same time displays the results on “Test Results” window when test is being run.
RecordResult "Display text", [Formula], [Decimal Places], ["Unit"]
RecordResult "Start time:", TEMP_0001, 2
RecordResult "Total time to 100 - to 0 mph : ", (TEMP_0004-TEMP_0003), 2, “s”
Use this keyword to add extra description to the results to make the results clearer and easier to understand.
RecordText "<Display text>"
RecordText “Variable values before reset”
The Graph keyword is used configure the Graph in the Results window.
Graph <Variable ID>, <Min>, <Max>, < time (in seconds) along the x axis >
- Variable ID – ID of the Variable (from 1 to 8000) need to be shown in the graph.
- Min – Y axis minimum Value
- Max – Y axis maximum value
- time (in seconds) along the x axis- X axis time scale (X axis always display time and default value is 10)
Graph VAR_0015, 0, 120
Repeat keyword is used to repeat the statements inside Repeat block a given number times. Note that script editor supports nested Repeats.
Repeat (<number of times>)
%things to do here
Prompt "Accelerate to 100mph"
Wait VAR_0001 !=0
RecordResult "Start time:",TEMP_0001,2
Wait VAR_0015 >=100
TEMP_0002 = VAR_0001
Prompt "TEST COMPLETE"
RecordResult "Total time to 0 - to 100 mph : ",(TEMP_0002-TEMP_0001),2
Repeating a test a given number of times:
To repeat a test a given number of times you should add your instruction as follows.
1. First add a repeat block and define the number of times the test should be repeated.
%Test will be repeated 5 times.
2. Then add the instructions in between StartTest and EndTest statements.
Prompt "Accelerate to 100mph"
Wait VAR_0001 !=0
RecordResult "Total time to 100 - to 0 mph : ",(TEMP_0004-TEMP_0003),2
The tests will be listed in the result explorer as follows:
Note: If you include the Repeat block inside the StartTest and EndTest statements, Results will be saved to the disk as a single test.
This will prompt instructions to the user in a special large window for easy reading. The text displayed and the time it is displayed is configured using arguments.
OpenPromptWindow <Font Size>, <Display time in seconds>
If not specified following default values will be used for the arguments.
- Font Size = 72
- Display time in seconds = 0 (Prompt window will be displayed until it is closed by using “ClosePromptWindow”)
This keyword is used to close the prompt window opened by the “OpenPromptWindow” command.
It is possible to add information about the tests while script is being executed. Name of the test, test location, vehicle name, tester and additional notes are added using the following keywords.
GetTesterName(Enter test name)
GetLocationName (<Text Here>)
GetLocationName (Enter test location name)
GetVehicleName (<Text Here>)
GetVehicleName (Enter Vehicle registration number)
GetTesterName - User can add tester/driver name during the test.
GetTesterName (<Text Here>)
GetVehicleName (Enter Driver Name)
GetNote - User can add note/description during the test.
GetNote (<Text Here>)
GetNote(This test for a typical 0 to 100mph standing start acceleration)
Script editor supports nested IF statements. Basic syntax is given below:
This keyword used to play a given audio file (MP3 or WAV).
PlayAudio "<Audio file path>"
Note that system displays an error on test results window if it can't find the specified audio file.