Call me back | My basket | Checkout | Add to email list

     You are here: Website » Knowledge base

« back to website

PerformanceMonitor / ScriptingLanguage

Scripting Language

Introduction

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.

  • %
  • StartTest
  • EndTest
  • Declare
  • Temp_
  • Display
  • Prompt
  • Wait
  • RecordResult
  • Graph
  • Repeat
  • EndRepeat
  • OpenPromptWindow
  • ClosePromptWindow
  • GetTestName
  • GetLocationName
  • GetVehicleName
  • GetTesterName
  • GetNote
  • If
  • Endif
  • PlayAudio
  • RecordText


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)


Key Words

% (Comment Symbol)

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

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.


Declaring variables with Declare and Temp_ keywords

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.

Syntax:

     TEMP_XXXX

Values between 0000 and 4000 are valid for XXXX.

E.g.

   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.

For example:

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.


GetVariable

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)


Display

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.

Syntax:

   Display "<Text>", <Variable ID>, <Decimal  Places>, <Font Size>

Eg.

   Display "Speed", VAR_0015,2


Prompt

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)


Wait

The Wait keyword holds the script execution until a given condition is met.

Syntax:

   Wait <Condition>

E.g.

   Wait VAR_0015 >=100

In the above example system waits until speed become 100 kph


RecordResult

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.

Syntax:

   RecordResult "Display text", [Formula], [Decimal Places], ["Unit"]

E.g.

   RecordResult  "Start time:", TEMP_0001, 2

   RecordResult "Total time to 100 - to 0 mph : ", (TEMP_0004-TEMP_0003), 2, “s”


RecordText

Use this keyword to add extra description to the results to make the results clearer and easier to understand.

Syntax:

   RecordText "<Display text>"

E.g.

   RecordText “Variable values before reset”


Graph

The Graph keyword is used configure the Graph in the Results window.

Syntax:

   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)

E.g.

   Graph VAR_0015, 0, 120


Repeat()

Repeat keyword is used to repeat the statements inside Repeat block a given number times. Note that script editor supports nested Repeats.

Syntax:

  Repeat (<number of times>)
       %things to do here 
  EndRepeat

E.g.

Repeat(5)

   StartTest
	  Prompt "Accelerate to 100mph"
	  Wait VAR_0001 !=0
	  %Start time
	  TEMP_0001=VAR_0001
	  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
   EndTest

EndRepeat

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.
   Repeat (5)
     ...
   EndRepeat


2. Then add the instructions in between StartTest and EndTest statements.

Repeat(5)

  StartTest
    Prompt "Accelerate to 100mph"
    Wait VAR_0001 !=0
    ...
    ...
    RecordResult "Total time to 100 - to 0 mph : ",(TEMP_0004-TEMP_0003),2
  EndTest

EndRepeat

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.


OpenPromptWindow

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.

Syntax:

   OpenPromptWindow <Font Size>, <Display time in seconds>

E.g.

   OpenPromptWindow 50

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”)


ClosePromptWindow

This keyword is used to close the prompt window opened by the “OpenPromptWindow” command.

Syntax :

   ClosePromptWindow

E.g.

   ClosePromptWindow


Adding Information about the tests

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.

GetTestName

Syntax :

  GetTestName(<Text Here>)

E.g.

  GetTesterName(Enter test name)


GetLocationName

Syntax :

  GetLocationName (<Text Here>)

E.g.

  GetLocationName (Enter test location name)


GetVehicleName

Syntax :

  GetVehicleName (<Text Here>)

E.g.

  GetVehicleName (Enter Vehicle registration number)


GetTesterName - User can add tester/driver name during the test.

Syntax :

   GetTesterName (<Text Here>)

E.g.

   GetVehicleName (Enter Driver Name)


GetNote - User can add note/description during the test.

Syntax :

   GetNote (<Text Here>)

E.g.

   GetNote(This test for a typical 0 to 100mph standing start acceleration)


IF

Script editor supports nested IF statements. Basic syntax is given below:

Syntax:

   If (<Condition>)
   ...
   EndIf

E.g.

If(VAR_0015>100)

     TEMP_0001=VAR_0001
     TEMP_0002=0

EndIf


PlayAudio

This keyword used to play a given audio file (MP3 or WAV).

Syntax:

   PlayAudio "<Audio file path>"

E.g.

   PlayAudio "C:\StartTest.wav"

Note that system displays an error on test results window if it can't find the specified audio file.

Page last modified on March 03, 2015, at 10:03 AM