Sei sulla pagina 1di 181

Automation manual

LMS Test.Lab

Rev 13A

Copyright LMS International 2012


Table of Contents

Chapter 1 What's New .................................................................................................... 7


Section 1.1 Revision news ...................................................................................... 7
Section 1.1.1 What's new in LMS Test.Lab Automation 10A ................................... 7
Section 1.1.2 What's new in LMS Test.Lab Automation 10ASL1 .......................... 10
Section 1.1.3 What's new in LMS Test.Lab Automation 11A ................................. 10
Section 1.1.4 What's new in LMS Test.Lab Automation 12A? ............................... 11

Chapter 2 Getting started ............................................................................................. 13


Section 2.1 How to use this help........................................................................... 13
Section 2.2 Tutorial 1 ........................................................................................... 14
Section 2.3 Tutorial 2 ........................................................................................... 15

Chapter 3 Using Test.Lab Automation ........................................................................ 19


Section 3.1 Connceting with the application ........................................................ 19
Section 3.1.1 Sample code ....................................................................................... 19
Section 3.1.2 How yo connect to a running Test.Lab application ........................... 19
Section 3.1.3 How to start up a Test.Lab application .............................................. 19
Section 3.2 Selecting and saving a block .............................................................. 20
Section 3.2.1 Sample code ....................................................................................... 20
Section 3.2.2 How to select a block of a database ................................................... 20
Section 3.2.3 How to select a block in the navigator ............................................... 21
Section 3.2.4 How to save the new created blocks .................................................. 22
Section 3.3 Reading and changing a block ........................................................... 22
Section 3.3.1 Sample code ....................................................................................... 22
Section 3.3.2 How to read the X/Y values of a block .............................................. 23
Section 3.3.3 How to change the X values of a block ............................................. 23
Section 3.3.4 How to change the Y values of a block ............................................. 24
Section 3.3.5 How to read and change the header fields of a block......................... 24
Section 3.3.6 How to read and change the Y unit of a block ................................... 25
Section 3.3.7 How to change the Y values of a block from MKS to user units ....... 26
Section 3.4 Searching ........................................................................................... 27
Section 3.4.1 How to search for all blocks on the active project ............................. 27
Section 3.4.2 How to add elements to Input Basket ................................................ 28
Section 3.5 Block commands................................................................................ 29
Section 3.5.1 Sample code ....................................................................................... 29
Section 3.5.2 How to create a scalar ........................................................................ 29
Section 3.5.3 How to create a random block ........................................................... 29
Section 3.5.4 How to create a sine wave ................................................................. 30
Section 3.5.5 Gow to add a scalar to a block ........................................................... 31
Section 3.5.6 How to do a weighting on a block ..................................................... 31
Section 3.5.7 How to multiply 2 blocks ................................................................... 31
Section 3.5.8 How to calculate the loudness of a block ........................................... 32
Section 3.6 Display and plotting ........................................................................... 32
Section 3.6.1 How to display a block in a running application ................................ 32
Section 3.6.2 How to print a block in a word document .......................................... 33
Section 3.6.3 How to add a single x-cursor to the front of a Front/back display ..... 35
Section 3.6.4 How to modify axis properties of any display ................................... 35
Section 3.7 Controlling a measurement in Signature ............................................ 36
Section 3.7.1 How to start a measurement ............................................................... 36
Section 3.7.2 How to stop a measurement ............................................................... 36

Rev 13A 3
Section 3.7.3 How to change the run name and to be informed if it is changed ...... 37
Section 3.7.4 How to define the Channel Setup parameters .................................... 38
Section 3.8 Using the module loader .................................................................... 38
Section 3.8.1 How to load a module (in VB6.0) ...................................................... 38
Section 3.8.2 How to load a module (in VB.NET) .................................................. 40
Section 3.8.3 How to access the PictureManager of a Module Loader ................... 43
Section 3.8.4 How to access data via a Module Loader .......................................... 44
Section 3.9 General guidelines ............................................................................. 44
Section 3.9.1 How to access the Test.Lab Type library in VB ................................ 44
Section 3.9.2 How to access the Test.Lab Type library in VB.NET ....................... 45
Section 3.9.3 How to use data watches .................................................................... 46
Section 3.9.4 How to make your own add-in in VB.6.0 .......................................... 48
Section 3.9.5 How to make your own add-in in VB.NET ....................................... 50
Section 3.9.6 How to deal with Test.Lab objects..................................................... 52
Section 3.9.7 How to read/write an enumeration value ........................................... 53
Section 3.9.8 How to specify a path ........................................................................ 54

Chapter 4 Examples ..................................................................................................... 57


Section 4.1 General:.............................................................................................. 57
Section 4.2 Example 1: ......................................................................................... 57
Section 4.3 Example 2: ......................................................................................... 57
Section 4.4 Example 3: ......................................................................................... 57
Section 4.5 Example 4: ......................................................................................... 58
Section 4.6 Example 5: ......................................................................................... 58
Section 4.7 Example 6: ......................................................................................... 58
Section 4.8 Example 7: ......................................................................................... 58
Section 4.9 Example 8: ......................................................................................... 58

Chapter 5 Reference guide .......................................................................................... 59


Section 5.1 Introduction to Automation................................................................ 60
Section 5.1.1 Key concepts ...................................................................................... 60
Section 5.1.2 Object models .................................................................................... 61
Section 5.1.3 Object interfaces ................................................................................ 62
Section 5.1.4 Type library files ................................................................................ 64
Section 5.2 The Test.Lab Automation Library ..................................................... 65
Section 5.3 IApplication ....................................................................................... 65
Section 5.3.1 Contents ............................................................................................. 66
Section 5.3.2 Definition ........................................................................................... 66
Section 5.3.3 Methods ............................................................................................. 71
Section 5.3.4 Properties ........................................................................................... 75
Section 5.4 IAttributeMap .................................................................................... 78
Section 5.4.1 Contents ............................................................................................. 79
Section 5.4.2 Definition ........................................................................................... 79
Section 5.4.3 Methods ............................................................................................. 80
Section 5.4.4 Properties ........................................................................................... 81
Section 5.5 IDataWatch ........................................................................................ 82
Section 5.6 FE35................................................................................................... 83
Section 5.6.1 Contents ............................................................................................. 83
Section 5.6.2 Definition ........................................................................................... 83
Section 5.6.3 Properties ........................................................................................... 84
Section 5.6.4 Events ................................................................................................ 88
Section 5.7 Enumerate .......................................................................................... 89
Section 5.7.1 Contents ............................................................................................. 89
Section 5.7.2 Definition ........................................................................................... 89
Section 5.7.3 Methods ............................................................................................. 90

4 LMS Test.Lab Automation manual


Section 5.7.4 Properties ........................................................................................... 91
Section 5.8 Factory ............................................................................................... 92
Section 5.8.1 Contents ............................................................................................. 92
Section 5.8.2 Definition ........................................................................................... 92
Section 5.8.3 Methods ............................................................................................. 93
Section 5.9 IBlock2 .............................................................................................. 94
Section 5.9.1 Contents ............................................................................................. 95
Section 5.9.2 Definition ........................................................................................... 95
Section 5.9.3 Properties ........................................................................................... 96
Section 5.9.4 Methods ........................................................................................... 100
Section 5.10 IBook ............................................................................................... 106
Section 5.10.1 Contents ........................................................................................... 106
Section 5.10.2 Definition ......................................................................................... 106
Section 5.10.3 Properties ......................................................................................... 107
Section 5.10.4 Methods ........................................................................................... 113
Section 5.11 IBooks .............................................................................................. 117
Section 5.11.1 Contents ........................................................................................... 117
Section 5.11.2 Definition ......................................................................................... 117
Section 5.11.3 Properties ......................................................................................... 118
Section 5.12 ICmd ................................................................................................ 119
Section 5.12.1 Contents ........................................................................................... 120
Section 5.12.2 Definition ......................................................................................... 121
Section 5.12.3 Methods ........................................................................................... 121
Section 5.13 AdvancedCmd ................................................................................. 128
Section 5.13.1 Properties ......................................................................................... 129
Section 5.14 ICrossCursor .................................................................................... 129
Section 5.15 ICursor ............................................................................................. 129
Section 5.16 ICursorManager ............................................................................... 129
Section 5.17 IData ................................................................................................ 129
Section 5.18 IDatabase ......................................................................................... 130
Section 5.18.1 Contents ........................................................................................... 130
Section 5.18.2 Definition ......................................................................................... 130
Section 5.18.3 Methods ........................................................................................... 133
Section 5.18.4 Properties ......................................................................................... 136
Section 5.19 IDataBrowser ................................................................................... 138
Section 5.19.1 Contents ........................................................................................... 138
Section 5.19.2 Definition ......................................................................................... 138
Section 5.19.3 Methods ........................................................................................... 139
Section 5.19.4 Properties ......................................................................................... 139
Section 5.20 IDisplay............................................................................................ 140
Section 5.21 IDoubleCrossCursor ........................................................................ 140
Section 5.22 IDoubleCursor ................................................................................. 140
Section 5.23 IDoubleRatioCursor ......................................................................... 140
Section 5.24 IExplorer .......................................................................................... 140
Section 5.24.1 Contents ........................................................................................... 141
Section 5.24.2 Definition ......................................................................................... 141
Section 5.24.3 Properties ......................................................................................... 142
Section 5.25 IGeometry ........................................................................................ 144
Section 5.25.1 Contents ........................................................................................... 144
Section 5.25.2 Definition ......................................................................................... 145
Section 5.25.3 Methods ........................................................................................... 145
Section 5.25.4 Properties ......................................................................................... 151
Section 5.26 IHarmonicCrossCursor .................................................................... 152
Section 5.27 IHarmonicCursor ............................................................................. 152
Section 5.28 IHarmonicRatioCursor ..................................................................... 152
Section 5.29 IHeader ............................................................................................ 152
Section 5.30 IModule............................................................................................ 153
Section 5.30.1 Contents ........................................................................................... 153

Rev 13A 5
Section 5.30.2 Definition ......................................................................................... 153
Section 5.30.3 Methods ........................................................................................... 154
Section 5.30.4 Properties ......................................................................................... 156
Section 5.31 InProcApplication ............................................................................ 157
Section 5.32 InputBasket ...................................................................................... 158
Section 5.32.1 Contents ........................................................................................... 158
Section 5.32.2 Methods ........................................................................................... 158
Section 5.32.3 Properties ......................................................................................... 159
Section 5.33 IPicture............................................................................................. 159
Section 5.34 IPictureManager............................................................................... 159
Section 5.35 IPrintManager .................................................................................. 159
Section 5.36 IQuantity .......................................................................................... 159
Section 5.37 IRatioCursor .................................................................................... 160
Section 5.38 IScalar .............................................................................................. 160
Section 5.39 ISheet ............................................................................................... 160
Section 5.40 ISheets.............................................................................................. 160
Section 5.41 ISingleCursor ................................................................................... 160
Section 5.42 IUnitSystem ..................................................................................... 160
Section 5.42.1 Contents ........................................................................................... 161
Section 5.42.2 Definition ......................................................................................... 161
Section 5.42.3 Methods ........................................................................................... 162
Section 5.42.4 Properties ......................................................................................... 164
Section 5.43 LMS Unit System ............................................................................ 164
Section 5.44 IWatch.............................................................................................. 165
Section 5.45 IWaterfall (not yet implemented) ..................................................... 165
Section 5.45.1 Content ............................................................................................. 166
Section 5.45.2 Methods ........................................................................................... 166
Section 5.45.3 Properties ......................................................................................... 167
Section 5.46 SearchBasket.................................................................................... 169
Section 5.47 SearchEngine ................................................................................... 169
Section 5.47.1 Contents ........................................................................................... 170
Section 5.47.2 Definition ......................................................................................... 170
Section 5.47.3 Methods ........................................................................................... 171
Section 5.47.4 Properties ......................................................................................... 171
Section 5.48 StartPointFactory ............................................................................. 172
Section 5.48.1 Content ............................................................................................. 173
Section 5.48.2 Definition ......................................................................................... 173
Section 5.48.3 Properties ......................................................................................... 174
Section 5.49 Workspace ....................................................................................... 174
Section 5.49.1 Contect ............................................................................................. 175
Section 5.49.2 Methods ........................................................................................... 175
Section 5.49.3 Properties ......................................................................................... 177

6 LMS Test.Lab Automation manual


Chapter 1 What's New

Chapter 1 What's New

In This Chapter
Revision news.....................................................................7

Section 1.1 Revision news

Section 1.1.1 What's new in LMS Test.Lab Automation 10A

Section 1.1.1.1 Changes to the ICmd interface


BLOCK_SRS A new block command was added to calculate the
"Shock Response Spectrum" starting from an
IBlock2
CONST_EnumSRSInstance Enumeration list of the possible SRS instances
(Maximum, Primary, Residual)
CONST_EnumSRSAmplitude Enumeration list of the possible SRS Amplitudes
(Abs, Pos, Neg)
CONST_EnumSRSCorrection Enumeration list of the SRS Correction (None,
DC, Veloc, DCVeloc, Displacement)

Section 1.1.1.2 Changes to the IBlock2 interface


UserYValues New method that allows the retrieval of the Y-values in
user units and a specific scale (Amplitude, Phase, Real,
Imag, dB, Log)

Section 1.1.1.3 Changes to the IGeometry interface


AddAcousticMesh Adds an acoustic mesh to the geometry
CreatePointMesh Adds a point mesh to the geometry

Rev 13A 7
Chapter 1 What's New

Section 1.1.1.4 Changes to the IApplication and IModule interface


ShowInteractiveMessages Property to allow the displaying of interactive
messages from the server

Section 1.1.1.5 Changes to the IBook interface


ActiveProjectWatch Returns a Watch object that holds and reports on the
Active Project Name associated with this book
UpdateWatches Updates a series of datawatches simultaneously

Section 1.1.1.6 Changes to the TdfSink interface


GetLastClosedTDFFile Returns the name of the last closed TDF file and the
limits (begin/end) date & time

Section 1.1.1.7 New interface AutomaticTuningSettings


Damping Returns the user defined Damping
StepFactor Returns the user defined Step Factor
TargetInvMIF Returns the user defined Target InvMIF value
PhaseTolerance Returns the user defined Phase Tolerance

Section 1.1.1.8 New interface AutomaticTuningState


Frequency Returns the current excitation frequency
Amplitude Returns the current amplitude of the drive
Phase Returns the current phase of the drive
ResponseAmplitude Returns the amplitude of the measured responses
ResponsePhase Returns the phase of the measured responses
PhaseDiffMasterCtrlResp Returns the phase difference between the master
control channel and the master response channel
MinInvMIF Returns the minimum INV MIF value of all DOF
groups involved in the tuning
NrOfShakers Returns the number of shakers
NrOfResponses Returns the total number measured responses

8 LMS Test.Lab Automation manual


Chapter 1 What's New

Section 1.1.1.9 New interface AutomaticTuningResult


Frequency This function is used to set the new excitation frequency
NextFrequencyStep This function is used to set the frequency step
Amplitude This function is used to set the new amplitude of the
drive
Phase This function is used to set the new phase of the drive
TuningState This function is used to set the tuning status

Section 1.1.1.10 New interface IExternalAutomaticTuning


Update This function gets as input the current drives and responses.
Its output is the new drives that will be used to excite the
structure
Initialize This is an initialize function called at the start of the
automatic tuning. Its input is the user defined settings

Section 1.1.1.11 New interface TRMEventsSinkNotify


TRMEventConditionHandler Sends a notification that one event condition
occurred and the timestamp of this occurrence

Section 1.1.1.12 New interface TRMEventsSink


Events Sets the events in string format that the Sinks should watch
ResetEvents Resets the specified events, Events parameter is not used at
this moment
Callback Sets the callback pointer from the client

Section 1.1.1.13 New interface ISignatureAcquisitionCtr


GetOnlineDataWatch Returns a watch point to inspect LMS Test.Lab®
specific online data

Rev 13A 9
Chapter 1 What's New

Section 1.1.2 What's new in LMS Test.Lab Automation 10ASL1

Section 1.1.2.1 Changes to the Factory interface


CONST_EnumBindStrategy Bind strategy for a throughput object in the
Test.Lab project (Linked, SemiEmbedded)
CreateThroughputData An extra parameter for the bind strategy was added

Section 1.1.3 What's new in LMS Test.Lab Automation 11A

Section 1.1.3.1 Changes to the IDatabase interface


AddToInputBasket Adds an element available in database to input basket.

Section 1.1.3.2 Changes to the IDataBrowser interface


AddToInputBasket Adds an element available in data browser to input basket.

Section 1.1.3.3 Changes to the SearchBasket interface


AddToInputBasket Adds an element available in search basket to input
basket.
AddAllToInputBasket Adds all elements available in search basket to input
basket.

Section 1.1.3.4 Changes to the Workspace interface


AddToInputBasket Adds an element available in workspace to input basket.

Section 1.1.3.5 Changes to the InputBasket interface


Clear Removes all elements available in input basket.

Section 1.1.3.6 Changes to the IDisplay interface


FindWatch Returns a new watch to inspect/modify various display
settings.

10 LMS Test.Lab Automation manual


Chapter 1 What's New

Section 1.1.3.7 Changes to the IQuantity interface


QuantityDamage Returns a quantity to specify the level of damage.

Section 1.1.4 What's new in LMS Test.Lab Automation 12A?

Section 1.1.4.1 Changes to the IUnitSystem interface


Returns the default unit label for this quantity
Label
in the current unit set.

Returns the total number of quantities


QuantityCount
available in the unit system.

Retrieves one quantity by index from the unit


QuantityByIndex
system.

Returns the number of units for this quantity


UnitCount
in the current unit system.

Retrieves one unit label by index for this


UnitLabelByIndex
quantity in the current unit system.

Section 1.1.4.2 Changes to the ICmd interface


The Shock Response Spectrum of the block will
BLOCK_SRS be calculated. Now it returns three blocks instead
only one block.

Section 1.1.4.3 Changes to the IGeometry interface


Create the centroids (nodes in the
AddMeshCentroids middle of the surfaces) for an acoustic
mesh.

Add a HDCam acoustic mesh to the


CreateHDCamGeometry
geometry.

Retrieves the area of all surfaces in the


AcousticMeshArea
acoustic mesh

Rev 13A 11
Chapter 1 What's New

Retrieves the area of the acoustic


AcousticSurfaceArea
surface related to the centroid.

Section 1.1.4.4 Changes in ISignatureAcquisitionCtr interface


Returns a watch point to inspect LMS Test.Lab® specific
online data.
GetOnlineDataWatch
Now it is possible to specify update
MaxUpdateFrequency, IsAutoBuffered and InitialFiring
parameters.

12 LMS Test.Lab Automation manual


Chapter 2 Getting started

Chapter 2 Getting started

In This Chapter
How to use this help ...........................................................13
Tutorial 1 ............................................................................14
Tutorial 2 ............................................................................15

Section 2.1 How to use this help

This help is written for Visual Basic 6.0 users of LMS Test.Lab Automation.
Test.Lab Automation can also be used with as Visual Basic.net. The work
method might be little different in VB.net.

Technically, it is also possible to use Visual C++ , C Sharp, or any


programming language that has access to the COM-layer of Windows
Microsoft. LMS gives no support for these languages.

The first part gives you a lot of work methods, without going into depth about
why things are as they are. The background about all this can be found in the
reference guide.

Additional examples written in Visual C++, C# and VB.NET can be found on


the installation dvd, along with a text file explaining the content of the
examples, and a sample project.

Tutorial In this part (see "Tutorial 1" on page 14), we start directly with
creating a little program that controls a simple signature
measurement, and then display the resulting data. All the steps
for this task are explained one by one.

Using In this part (see "Using Test.Lab Automation" on page 19), we


Test.Lab give a whole bunch of little program examples. This gives
automation programmers a clear view on the possibilities of Test.Lab
Automation. Besides, some guidelines are given, about how to
find your way in the complete range of Test.Lab Automation
possibilities.

Reference In this part (see "Reference guide" on page 59), after a short
guide introduction to Automation, the complete object model of
Test.Lab is described in detail. The module loader and
datawatches get special attention.

Rev 13A 13
Chapter 2 Getting started

Section 2.2 Tutorial 1

Display a block in a Test.Lab Picture. Let us create a little program that displays
a (fixed) block in a Test.Lab Picture.

It has no user interface. It expects that a Test.Lab Desktop application is already


running. It first loads a fixed block. Then it creates a new display in the
Test.Lab Application. To end, it puts the block in the front of the display.

You can find the visual basic code of this example on <the installation
directory>/AutomationHelp/Tutorial/DisplayBlock
Step 1
The first thing you need is an installation of Test.Lab
Automatically, its automation interface is registered and its functionality is
available in the COM layer of MS Windows. This means that the automation
interface is already available when starting programming in Visual Basic.
Step 2
Let us start up Visual Basic, and make that it can access the Test.Lab
Automation objects.
Step 3
After this, you can start writing the code.
Step 4
Connect with the running application.
Dim TL As New LMSTestLabAutomation.Application
Step 5
Get the active project
Dim my_db As LMSTestLabAutomation.IDatabase
my_db = TL.ActiveBook.Database
Step 6
Read in the block from the active project
In this example, we use a fixed path to the block. If it does not exist, an error
message is given.
Dim my_block As LMSTestLabAutomation.IBlock2
my_block = my_db.GetItem("Section1/Run 1/Fixed
sampling/Runup/\Sections/Orders/Order 2.00 Point1")
Step 7
Get the picture manager
Dim datawatch_PictManag As LMSTestLabAutomation.DataWatch
Dim my_PictManager As LMSTestLabAutomation.IPictureManager
datawatch_PictManag =
TL.ActiveBook.FindDataWatch("Navigator_DataViewing_PictureManager")
my_PictManager = datawatch_PictManag.Data

14 LMS Test.Lab Automation manual


Chapter 2 Getting started

Step 8
Add a Picture to the picture manager
Dim my_picture As LMSTestLabAutomation.IPicture
my_picture = my_PictManager.AddPicture("1x2")
Step 9
Get the first display of this picture:
Dim my_display As LMSTestLabAutomation.IDisplay
my_display = my_picture.Display(0)
Step 10
Add the block to the display
my_display.AddData 0, my_block

Section 2.3 Tutorial 2

Controlling a measurement. Let us create a little program to do some Signature


measurements.

Our little program first loads a default project. It contains a very simple setup,
where 1 stationary measurement is done. Within the user interface of our
program, you can start the measurement and stop it. Meanwhile, you are kept
informed about the status (measuring, saving data, etc.) and overload info.

You can find the visual basic code of this example on

<the installation directory>/AutomationHelp/Tutorial/Acquisition


Step 1
The first thing you need is an installation of Test.Lab.
Automatically, its automation interface is registered and its functionality is
available in the COM layer of MS Windows. This means that the automation
interface is already available when starting programming in Visual Basic. .
Step 2
Let us start up Visual Basic, and make that it can access the Test.Lab
Automation objects.
Step 3
Create the following interface in a form in Visual Basic:

Rev 13A 15
Chapter 2 Getting started

Interface for Test.Lab

 Start = button, with name btnStart


 Stop = button, with name btnStop
 Orange area = textbox, with name txtRunStatus_Value
 Black area = textbox, with name txtOverloadInfo_Value
 For more help on creating interfaces in Visual Basic, please refer to the VB
manual.
Step 4
When starting, connect with Test.Lab.
Initialize with the correct template. This can be done in the Form_Load.
Dim TL as New LMSTestLabAutomation.Application
TL.Init ("-w SignatureAcquisitionFSStandard -a SignatureAcquisitionFS -t
ExampleAcq.tpl")
Step 5
Implement the start- and stop-button.
Step 6
Implement the status-bar.
The datawatch for the status-bar is "Measure_Acquisition_State", its type is:
LmsHq::DataModelI::SMonProcessingAttributes::IEnumRunAcquisitionState.
This datawatch has to be defined as a global variable:
dim WithEvents gDataWatch_AcqState As
LMSTestLabAutomation.DataWatch
Initialising the datawatch is done in the Form_Load:

16 LMS Test.Lab Automation manual


Chapter 2 Getting started

gDataWatch_AcqState =
TL.ActiveBook.FindDataWatch("Measure_Acquisition_State")
Then, a ValueChanged-callback must be installed.
Private Sub gDataWatch_AcqState_ValueChanged.(ByVal newValue as
Variant)
The newvalue is an enum of type:
LmsHq::DataModelI::SMonProcessingAttributes::IEnumRunAcquisitionState.
Since this is an enumerate, we can use this interface to interpret it.
The attribute map of Idata objects contains 1 item "EnumValue", containing the
int-value of the enumeration. You can read this enumeration value.
Dim enum_state As LMSTestLabAutomation.Enumerate
enum_state = newValue
txtRunStatus_Value = enum_state.LocalValue
End Sub
...
Step 7
Implement the overload bar
The datawatch then indicates if there has been an overload or not, is named
"Overload". Its type is:
LmsHq::DataModelI::Base::IBoolean.
This datawatch has to be defined as a global variable:
dim WithEvents gDataWatch_Overload As
LMSTestLabAutomation.DataWatch
Initialising the datawatch is done in the Form_Load:
gDatawatch_Overload = TL.ActiveBook.FindDataWatch("Overload")
Then, a ValueChanged-callback must be installed
Private Sub gDataWatch_overLoad_ValueChanged (ByVal newValue as
Variant)
The newvalue is a BOOLEAN
If NewValue = False Then
txtOverloadInfo_Value = "No Overload"
Else
txtOverloadInfo_Value = "Overload"
End If
End Sub
Step 8
Run the program. You should be able to do start and stop an acquisition with
your little program.

Rev 13A 17
Chapter 3 Using Test.Lab Automation

Chapter 3 Using Test.Lab Automation

In This Chapter
Connceting with the application .........................................19
Selecting and saving a block ..............................................20
Reading and changing a block............................................22
Searching ............................................................................27
Block commands ................................................................29
Display and plotting ...........................................................32
Controlling a measurement in Signature ............................36
Using the module loader.....................................................38
General guidelines ..............................................................44

Section 3.1 Connceting with the application

Section 3.1.1 Sample code

If you want to access any Test.Lab object, you always need a 'start' object. In
this case, this is a reference to the application itself. If a Test.Lab already runs,
you can connect to it. If not, you can start up the application you want to start.

Section 3.1.2 How yo connect to a running Test.Lab application

Launch Test.Lab application loader.

Dim TL As LMSTestLabAutomation.Application

TL = New LMSTestLabAutomation.Application

Section 3.1.3 How to start up a Test.Lab application

Step 1
Declarations.
Dim TL As New LMSTestLabAutomation.Application
Step 2
Load the workbook.

Rev 13A 19
Chapter 3 Using Test.Lab Automation

Load the desktop workbook, using the method Init on the application object
TL.Init ("-w DesktopStandard")
OR
Load the signature application.
TL.Init ("-w SignatureAcquisitionFSStandard")
OR
Load the signature application with a specific template and a specific project.
If you create further on a new project, this template will be used.
TL.Init ("-w SignatureAcquisitionFSStandard -t my_template
D:/LmsLocal/data/myproj")

Note: It is not possible to connect with 2 applications at the same time.

Section 3.2 Selecting and saving a block

Section 3.2.1 Sample code

When you have your application object (and your Test.Lab is running), how can
you then select a block? If you know the exact path of a block, you can look for
one specific block in a database. Another possibility is to select a block in the
navigator. Other ways of getting a block are not specified here: with some
Block Commands you can create a block, you can use the search functionality...
. Finally, an example of saving the block in a database is given.

For getting and saving data, some methods on an IDatabase object are used.

Section 3.2.2 How to select a block of a database

Step 1
Declarations.
Dim TL as New LMSTestLabAutomation.Application
Dim my_db As LMSTestLabAutomation.IDatabase
Dim my_block As LMSTestLabAutomation.Iblock2
Step 2
Get a reference to the specified database.
my_db = TL.Database("c:/temp/PrintResults/OrderTracking.lms")

20 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Step 3
Get the specific block.
my_block =
my_db.GetItem("Section1/Run1/Fixedsampling/Runup/Sections/Orders/Order
2.00 Mic1")

Note: How to specify a path in Test.Lab Automation

Section 3.2.3 How to select a block in the navigator

Step 1
Declaration
Dim TL As New LMSTestLabAutomation.Application
Dim my_db As LMSTestLabAutomation.IDatabase
Dim datawatch_NavigatorSelection As LMSTestLabAutomation.DataWatch
Dim datawatch_Block As LMSTestLabAutomation.DataWatch
Dim data_BlockPath as LMSTestLabAutomation.IData
Dim data_selection As LMSTestLabAutomation.IData
Dim my_block As LMSTestLabAutomation.IBlock2
Step 2
First thing to do is to create a data watch to the selection in the navigator.
This is a data watch on the Active Book of the application.
datawatch_NavigatorSelection =
TL.ActiveBook.FindDataWatch("Navigator_SelectedOIDs")
Step 3
Get the link to the selected items: read the data on this data watch:
data_selection = datawatch_NavigatorSelection.Data
For vi = 0 To data_selection.AttributeMap.Count - 1 Step 1
Step 4
Get the link to the vith selected item.
data_BlockPath = data_selection.AttributeMap(vi)
Step 5
Get the port to the vith selected item.

Note: This is a datawatch on the Application.

datawatch_block = TL.FindDataWatch(data_BlockPath)
Step 6
Test the type of the selected item.

Rev 13A 21
Chapter 3 Using Test.Lab Automation

If datawatch_block.Data.Type =
"LmsHq::DataModelI::Expression::CBufferIBlock" Then
Step 7
The block is found!
my_block = datawatch_block.Data
End If
Next vi

Section 3.2.4 How to save the new created blocks

You can save blocks somewhere in a database, on a path you specify yourself.
First verify if this path exists. If not, create it.

Some methods on a IDatabase object are used here.


Step 1
Create a section in a database
my_dB = TL.ActiveBook.Database
my_dB.AddSection "newsect"
Step 2
Add the block to the database
my_dB.AddItem "newsect", "the new block", my_block, 1

Section 3.3 Reading and changing a block

Section 3.3.1 Sample code

If you have a block, how can you interpret and change it? What are its values,
what is in the header? Access to these functionalities is via the IBlock2
interface.

Changing the block that you have found is not possible! If you change
something, you will always create another (new) block!!! You are not wasting
memory, only the part of the block that you change will be duplicated. It is then
up to you what you do with this new block.

For example, you can:

22 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

 save the new block


 display the new block
 use the new block for calculations

Section 3.3.2 How to read the X/Y values of a block

There can be different X-axis on 1 block. In the example, we will read them all
one by one. If there is no number specified, the first one is taken as default.

Note: The values read are MKS-values. If you want them to be in user units,
you still have to do that conversion.

Step 1
Declarations
Dim My_block as LMSTestLabAutomation.IBlock2
Dim Y_val() As Double
Dim X_val() As Double
Step 2
Read the Y-values.
Y_val = My_block.YValues
Step 3
Read the X-values of all different X-axis.
For vi = 0 To My_block.XCount - 1 Step 1
X_val = My_block.Xvalues(vi)
Next vi

Section 3.3.3 How to change the X values of a block

Note: The block itself never is changed. When the 'Replace' functions are used
on a block, you will always get a new block.

There can be different X-axis on 1 block. By specifying their number, you can
edit 1 of them. When specifying no number, the first one is take as default. You
can change the X-axis by specifying all values as integers, as doubles, or by
specifying the increment and start value. The latter is taken in the example. It
replaces the start value to 1, the increment to 0.05 of the default X-axis.
Step 1
Declarations
Dim My_block as LMSTestLabAutomation.IBlock2

Rev 13A 23
Chapter 3 Using Test.Lab Automation

Dim Block_result as LMSTestLabAutomation.IBlock2


Step 2
Replace the X-axis.
Block_result = My_block.ReplaceXEquidistantDoubleValues (1,0.05)

Section 3.3.4 How to change the Y values of a block

Note: The block itself will never be changed. When you use the 'Replace'
functions on a block, you will always get a new block.

You can create the new block with integers, or doubles, or complex values (as
they can be read out from a block). In this example, we use complex values.
Step 1
Declarations.
Dim my_block as LMSTestLabAutomation.IBlock2
Dim array_of_double_values () as Double
Dim block_result as LMSTestLabAutomation.IBlock2
Step 2
Change the Y-values
block_result = my_block.ReplaceYComplexValues ( array_of_double_values)

Section 3.3.5 How to read and change the header fields of a


block

The information that is looked for, can be found in the properties of a block.

The header of a block is an internal object used by the application itself. In


Test.Lab Automation you do not need to know either what is in this header, or
what is not.

The of properties depends on the type of blockdata you have. All existing
properties are described in the file 'attributes.txt' on (the Test.Lab installation
directory)/central/gridfilters. When asking for "Properties" on a block, you can
have a look to all available properties on this (kind of) block.

If a specific 'property' of a block needs to be changed, for the moment you first
have to change the header, and then replace the header. In the future, you can
use the function 'ReplaceProperty'. As a result, you will have a new block!

In the example, the point Id and the reference Id are read and changed into a
fixed string. Then, the direction is read out and changed.

24 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Step 1
Declarations.
Dim my_block as LMSTestLabAutomation.IBlock2
Dim block_result as LMSTestLabAutomation.IBlock2
Dim ReferenceId as String, PointId as String, Direction as string
Step 2
Read out the reference Id and point id of the block.
ReferenceId = my_block.Properties.Item("Reference point id")
PointId = my_block.Properties.Item("Point id")
Step 3
the reference Id and point id of the block to "myownpointid" and "myownrefId"
block_result = my_block.ReplaceHeader(my_block.Header.Edit("Reference
point id", "myownrefid"))
block_result = my_block.ReplaceHeader(my_block.header.edit("Point id",
"myownpointid"))
Step 4
Read out the direction.
The direction is stored as an enumeration object. The type of this IData object is
'LmsHq::DataModelI::Channel::CBufferIEnumDirections '
For types like this, you can use the "Enumerate" interface
Dim enumDirection as Enumerate
enumDirection = my_block.Properties.Item("Point direction")
Step 5
Now, change the direction of the new block to +RX.
enumDirection = enumDirection.ReplaceLocalValue("+RX")
block_result = my_block.ReplaceHeader(my_block.header.edit("Point
direction", enumDirection))

Section 3.3.6 How to read and change the Y unit of a block

Note: The block itself will never be changed. When you use the 'Replace'
functions on a block, you will always get a new block.

Each axes of a block has a quantity, that can be read out and changed.

This quantity is interpreted by the unit system, to recognize the unit of it.

In the example, the unit label of the Y-axis is read out. Then, this unit is
changed into the unit in the current unit system for Force.

Rev 13A 25
Chapter 3 Using Test.Lab Automation

Step 1
Declarations.
Dim TL as new LMSTestLabAutomation.Application
Dim my_block As LMSTestLabAutomation.IBlock2
Dim Quant1 As LMSTestLabAutomation.IQuantity
Dim Quant2 As LMSTestLabAutomation.IQuantity
Dim UnitSys As LMSTestLabAutomation.IUnitSystem
Dim UnitLabel as String
Step 2
Read the current Y-unit.
UnitSys = TL.UnitSystem
Quant1 = my_block.YQuantity
UnitLabel = UnitSys.Label(Quant1)
Step 3
Change the Y-quantity to Force.
Quant2 = unitsys.QuantityForce
block_result = my_block.ReplaceYQuantity(Quant2)

Section 3.3.7 How to change the Y values of a block from MKS


to user units

Values (X and Y) are always given in MKS-units. They can be transferred


easily to the user unit.
Step 1
Declarations.
Dim my_block As LMSTestLabAutomation.IBlock2
Dim Quant As LMSTestLabAutomation.Iquantity
Dim UnitSys As LMSTestLabAutomation.IUnitSystem
Dim Y_val as double()
Dim corrected_Y_val as double()
Step 2
Read the Y-values in MKS.
Y_val = my_block.YValues
Step 3
Read the Y-quantity and correct the Y-values to the user units.
UnitSys = TL.UnitSystem
Quant = my_block.YQuantity

26 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Corrected_Y_values = Unitsys.MKSToUserValues(Quant,Y_val)

Section 3.4 Searching

Section 3.4.1 How to search for all blocks on the active project

A search engine object allows to search for a specific datatype on a well-defined


location.

Possible datatypes are:


 Blocks
 Waterfalls
 Runs
 Sections
 Databases
 CADA-X Blocks
 CADA-X Tests
 CADA-X Projects
Possible locations are:
 the active project
 a specific directory on disk
 a specific file (or a part of the file)
 the SearchBasket.
In the example, we look for all blocks on the active project.
Step 1
Declarations
Dim TL As LMSTestLabAutomation.Application
Dim my_searchEngine As LMSTestLabAutomation.SearchEngine
Dim datawatch_explorer As LMSTestLabAutomation.DataWatch
Dim my_eplorer As LMSTestLabAutomation.IExplorer
Dim WithEvents watch_searchBusy As LMSTestLabAutomation.Watch
Dim my_startpoint As LMSTestLabAutomation.StartPoint
Step 2
Find the Search engine object (via the explorer)
TL = New LMSTestLabAutomation.Application
datawatch_explorer = TL.ActiveBook.FindDataWatch("Navigator_Explorer")

Rev 13A 27
Chapter 3 Using Test.Lab Automation

my_eplorer = datawatch_explorer.Data
my_searchEngine = my_eplorer.Search
Step 3
Define the watch on the state of the searchEngine
watch_searchBusy = my_searchEngine.State
Step 4
Launch the search (specifying the startpoint and the searchtype)
my_startpoint = my_searchEngine.StartPoint.ActiveProject
Call my_searchEngine.Search(my_startpoint, TestLab_Block)
Step 5
Implement the 'Value_changed' routine. This routine is called, anything changes
on the state of the SearchEngine.
Public Sub watch_searchBusy_ValueChanged(ByVal NewValue As Variant)
dim my_data_found As LMSTestLabAutomation.IData
dim my_block_found As LMSTestLabAutomation.IBlock
If (NewValue) Then
'Search is running
Else
'Search is not running
... '(check if it is already launched!)
If my_searchEngine.SearchBasket.Count >= 1 Then
'then some results are found
'read in the first result
my_data_found = my_searchEngine.SearchBasket.Item(0)
if my_ data_found.IsSubTypeOf ("LmsHq::DataModelI::Expression::IBlock")
= True Then
my_block_found = my_data_found
End If
...
End If
...
End If
End sub

Section 3.4.2 How to add elements to Input Basket

Refer to example available onto DVD.

28 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Section 3.5 Block commands

Section 3.5.1 Sample code

Using an ICmd object, being a property of the Test.Lab application, does


executing block commands.

Section 3.5.2 How to create a scalar

The scalar object is used frequently by block commands. This Idata object
contains a value (double or complex) and its unit.

The example creates a scalar of an MKS value of 10 in the quantity


acceleration. If the quantity acceleration is expressed in 'm/s2', it is 10 m/s2, if it
is in 'g', it is 1 g.

It is also possible to give the value in 'UserUnits' (default behavior).

It is up to the automation programmer to decide whether he works with MKS


values, whether he knows the unit system and he prefers to have values directly
expressed in the used units.
Step 1
Declarations.
Dim TL As New LMSTestLabAutomation.Application
Dim scalarAmpl As LMSTestLabAutomation.IScalar
Step 2
Create scalar
scalarAmpl = TL.cmd.DOUBLE_TO_SCALAR(10,
TL.UnitSystem.QuantityAcceleration,MKS)

Section 3.5.3 How to create a random block

Parameters:
 Starting at 2s
 Duration of 1.3s
 Sample rate of 1024 Hz
Step 1
Declarations.

Rev 13A 29
Chapter 3 Using Test.Lab Automation

Dim quantTime as LMSTestLabAutomation.Iquantity


Dim scalarDuration as LMSTestLabAutomation.IScalar
Dim scalarOffas LMSTestLabAutomation.IScalar
Step 2
Create scalars for duration and offset.
quantTime = TL.UnitSystem.QuantityTime
scalarDuration = TL.cmd.DOUBLE_TO_SCALAR(1.3, quantTime)
scalarOff= TL.cmd.DOUBLE_TO_SCALAR(2#, quantTime)
Step 3
Create random block
Block_Random =
TL.cmd.BLOCK_RANDOM(scalarDuration,scalarOffset,1024)

Section 3.5.4 How to create a sine wave

Step 1
Declarations.
Dim scalarAmplitude as LMSTestLabAutomation.IScalar
Dim scalarDuration as LMSTestLabAutomation.IScalar
Dim scalarFrequency as LMSTestLabAutomation.IScalar
Dim scalarOffas LMSTestLabAutomation.IScalar
Dim scalarPhaseShift as LMSTestLabAutomation.IScalar
Dim BlockSine as LMSTestLabAutomation.IBlock2
Step 2
Create scalars for Duration (in time), Off(in time), Amplitude, Frequency (in
frequency), PhaseShift (in Angle)
scalarDuration = TL.cmd.DOUBLE_TO_SCALAR(2#,
TL.UnitSystem.QuantityTime,MKS)
scalarOff= TL.cmd.DOUBLE_TO_SCALAR(0,
TL.UnitSystem.QuantityTime,MKS)
scalarAmplitude = TL.cmd.DOUBLE_TO_SCALAR(8,
TL.UnitSystem.QuantityForce,MKS)
scalarFrequency= TL.cmd.DOUBLE_TO_SCALAR(100,
TL.UnitSystem.QuantityFreq,MKS)
scalarPhaseShift = TL.cmd.DOUBLE_TO_SCALAR(50,
TL.UnitSystem.QuantityAngle,MKS)
Step 3
Create the SineBlock
BlockSine = TL.cmd.BLOCK_SINE(scalarDuration, scalarOffset, 1024,

30 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

scalarAmplitude, scalarFrequency, scalarPhaseShift)

Section 3.5.5 Gow to add a scalar to a block

Step 1
Declarations.
Dim BlockResult as LMSTestLabAutomation.IBlock2
Dim BlockSource as LMSTestLabAutomation.IBlock2
Dim scalarToAdd as LMSTestLabAutomation.IScalar
Step 2
Add a scalar and a block
scalarToAdd =
TL.cmd.DOUBLE_TO_SCALAR(8,BlockSource.YQuantity,MKS)
BlockResult = TL.cmd.BLOCK_ADD_SCALAR(BlockSource, scalarToAdd)

Section 3.5.6 How to do a weighting on a block

Step 1
Declarations.
Dim weightingType As CONST_EnumWeighting
Dim BlockSource as LMSTestLabAutomation.IBlock2
Dim BlockResult as LMSTestLabAutomation.IBlock2
Step 2
Perform the weighting
weightingType = WeightingA
BlockResult = TL.cmd.BLOCK_WEIGHTING(BlockSource, weightingType)

Section 3.5.7 How to multiply 2 blocks

Step 1
Declarations.
Dim Block1 As LMSTestLabAutomation.IBlock2
Dim Block2 As LMSTestLabAutomation.IBlock2
Dim BlockResult As LMSTestLabAutomation.IBlock2
Step 2
Add two blocks

Rev 13A 31
Chapter 3 Using Test.Lab Automation

BlockResult = TL.cmd.BLOCK_MULTIPLY(Block1, Block2)

Section 3.5.8 How to calculate the loudness of a block

The command BLOCK_LOUDNESS only works on a Octave Block.

If you have time data, you first have to calculate the spectrum. For a spectrum,
calculate the Octave Spectrum. Only then, the command BLOCK_LOUDNESS
is available.
Step 1
Declarations.
Dim TL As New LMSTestLabAutomation.Application
Dim BlockTime As LMSTestLabAutomation.IBlock2
Dim BlockFFT As LMSTestLabAutomation.IBlock2
Dim BlockOctave As LMSTestLabAutomation.IBlock2
Dim scalarLoudness As LMSTestLabAutomation.IScalar
Dim loudnessValue as Double, dummy as double
Step 2
For time data, calculate spectrum
BlockFFT = TL.cmd.BLOCK_SPECTRUM(BlockTime)
Step 3
For spectra, calculate octave spectrum
BlockOctave = TL.cmd.BLOCK_OCTAVE(BlockFFT)
Step 4
Calculate the loudness on an octave spectrum
scalarLoudness = TL.cmd.BLOCK_LOUDNESS(BlockOctave)
Step 5
Get the scalarLoudness value out of the IScalar
Call scalarLoudness.GetValue(loudnessValue, dummy)

Section 3.6 Display and plotting

Section 3.6.1 How to display a block in a running application

Step 1
Declarations.

32 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Dim datawatch_PictManager As LMSTestLabAutomation.DataWatch


Dim PictManager As LMSTestLabAutomation.IPictureManager
Dim my_Picture As LMSTestLabAutomation.IPicture
Dim my_Display As LMSTestLabAutomation.IDisplay
Dim Block1 As LMSTestLabAutomation.IBlock2
Dim Block2 As LMSTestLabAutomation.IBlock2
Step 2
Get the picture manager of the active project.
datawatch_PictManager =
TL.ActiveBook.FindDataWatch("Navigator_DataViewing_PictureManager")
PictManager = datawatch_PictManager.Data
my_Picture = PictManager.AddPicture ("1x2")
Step 3
Add the data to the display of this picture:
Place both the blocks in the first display and both in the front.
my_Display = my_Picture.Display(0)
my_Display.AddData 0, Block1
my_Display.AddData 0, Block2
Place both blocks in the second display, one in the front and one in the back.
my_Display = my_Picture.Display(2)
my_Display.AddData 0, Block1
my_Display.AddData 1, Block2

Section 3.6.2 How to print a block in a word document

Two ways of printing do exist.


 You can start from a certain picture with some data in it and print it. This
corresponds with the functionality in the ‘dataviewing’ of the Test.Lab
Navigator. Use the method "PrintOut’ on the IPictureManager Object
 Second way corresponds with the ‘dataviewing’ sheet of the Navigator.
This way, you can print more pictures in the same document. An example of
this is shown beneath.

Note: Use AddDataLink to add data to the display, if you want to do printing
afterwards!. That way, you keep the link with the origin of the data, and you
still have access to all its related attributes. With ‘AddData’, the display has
no link to the origin of the data anymore.

Step 1
Declarations.

Rev 13A 33
Chapter 3 Using Test.Lab Automation

Dim datawatch_PictManager As LMSTestLabAutomation.DataWatch


Dim PrintManager As LMSTestLabAutomation.IPrintManager
Dim my_Picture As LMSTestLabAutomation.IPicture
Dim my_Display As LMSTestLabAutomation.IDisplay
Step 2
Get the print manager.
datawatch_PictManager =
TL.ActiveBook.FindDataWatch("Navigator_DataPresentation_PrintManager")
PrintManager = datawatch_PictManager.Data
Step 3
Load a format into the PrintManager.
The print format must already exist. You can create it when using the
application, in the picture manager do "make print format". Creating a format is
not possible from within Automation.
PrintManager.LoadPrintFormat "1x3PlotFrmt.doc"
Step 4
Get the first picture of the printManager.
my_Picture = PrintManager.Picture(0)
Step 5
Add the data to the display of this picture, the same block in each.
'Add block in the front of the first display. The path to this block is case
sensitive and must be correct.
my_Display = my_Picture.Display(0)
my_Display.AddDataLink 0, "My
Computer/D:/LmsLocal/Data/myProject.lms/Section1/Run 1/Fixed
sampling/Runup/Sections/Orders/Order 1.00 Mic1"
'Add block in the back of the second display.
my_Display = my_Picture.Display(1)
my_Display.AddDataLink 0, "My
Computer/D:/LmsLocal/Data/myProject.lms/Section1/Run 1/Fixed
sampling/Runup/Sections/Orders/Order 2.00 Mic1"
'Add newBlock in the front of the third display
my_Display = my_Picture.Display(2)
my_Display.AddDataLink 0, "My
Computer/D:/LmsLocal/Data/myProject.lms/Section1/Run 1/Fixed
sampling/Runup/Sections/Orders/Order 3.00 Mic1"
Step 6
Do the printing.
To a specific file
PrintManager.PrintOut ("c:\Temp\PrintResults\ElectronicPrint.doc")
To the default printer

34 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

PrintManager.PrintOut()

Section 3.6.3 How to add a single x-cursor to the front of a


Front/back display

Adding a cursor to a display is done in 3 steps. First, the cursor manager of a


display is loaded, then a cursor of the correct type and position is created, and
finally, it is added to the display.
Step 1
Declarations
Dim my_Display as LMSTestLabAutomation.IDisplay
Dim my_CursorManager as LMSTestLabAutomation.ICursorManager
Dim my_SingleCursor As LMSTestLabAutomation.ISingleCursor
Dim cursor_path as String, cursor_id as String
Step 2
Provide a unique string as cursorId.
cursor_id = "UniqueString"
Step 3
Get the cursor manager from the display.
my_CursorManager = my_Display.CursorManager
Step 4
Create a single X cursor (position 0.5)
my_SingleCursor = my_CursorManager.CreateSingleCursor(X, 0.5)
Step 5
Add the single cursor to the cursor manager.
cursor_path = my_CursorManager.Add(cursor_id, my_SingleCursor)

Section 3.6.4 How to modify axis properties of any display

Refer to example available onto DVD.

Rev 13A 35
Chapter 3 Using Test.Lab Automation

Section 3.7 Controlling a measurement in Signature

Section 3.7.1 How to start a measurement

The start button datawatch is "Start_Measurement", its data type is


LmsHq::DataModelI::DataArch::CBufferICommand.

Private Sub btnStart_Click()


Step 1
Declarations.
Dim data_StartCommand As LmsTestLabAutomation.IData
Dim attrmap_arguments As LmsTestLabAutomation.AttributeMap
Dim datawatch_Start As LmsTestLabAutomation.DataWatch
Step 2
Create the Start Command object of the correct data type.
attrmap_arguments = TL.CreateAttributeMap
data_StartCommand =
TL.CreateObject("LmsHq::DataModelI::DataArch::CBufferICommand",
attrmap_arguments)
Step 3
Look for the correct datawatch.
datawatch_Start = TL.ActiveBook.FindDataWatch("Start_Measurement")
Step 4
The StartCommand object on the datawatch.
datawatch_Start.Data = data_StartCommand
End Sub

Section 3.7.2 How to stop a measurement

The stop button datawatch is "Stop_Measurement", its data type is


LmsHq::DataModelI::DataArch::CBufferICommand.

Private Sub StopMeasButton_Click()


Step 1
Declarations.
Dim data_StopCommand As LmsTestLabAutomation.IData
Dim attrmap_arguments As LmsTestLabAutomation.AttributeMap

36 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Dim datawatch_Stop As LmsTestLabAutomation.DataWatch


Step 2
Create the Stop Commandobject of the correct data type.
attrmap_arguments = TL.CreateAttributeMap
data_StopCommand =
TL.CreateObject("LmsHq::DataModelI::DataArch::CBufferICommand",
attrmap_arguments)
Step 3
Look for the correct datawatch.
datawatch_Stop = TL.ActiveBook.FindDataWatch("Stop_Measurement")
Step 4
The Stop Command on the datawatch.
datawatch_Stop.Data = data_StopCommand
End Sub

Section 3.7.3 How to change the run name and to be informed


if it is changed

The datawatch of the run name is called "Measure_Run", its data type is a
string.
Step 1
Declarations
Dim TL As new LMSTestLabAutomation.Application
Dim WithEvents datawatch_Run as LMSTestLabAutomation.DataWatch
Dim currentRunName as String
Step 2
Define the correct datawatch
datawatch_Run = TL.ActiveBook.FindDataWatch("Measure_Run")
Step 3
Read the current run name on the datawatch
currentRunName = datawatch_Run.Data
Change the run name to "MyRun"
datawatch_Run.Data = "MyRun"
...
Step 4
Write the routine datawatch_Run_ValueChanged.
This routine will be executed when the user changes the Run Name in the
application interface.

Rev 13A 37
Chapter 3 Using Test.Lab Automation

Private sub datawatch_Run_ValueChanged (ByVal NewValue As Variant)


...
End Sub

Section 3.7.4 How to define the Channel Setup parameters

Changing the channel setup parameters from within Automation is not yet
supported. You can work with specific setups, that are already saved in
templates.
Step 1
Open a new project, using a specific template
TL.NewProject("C:/LmsLocal/Template/mytemplate.tpl")

Section 3.8 Using the module loader

Section 3.8.1 How to load a module (in VB6.0)

There are two main ways of working with Test.Lab Automation. They can be
combined in the same program.

You can connect with an existing application, and then you can, for example,
show blocks in the display of the application.

Another way is to have a Test.Lab Module as an object somewhere in your


display. As it is possible to have an Excel sheet in your own interface, it is also
possible to have a Test.Lab picture in it. You can access data, you can show this
data in your own interface, without having an application running.

For more information about this, see "The module Loader".

Let us try this out!


Step 1
First, you have to tell Visual Basic that the Test.Lab Automation Module does
exist as a Control.
In Visual Basis Menu Bar, go to Projects>Components. The following menu
appears:

38 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Components - Controls

Step 2
Switch on LMS Test.Lab ModuleLoader and push OK.

In the toolbox, the following icon appears:


Step 3
Click on the icon and draw a rectangular on your user interface (as if you create
a button, or an input field,...).
The following will appear:
Form1: LMS Test.Lab

Step 4

Rev 13A 39
Chapter 3 Using Test.Lab Automation

With the properties, you can change the ModuleName into the name of the
module you want: From 6A on, PictureManager, Picture and Explorer are
supported.
The following will appear:
Properties - AcivecXModuleLoader1

If you run this project now, a little interface appears with an empty Picture
Manager.
Next item explains how to access this Picture Manager.

Section 3.8.2 How to load a module (in VB.NET)

Step 1
First, in the toolbar of VB.net, the module loader control must be add.
With a right click on the mouse on the Toolbar, you can do ["Add/Remove
Items"].

40 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Add/Remove Items

Step 2
Select the LMS Test.Lab Module Loader Control by the list of the COM
Components and click [OK].
Customize Toolbox

The following entry will appear in your toolbar:

Rev 13A 41
Chapter 3 Using Test.Lab Automation

Toolbox - Control

Step 3
If you click on it and draw it on a form (as if it were a button), the following
appears on your form:
Form1: LMS Test.Lab

Step 4
With the properties, you can change the ModuleName into the name of the
module you want. From 6A on, PictureManager, Picture and Explorer are
supported. If you want an explorer, you need an open project, so the
openProject item to TRUE!

42 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Properties - Module

If you run this now, you will see the interface coming up with an explorer in it.

Section 3.8.3 How to access the PictureManager of a Module


Loader

When using the Module loader, the object to select is an


LMSTestlabAutomation.Imodule. To get the shown object itself, you first have
to find the correct datawatch.

The dataport you need if you are working with a pictureManager, is


'Navigator_DataViewing_PictureManager' as in the following procedure.
Step 1
Declarations.
Dim module As LMSTestLabAutomation.IModule
Dim datawatch_pictManag as LMSTestLabAutomation.DataWatch
Dim pictManag As LMSTestLabAutomation.IPictureManager
Step 2
Specify the module loader
Set module = ActiveXModuleLoader1.module
Step 3
Find the datawatch to the Picture manager
Set datawatch_pictManag =
module.FindDataWatch("Navigator_DataViewing_PictureManager")
Step 4
Load the pictureManager, add pictures, add data, ...

Rev 13A 43
Chapter 3 Using Test.Lab Automation

Set pictManag = datawatch_pictManag.Data


pictManag.AddPicture ("1x3")
...

Section 3.8.4 How to access data via a Module Loader

When blocks are displayed in the picture(s) of a module loader, the reference to
these blocks must be defined via the module.
Step 1
Declarations.
Dim module As LMSTestLabAutomation.IModule
Dim myBlock as LMSTestLabAutomation.IBlock2
Dim myDatabase As LMSTestLabAutomation.IDatabase
Step 2
Get database
Set myDatabase = module.Database("C:/LmsLocal/Data/myproj.lms")
Step 3
Get a block
Set myBlock =
myDatabase.GetItem("Sect1/Run1/Fixedsampling/Runup/Sections/Orders/Orde
r 2.00 Mic1")

Section 3.9 General guidelines

Section 3.9.1 How to access the Test.Lab Type library in VB

When you start up Visual Basic, only the basic references are available. All
extra libraries that are to be used, need to be selected manually. This can be
done as follows:
Step 1
In the menubar of Visual Basic, go to Projects > References.
This menu will pop up:

44 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

References - Test Block Commands

Automatically (after an installation of LMS Test.Lab on the system), the type


library of LMS Test.Lab Automation is in this list.
Step 2
Select 'LMS Test.Lab Automation (8A) Type Library'.
As you can see, this type library is dependent on the revision. If your program
needs to work on another revision, you will have to recompile. with the correct
type library.
Step 3
You can visualize the type library by clicking in the menubar on "View >
Object Browser".
In the menu that appears, you will find the list of all existing objects and their
interfaces.
There are other programs available to visualize a type library also, as the 'OLE
view' of Microsoft Visual Studio.

Section 3.9.2 How to access the Test.Lab Type library in


VB.NET

When you start up Visual Basic .NET, only the basic references are available.
Extra libraries that are to be used, can be selected manually. This can be done as
follows:
Step 1

Rev 13A 45
Chapter 3 Using Test.Lab Automation

With a right click of the mouse on the Solution explorer, select Add References.

Step 2
In the appearing menu, Lms Test.Lab® Automation Type library can be found
by the COM references.
From now on, the Test.Lab type library can be used.

Section 3.9.3 How to use data watches

Data watches deliver a very powerful way to communicate directly with a

46 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

Test.Lab application. In the same way, the software internally communicates.

A datawatch is a kind of port, where you can read data from and data on. You
also can be notified if the data changes on this datawatch. The meaning of this
data, depends on the datawatch. Each data watch has its data type, all data on
this data watch is always of this data type.

A big part of the supported datawatches corresponds with an existing item in the
application user interfaces.

A list of the supported datawatches, you can find in the Automation


Documentation Tool. Also, its data type is specified there.

Let us take as example the Run name for a signature measurement.


Step 1
First, open up the Automation Documentation Tool.
Step 2
Then, go to 'rotating machinery' , Signature Acquisition.
The tab that gives you the interface with the run name is "measure"..
Measure Port Names and Types

Step 3
In the list that shows up, you can find "Measure_Run"
The 'port type' is 'LmsHq::DataModelI::Base::IStringValue'.
The object on this datawatch must always be such an IStringValue. In this case,
also a simple string will do. For other data types, you have to create an object of
that specific type.
datawatch_RunName = TL.ActiveBook.FindDataWatch("Measure_Run")

Rev 13A 47
Chapter 3 Using Test.Lab Automation

Step 4
Read out the current Run Name.
CurrentRunName = datawatchRun_Name.data
Step 5
Change the current Run Name to "MyRun".
datawatch_RunName.Data = "MyRun"
Step 6
Implement the Value_Changed routine.
This routine will be executed when the user changes the Run Name in the
application interface.
Private sub datawatch_RunName_ValueChanged (ByVal NewValue As
Variant)
...
End Sub
More information about this, you can find in the Data Watches.

Section 3.9.4 How to make your own add-in in VB.6.0

It is possible to create your own user programs and add them as add-in in
Test.Lab. There are 5 possible user add-inns.
Step 1
You have to create your program as an ActiveXControl(*) and register it.
Step 2
On the installation directory, you have to edit the file
<Installation directory>/central/Configuration/ExternalUI.

48 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

ExternalU - Notepad

Step 3
You can choose your sheetname, and you have to enter the ID of your
ActiveXControl.
The ID of your ActiveXControl in Visual Basic 6.0 for the OCX as in the
picture beneath looks like this: Project1.my_user_control
ActiveXControl - ID

When starting Test.Lab the next time, your program will be available as an

Rev 13A 49
Chapter 3 Using Test.Lab Automation

Add- In.
Step 4
To activate it, go to Tools > Add-Ins and select User 1-5.
An extra sheet with your program appears.
(*) When creating a user program, you can decide to create an ActiveXControl.
With this kind of a 'program', you are not creating a standalone program, but a
Control. Such a control needs an interface, where it can be plugged in. This
program will never run itself, it will be a part of its 'mother' program. When
making an ActiveXControl in Visual Basic, the new control is registered.
Test.Lab can pick up registered control and show it in a new sheet. For more
information, please turn to your Microsoft documentation.

Section 3.9.5 How to make your own add-in in VB.NET

It is possible to create your own user programs and add them as add-in in
Test.Lab. There are 5 possible user add-inns.
Step 1
You have to create your program as an ActiveXControl(*).
In VB.net, your project is eg a Windows Control Library.
Make User Control Project

2. This control must be registered.


In VB.net, this can be automatically when compiling if the following project

50 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

property is set. In the ‘Project Property pages’, take ‘Configuration Properties’,


‘Build’. There, the "Register for COM Interop" is flagged.
User Control Project Properties

3. On the installation directory, you have to edit the file


<Installation directory>/central/Configuration/ExternalUI.
ExternalU - Notepad

4. You can choose your sheetname, and you have to enter the ID of your
ActiveXControl.

Rev 13A 51
Chapter 3 Using Test.Lab Automation

It is created from the name of the project and the name of the user control.
Without changing names, it is WindowsControlLibrary1.UserControl1. Of
course, these names can be changed in the VB project.
When starting Test.Lab the next time, your program will be available as an
Add-In.
5. To activate it, go to Tools > Add-Ins and select User 1-5.

Section 3.9.6 How to deal with Test.Lab objects

Test.Lab objects are always IData objects.

Most important of them do have a simplified interface (like IBlock2, IPicture,


IScalar,...). Since the list of different types is immense, we cannot provide a
simplified interface for all of them. While programming, you always can meet
such a 'IData' type: Data watches all have their specific types, in the Block
header it's possible to find some...

The structure of such an IData object is like this: an attribute map, next to its
type.

DataObject

An AttributeMap object is a list of name-value pairs. The names are strings


while the values associated can be again any IData object. Like this, you can
build very complex structures.

The structure of the Attribute map is linked to its type

Creating a Test.Lab object depends on its type. A (rather simple) IData object is
the Enum type. You can find how to create it in the next item

Without claiming to be complete, the following list give for some types their
corresponding interface:

Types and Interfaces

Types Interfaces

LmsHq::DataModelI::Base::IBoolean Boolean

LmsHq::DataModelI::Base::IReal Long/Double

52 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

LmsHq::DataModelI::Base::IInt Integer

LmsHq::DataModelI::DataStructure::IScalarDoubleVariable IScalar

LmsHq::DataModelI::DataStructure::IScalarComplexVariable IScalar

LmsHq::DataModelI::Expression::IBlock IBlock2

LmsHq::DataModelI::Expression::CBufferIBlock IBlock2

LmsHq::ActiveCompVI::AutomationPictures::IPictureManag IPictureManage
er r

LmsHq::ActiveCompVI::AutomationPictures::IPrintManager IPrintManager

Enumerate (see
LmsHq::DataModelI::DataAttributes::IEnum...
next item )

Section 3.9.7 How to read/write an enumeration value

Enumeration values are Idata objects. The type of this object is an enum type.
The attribute map of this object contains 1 item "EnumValue", containing the
int-value of the enumeration.

From 6A on, there exists an interface "Enumerate" in the Test.Lab Type library.
Step 1
How to know whether a IData object is a Enumerate?
Via the method on a IData object "IsSubTypeOf".
dim myData as IData
dim myEnum as Enumerate
if (myData.IsSubTypeOf("LmsHq::DataModelI::Base::IEnumerate"))
myData = myEnum
end if
Of course, if the type of an object is known (e.g. because you read it from a
datawatch), this check is not needed. If there is "Enum" somewhere in the
internal type name of a IData object, or it is in the list of all Enum Types in the
Automation documentation tool (by browsing to "Test.Lab Enumerate
Definitions"), you can use the "Enumerate" interface.
Step 2
How to read a Enumerate object?
Presume the direction of a block is read.

Rev 13A 53
Chapter 3 Using Test.Lab Automation

dim enumDirection as Enumerate


enumDirection = my_block.Properties.Item("Point direction")
To have the string value of this, read in the localvalue.

Step 3
How to change a Enumerate object?
Let us work further with the direction object of the example above.
You can change an Enumerate both with its int-value as with its string-value
(=LocalValue). All possible values can be found by the property range.
In the next figure, the content of the range is shown. You can find the possible
localValues by having a look at the keynames of the items of the attributemap
gotten from the property ‘Range’.
In the next lines code, all possible values from the enumDirection object are
read in the string array strEnumValues.
Dim strEnumValues() As String
Dim i As Integer
ReDim strEnumValues(enumDirection.Range.Count)
For i = 0 To enumDirection.Range.Count - 1
strEnumValues(i) = enumDirection.Range.KeyNames(i)
Next i
Changing the direction of the object to +X can be done like this
enumDirection = enumDirection.ReplaceLocalValue("+X")

Section 3.9.8 How to specify a path

For several functions in Test.Lab, you can enter a path to specify the location of
an object. Also, in some functionalities, Test.Lab returns a path.

Some examples:
 for the search, when indicating the location from where to look from
StartPointFactory: Property File(FilePath As String, [SubPath As String]
 To identify a specific database Application: Function
Database(ProjectPathName As String)
 for the search, when indicating the location from where to look from
StartPointFactory: Property File(FilePath As String, [SubPath As String])
 for the location of blocks in a database IDatabase: Function

54 LMS Test.Lab Automation manual


Chapter 3 Using Test.Lab Automation

GetItem(PathToTop As String)
 to edit an IData object IData: Function Edit(PathWithinObject As String,
NewAttribute)
Rules:
 Different parts are separated by a "/"
 If in the name of one part a special character is used, it must be escaped by
a "\"
List of the special characters: # / \ { }

Presume the name of a block is the following: "Coherence plat:1:+Z/plat:1:+Z".

If you are accessing this block in its database, do it this way:

block = TLDB.GetItem("Sect1/Run1/Coherence/Coherence
plat:1:+Z\/plat:1:+Z")

Rev 13A 55
Chapter 4 Examples

Chapter 4 Examples

In This Chapter
General: ..............................................................................57
Example 1:..........................................................................57
Example 2:..........................................................................57
Example 3:..........................................................................57
Example 4:..........................................................................58
Example 5:..........................................................................58
Example 6:..........................................................................58
Example 7:..........................................................................58
Example 8:..........................................................................58

Section 4.1 General:

 In all examples with a module: change the ProjectName of the module


 In all other: change the path to the project in the defined constant

Section 4.2 Example 1:

Open Test.Lab and open a Block. Add a Picture to the PictureManager and add
the Block to this Picture. Finally crear all the data from the display.

Section 4.3 Example 2:

Open Test.Lab and retrieve the Workspace and InputBasket from the Explorer.
Create and delete a folder in the Workspace and copy all items from the
InputBasket to the new created folder in the Workspace.

Section 4.4 Example 3:

Open test.Lab and retrieve the SearchEngine from the Explorer. Create search
criteria and perform a search with this criteria. Wait for the search to finish and
display all results.

Rev 13A 57
Chapter 4 Examples

Section 4.5 Example 4:

Open Test.Lab and read the AttributeMap of a Block. The first part is to retrieve
a value if the name and path in the map is known. The second part consists of
listing all attributes in the AttributeMap. Create an object corresponding with
the type of the object. and display a readable enum value.

Section 4.6 Example 5:

Open Test.lab and add a cursor to a Display. Move this cursor to a new position.
For this it is neccesairy to convert the user units to MKS units.

Section 4.7 Example 6:

Open Test.lab and select a block. Perform actions on this block through Cmd
and AdvancedCmd. Create a new section in the active project and save the new
block in that section. Finally save the project.

Section 4.8 Example 7:

Open Test.Lab and open a print template. Add blocks to the print picture in
different displays. Print this picture to a .doc file.

Section 4.9 Example 8:

Open Test.Lab and start a measurement. Stop the measurement and display
overloads and status.

58 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Chapter 5 Reference guide

In This Chapter
Introduction to Automation ................................................60
The Test.Lab Automation Library......................................65
IApplication ........................................................................65
IAttributeMap .....................................................................78
IDataWatch.........................................................................82
FE35 ...................................................................................83
Enumerate...........................................................................89
Factory ................................................................................92
IBlock2 ...............................................................................94
IBook ..................................................................................106
IBooks ................................................................................117
ICmd ...................................................................................119
AdvancedCmd ....................................................................128
ICrossCursor.......................................................................129
ICursor ................................................................................129
ICursorManager..................................................................129
IData ...................................................................................129
IDatabase ............................................................................130
IDataBrowser......................................................................138
IDisplay ..............................................................................140
IDoubleCrossCursor ...........................................................140
IDoubleCursor ....................................................................140
IDoubleRatioCursor ...........................................................140
IExplorer.............................................................................140
IGeometry...........................................................................144
IHarmonicCrossCursor .......................................................152
IHarmonicCursor ................................................................152
IHarmonicRatioCursor .......................................................152
IHeader ...............................................................................152
IModule ..............................................................................153
InProcApplication ..............................................................157
InputBasket.........................................................................158
IPicture ...............................................................................159
IPictureManager .................................................................159
IPrintManager.....................................................................159
IQuantity.............................................................................159
IRatioCursor .......................................................................160
IScalar.................................................................................160
ISheet ..................................................................................160
ISheets ................................................................................160
ISingleCursor......................................................................160
IUnitSystem ........................................................................160
LMS Unit System ...............................................................164
IWatch ................................................................................165
IWaterfall (not yet implemented) .......................................165
SearchBasket ......................................................................169
SearchEngine ......................................................................169

Rev 13A 59
Chapter 5 Reference guide

StartPointFactory ................................................................172
Workspace ..........................................................................174

Section 5.1 Introduction to Automation

Section 5.1.1 Key concepts

Automation is a technology that allows software packages to expose their


features to development tools and other applications. It allows to:
 Create applications and programming tools that expose objects and their
functionality. The application, which exposes, is being called the 'server'.
 Create and manipulate objects exposed in one application from another
application. An application, which uses exported functionality, is called a
'client'. The Test.Lab applications can expose some of their functionality by
means of automation. Therefore it has been enhanced with the necessary
server capabilities.
The Test.Lab applications can expose some of their functionality by means of
automation. Therefore it has been enhanced with the necessary server
capabilities.

In order to support automation, a server application needs to describe which


objects it will export, and what kind of actions can be performed on those
objects. This language independent description provides information to the
automation services of how client applications can interface with the server.
Supplying such a description for automation is like applying for a telephone
number. You will need to supply your personal co-ordinates on a standard form,
deliver it to the phone company and they will make sure you get assigned a
phone or fax number which they add to the online or offline phone pages.

60 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Automation services

The previous figure shows how both server and client applications can call upon
the common services to communicate. The automation layer provides language
and Windows platform independence. Although Automation is specially aimed
at supporting interpreted languages, like Visual Basic and MATLAB, it just as
well can be used from compiled languages like Visual C++, J++, Java, C#.

An additional strong point in the binding between client and server application
is that they both can run as separate processes. Such a configuration will
improve stability. When the client application should crash, the server
application will continue running without further disadvantage.

Section 5.1.2 Object models

An object model, associated with an application, is a description of the of


objects, their properties and methods, and the relations between these objects.

Applications, which support automation, supply a kind of roadmap, which you


can use to navigate from one object to another. Once you reached the desired
object, you can query for some characteristics or perform some actions, defined
on it.

Following is an extract of the object model defined by MS Excel. MS Word,


PowerPoint, Outlook, Visio and Publisher are only a few other MS applications,
which define analog models.

Rev 13A 61
Chapter 5 Reference guide

MS Excel Object Model (extract)

Using this Excel object model, we can, for instance, change the AxisTitle of a
chart in an Excel workbook. As a convention the main object you can get access
to is called 'Application' and represents the complete application. In the case of
Excel this object can be requested to return a list of all 'Workbooks'. This object
is a collection, i.e. a list, of zero or more individual books opened. A name or
sequence number, to return an individual item, can index such a collection.
Once you have got the target workbook, the client can navigate charts, resulting
in a single chart. From there it goes deeper into the axes structure of the chart
itself, down to the AxisTitle object.

Section 5.1.3 Object interfaces

An interface is a group of semantically related functions that provide access to


an automation object. Each interface defines a contract that allows objects to
interact according to the given Component Object Model (COM). For instance
in the case of the Excel Application, following Visual Basic commands would
return a reference to the main Excel application object.

Dim ExcelApp As Excel.Application

ExcelApp = CreateObject("Excel.Application")

The ExcelApp returned is a reference to an object, which is managed by MS


Excel, and which has agreed to implement all functionality, defined by the
'Application' interface. So once you have such an object, you are safe to perform
any operation defined in the interface.

62 LMS Test.Lab Automation manual


Chapter 5 Reference guide

MS Excel Application Interface

Previous figure shows a subof the list of 'things' you can do with such an
Application object. The highlighted member will return an object, which has
committed to provide all functionality on the Sheets interface.

This is what the Visual Basic code would look like.

Dim ExcelSheets As Excel.Sheets

ExcelSheets = ExcelApp.Sheets

MS Excel Sheets Interface

As you can see in figure 4, any object supporting the 'Sheets' interface will need
to implement the 'Count' function, which will return the number of sheets this
application has.

In fact there are only three types of members, which an interface can provide.

Rev 13A 63
Chapter 5 Reference guide

An interface property returns discrete state information that is


Properties associated with an object. It merely reflects the objects' condition.
The number of sheets in a workbook, the width of a window, the
number of columns in a grid, the title of a paragraph, the visibility or
sensitivity of a sheet, the X and Y values of a data block are only a
few examples of properties.
A method actually makes the object perform a specific action. This
Methods can be opening a project or document, bringing a specific sheet to the
front, saving data, etc.
'Events' are notifications from the server application to the clients.
Events These notifications are asynchronous. This means that a client's
callback routine can be triggered without it having to do a busy-wait
for this event. So instead of performing an action which will keep
pending until an event occurs on the server side, you just need to
specify a routine which will be called, should the situation occur
Some interfaces supply events, which will report the client when a
project is opened, when a cell is changed, when a measurement is
launched, etc.

Section 5.1.4 Type library files

Previously mentioned information regarding different interfaces, their methods,


properties and events, associated parameters, parameter types and short
descriptions are stored in a separate file, called a type library. The type library
file is a binary file, usually has a .TLB filename extension and can be used by
other applications to get information about the automation server. Next to any
written documentation, this is probably the most important source of
information regarding the object model, which is exposed by a server
application. There are some viewing tools that allow inspecting a type library's
contents.

Each of these interfaces individually is elaborated individually in the following


chapters.

Any Windows system, even with only a few applications installed, will easily
have a couple of hundred type libraries available for client applications to use.
This shows that it is common practice for an application to export functionality
in this way. So if you are acquainted with inspecting one type library, you can
reuse your experience to navigate any object model, described in any type
library.

Test.Lab also has it own of interfaces defined. The description of the Test.Lab
object model can be found in its type library, called
LMSTestLabAutomation.tlb. It is copied to the
<installation>/Central/Configuration directory during Test.Lab installation.

64 LMS Test.Lab Automation manual


Chapter 5 Reference guide

If you add a reference to 'LMS Test.Lab Automation Type Library', the object
browser will show all interfaces supported by the Test.Lab applications.

Section 5.1.4.1 Object browser


When using the Visual Basic Development environment, selecting View Object
Browser (F2) will launch the Object browser to view the Type Lib contents. The
shows an instance of such a browser. Before you can view a specific type
library, it needs to be added to the 'Project Reference' list in the Visual Basic
IDE.

OLE viewer
This is an 'Object Linking and Embedding' viewing tool. Its File View TypeLib...
entry will allow you to select a .tlb file and opens it in an 'ITypeLib viewer'
window. This OLE viewer comes with the Visual C++ development
environment. This viewer shows the interface type information in a way, which
is closer to the raw description, provided by the server application. Next is an
example of this view viewing the information on the Excel Application object.

ITypeLib Viewer

Freeware tools
There are some standalone type-library-viewing tools available on the Internet.

Section 5.2 The Test.Lab Automation Library

Section 5.3 IApplication

The usage of this interface is shown in all examples.

Rev 13A 65
Chapter 5 Reference guide

Section 5.3.1 Contents

 Definition
 Methods
 Init
 NewProject
 OpenProject
 Quit
 SaveAll
 FindDataWatch
 CreateObject
 Database
 DisallowNewClientConnections
 DisallowExit
 CreateAttributeMap
 InstallationPath
 LocalPath
 PID
 Properties
 Books
 ActiveBook
 UnitSystem
 Name
 cmd
 Factory
 Version

Section 5.3.2 Definition

In automation, by convention, an object called 'Application' represents the entire


server application. It is directly related to the Test.Lab application executable:
the workbook loader (LmsHq_ActiveCompVC_LmsLoader_v5.exe). This
executable is used for all Test.Lab applications.

The Test.Lab workbook loader is the main executable that offers some
application independent services like for instance unit system manipulation.
Besides, it can load different workbooks, resulting in different functionality e.g.
Desktop, SignatureFS, SpectralAcquisition, Environmental testing, etc. These
workbooks are defined in .awb-files on the directory
<installation>/Central/Workbooks.

The next few lines of Visual Basic code show how to create an automated

66 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Test.Lab.

Dim TestLab As LMSTestLabAutomation.Application

TestLab = CreateObject("LMSTestLabAutomation.Application")

The execution of the Visual Basic CreateObject instruction can have two
results.
 If a Test.Lab application was already running, it hooks up to this running
application, and automatically uses the workbook that is loaded.
 If no Test.Lab application is running, it launches the workbook loader
executable, without loading any workbook. You can instruct the loader to
load a workbook using the 'Init' method in the Application interface, e.g.
TestLab.Init("-w ModalImpactStandard")

Application interfaces

Section 5.3.2.1 Setup


Changing the module name

The 'OpenProject' flag indicates if a project has to be opened when starting up


the module. To have a project opened, the 'OpenProject' flag has to be changed

Rev 13A 67
Chapter 5 Reference guide

to non-zero (-1). Some type of modules really need an open project (like the
Explorer), others can be used with or without (as the Picture(Manager)).

If the OpenProject is 0, the next two fields (ProjectName and SectionName) are
ignored. If not, the specified project in 'ProjectName' is opened when the
module is loaded. If the 'ProjectName' is left blank, a default project will be
opened, just as with 'New project' in the Test.Lab workbook loader. Specifying
a SectionName will use the settings in that specific section, otherwise it will
revert to the default section.

Defining the section

Module Types:
 Default
 PictureManager
 Picture
 Explorer
Default
This module is the module that is loaded by default. It is shown here on the GUI
of an external application.

Default module

This merely shows a bitmap with the Test.Lab logo on it.

Available Datawatches for this module

68 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 NONE
PictureManager
This module contains the picture manager functionality as it is presented in the
'Navigator' of 'Measure' sheet for instance.

PictureManager module

This module can be used in the same way it can be used in Test.Lab itself.

Available Datawatches for this module


 Navigator_DataViewing_PictureManager
Picture
The 'Picture' module is a more restricted version of the 'PictureManager' module
in such that the users has no interactive access to the bar on the top.

Rev 13A 69
Chapter 5 Reference guide

Picture module

This module is more suited in situations where the developer wants to restrict
access to the different manipulations offered by the PictureManager.

Available Datawatches for this module


 Navigator_DataViewing_PictureManager
Explorer
The 'Explorer' module contains the explorer of Test.Lab, being the left side of
the navigator sheet

Picture module

The developer has access to all functionality available in here.

Available Datawatches for this module

70 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Navigator_SelectedOIDs
 Navigator_UpdateTreeItem
 Navigator_Explorer
IModule interfaces

Section 5.3.3 Methods

Init
 Signature
Init(ApplicationStartupArguments As String)
 Description
'Init' instructs the Test.Lab object to initialize with the passed
StartupArguments. You can supply a number of options as arguments:
 -w <workbook name>
Specifies the name of the workbook to be loaded. All workbook descriptions are
in the <installation>/Central/Workbooks directory.
 -a <architecture>
Specifies the architecture to be used. This specifies, for instance, options that
are shared between different workbooks. Default value is so that this can be
omitted by normal use.

Rev 13A 71
Chapter 5 Reference guide

 -t <template name>
Specifies the template to be used at startup.
 –b
Indicates to start the workbook without automatically opening a project.
 -c <configuration file>
Specifies the configuration file to be used. This configuration file can contain
some personalization settings, like colors, styles, layouts, etc.
 <project name>
Specifies the project name to use at startup.
 Example
TestLab.Init ("-w ModalImpactStandard
C:/MyProjects/PrjDB.lms")
Initializes the Test.Lab workbook loader application with the
ModalImpactStandard workbook, using the ModalImpact architecture and
creating one instance, given the C:/MyProject/PrjDB.lms as its project.
NewProject
 Signature
NewProject(TemplatePathName As String = Nothing) as String
 Description
This method opens a new workbook in the application, while creating a new
temporary project. It uses the default template of the current application, unless
another template is specified. Upon saving the project, , a 'save as' project name
will be required.
The method returns a string. This string holds a unique id associated with the
created workbook instance. You can use this id to select a specific book out of
the list of books.
 Example
TestLab.NewProject ()
This will create a new workbook, based on a new project. It does not captures
the returned new book id.
OpenProject
 Signature
OpenProject(ProjectPathName As String) As String
 Description
This allows you to create a new workbook in the application, based on an
existing project. Again the return value is a unique id of the book created as
result of calling this method.
 Example
Bookid = TestLab.OpenProject("c:/MyProject/PRJ1234.lms")

Quit

72 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Signature
Quit()
 Description
Quits the complete Test.Lab application. This method does not include saving
any projects before shutting down, nor does it present a message box to ask the
user whether he wants to save his data or not. This can be done in the client
application depending on the desired automation scenario.
 Example
TestLab.Quit

SaveAll
 Signature
SaveAll()
 Description
As mentioned earlier, a single Test.Lab application can have several instances
of a workbook running, each related to a project. The 'SaveAll' method instructs
all books to save their associated project. It is shorthand for iterating all the
open books and save each in turn.

Note: Temporary projects are not saved, nor a message is flagged.

 Example
TestLab.SaveAll

FindDataWatch
 Signature
FindDataWatch(AbsoluteDataPath As Object, MaxUpdateFrequency
As Integer = 1000, IsAutoBuffered As Integer = 1, InitialFiring
As Integer = 1) As Datawatch
 Description
MaxUpdateFrequency: the interval, specified in milliseconds, with which the
system will check the contents of the port and notify the client application if the
value on the port has changed since the previous check. Default is 1000
IsAutoBuffered: a Boolean value to indicate that the value returned from the
datawatch needs to be returned as a buffered, normalized type. Default is 1,
meaning AutoBuffered is true.
InitialFiring : a Boolean value that makes that the ValueChanged callback on
this datawatch will be fired when the datawatch is initialized (default is 1) or
not.
 Example
Dim Loaded_AddIns_Port as LMSTestLabAutomation.DataWatch
Loaded_AddIns_Port =
TestLab.ActiveBook.FindDataWatch("Loaded_AddIns")

CreateObject

Rev 13A 73
Chapter 5 Reference guide

 Signature
CreateObject(DesiredType As String, Attributes As
AttributeMap) As IData
 Description
This method allows a client application to create native Test.Lab objects such as
commands, weighting types, data blocks, calculations, etc. To do so it needs a
string to indicate the type of data to create, and an attribute list, a kind of
parameter list, as input for creation. Please read through the description of the
next interfaces and by the time you get to the AttributeMap interface, the
function of this method should be clear. The function returns an IData object.
Database
 Signature
Database(ProjectPathName As String) As IDataBase
 Description
This method allows a client application to get hold of the automation object
called IDatabase for databases solely stored on disk. The database is not opened
in a workbook.
This IDatabase interface holds all the functionality for interacting with the
project database.
 Example
Dim TL_DB As LMSTestLabAutomation.IDatabase
TL_DB =
TestLab.Database("e:\local\data\Archive\PRJ990604.lms")

DisallowNewClientConnections
 Signature
DisallowNewClientConnections()
 Description
Prevents other applications from making connections with the application.
DisallowExit
 Signature
DisallowExit(ac_bDisallowExit As Integer)
 Description
This method enables a client application to get control over
allowing/disallowing the interactively quitting the Test.Lab application. If the
value is 1, then the exit is not allowed.
CreateAttributeMap
 Signature
CreateAttributeMap() As Attributemap
 Description
This method creates an Attributemap object in Test.Lab and returns a reference

74 LMS Test.Lab Automation manual


Chapter 5 Reference guide

to it. Such an 'Attributemap' is a general implementation of a list or a map and is


used for passing lists of arguments to and from several Test.Lab automation
commands.
InstallationPath
 Signature
InstallationPath(out Path As String)
 Description
This method return the installation path of Test.Lab.
LocalPath
 Signature
LocalPath(out Path As String)
 Description
This method return the path to the local folder.
PID
 Signature
PID(out nPID As UInteger)
 Description
This method returns the process id from Test.Lab.

Section 5.3.4 Properties

Books
 Signature
Books as IBooks
 Type
Read-only

Rev 13A 75
Chapter 5 Reference guide

 Description
This property returns the collection of workbook instances, currently active in
the Test.Lab application. The Figure below shows the DesktopStandard
workbook, twice instantiated. One based on project1 and a second based on
project2. Such a list of instantiated workbooks can be retrieved by the 'Books'
property. A book is related to an open project.

ActiveBook
 Signature
ActiveBook As IBook
 Type
Read-only
 Description
This property allows an automation client to get a reference to the book that is
selected. The window of the active Book has a highlighted title bar (see Figure
below).

76 LMS Test.Lab Automation manual


Chapter 5 Reference guide

The active book is one of the books in the list returned by the 'Books' property.

UnitSystem
 Signature
UnitSystem As IUnitSystem
 Type
Read-only
 Description
The UnitSystem property, returns a reference to an object in Test.Lab that is
responsible for handling unit system operations. Further interaction with this
unit- system-managing object can be done by means of the members defined on
the IUnitSystem interface.
Name
 Signature
Name As String
 Type
Read-only
 Description
This method returns the name of the opened workbook of the attached Test.Lab
application.
cmd
 Signature
cmd As ICmd
 Type
Read-only

Rev 13A 77
Chapter 5 Reference guide

 Description
This method returns a handle to the command interpreter used in the Icmd
interface.
Factory
 Signature
Factory As Factory
 Type
Read-only
 Description
This property return a factory, where several Test.Lab objects can be created.
Version
 Signature
Version As String
 Type
Read-only
 Description
This property returns the version of the application that is running.

Section 5.4 IAttributeMap

The usage of this interface is shown in examples 3 and 4.

78 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.4.1 Contents

 Definition
 Methods
 Add
 Remove
 Replace
 Properties
 Count
 Item
 KeyNames

Section 5.4.2 Definition

An AttributeMap object is a list of name-value pairs. The names are strings


while the values associated can be any Test.Lab IData object.

The values of these name-value pairs can be very complex.

These attributemaps are being used for decomposition and composition. In case
of decomposition, it is an attribute list representing an existing object, while in
the case of composition it is used as input to create a new object.

The 'IData.Edit' method, discussed in previous section, can return a new IData
object, based on an existing one. It is also possible to create a Test.Lab IData
object from scratch by means of the 'CreateObject' method on the Application
object. In order to do so, a list of attributes has to be passed, along with a string
indicating the required type of object

Rev 13A 79
Chapter 5 Reference guide

AttributeMap interfaces

Section 5.4.3 Methods

Add
 Signature
Add(Index As Object, ac_Item As Object)
 Description
Adds an attribute to the attributemap. This attribute is added with a keyname
'Index' and value 'ac_Item'.
 Example
Dim new_attributes as LMSTestLabAutomation.AttributeMap
new_attributes =
CreateObject("LMSTestLabAutomation.AttributeMap")
new_attributes.Add("LineStyle", local_line_style)
Creates an empty attributemap and adds an attribute value under the name of
"LineStyle".
Remove
 Signature
Remove(Index As Object)

80 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Description
Removes an attribute from the AttributeMap. If Index is a string, it will remove
the associated entry from the map. If Index is an integer value n, it will remove
the nth occurrence.
 Example
attributes.Remove("LineStyle")
attributes.Remove(1)

Replace
 Signature
Replace(Index As Object, ac_Item As Object)
 Description
Replaces an attribute from the AttributeMap with a new item. Index can be both
a string (the associated entry is replaced) as an integer (the nth occurrence is
replaced).

Section 5.4.4 Properties

Count
 Signature
Count As Integer
 Type
Read-only
 Description
Returns the number of attributes in the map object.
 Example
Number_of_attributes_in_object = attribute_map.Count

Item
 Signature
Item(Index As Object) As Object
 Type
Read-only
 Description
Returns the value associated with a specific attribute in the map. The index
specified can be an zero-based sequence number or a string, in which case it
will return the value associated with the matching key.
 Example
attribute_value = attribute_map.Item (1)
attribute_value = attribute_map.Item ("LineStyle")

Rev 13A 81
Chapter 5 Reference guide

KeyNames
 Signature
KeyNames As IAtrtibuteMap
 Type
Read-only
 Description
Returns an AttributeMap object, which only holds the names of the original
attribute map, but this time as values. This way the list can be iterated by means
of the Count and Item property to consult all available key names.
 Example
'should the attribute_map contain following pairs:
' keyname: "foreground" value:<value_object_1
' keyname: "background" value:<value_object_2
' keyname: "font" value:<value_object_3
keyname_list = attribute_map.KeyNames ()
'keyname_list contains following pairs:
' sequencenr: 1 value:"foreground"
' sequencenr: 2 value:"background"
' sequencenr: 3 value:"font"
For Each keyname In keyname_list
'keyname will contain "foreground", "background" and "font" in turn.
Next

Section 5.5 IDataWatch

DataWatch interfaces

82 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.6 FE35

Section 5.6.1 Contents

 Definition
 Properties
 Events

Section 5.6.2 Definition

In order to explain the powerful functionality of this method, it is important to


get some insight in the truly Component Based architecture of the Test.Lab
application.

Each workbook of a Test.Lab Application describes the of modules they need to


offer the total packaged functionality. Each module contributes part of the
solution, but is not conditioned to serve only one single application. Most of the
internal modules can be reused in different application. The 'Documentation'
and 'Navigation' modules are probably some of the most frequently reused
modules that serve different applications. Also more specialized modules can
serve different end-applications. The 'Run Data Averaging & Comparison
Organizer' or the 'Psycho-Acoustic Metrics' module, for instance, can be used in
a SignatureFixedSampling workbook or even in a SpectralAcquisistion
workbook.

A Test.Lab module does not necessarily need to provide any user interface. In
fact some modules merely provide the core processing, while others do not do
any processing of themselves.

You can think of them as devices, where the user can interact by means of a
front-panel to control the internal services of the device. The front-panel merely
allows a user to get access to some of the internals of the device. Replacing the
front-panel with a more reduced of controls does not require the internal system
to be changed if you would want it to have some fixed settings.

Next to their high-tech functionality, the seamless integration of the different


modules into fit-for-purpose applications is a major asto the Test.Lab
applications. But in order to do this, the modules need to be able to pass
information. To be able to do so, they connect to dedicated ports. These ports
are a kind of data-busses, communicating data packages. The next figure
schematically illustrates the internal architecture and the different ports as
communication channels.

Rev 13A 83
Chapter 5 Reference guide

There is a great number of modules, present in an actual Test.Lab workbook.


They all connect to the same port if they wish to communicate on detailed
information with a specific functional character, such as 'start the measurement',
'last measured data block', etc. These ports are called data watches.

Any object of this DataWatch type, represents a reference to a specific port in


Test.Lab. Next to that, it holds some settings in the way you can access that
port. Data watches can be defined on the application, on a specific workbook or
on a module.

On the application, some global communication can be done. Most of the data
watches are defined on a specific workbook. The different modules of a
workbook use this way of communication. Automation can pick them up as data
watches on this workbook.

When working with the Test.Lab Module Loader, data watches are available on
the module. There are 2 types there: one is comparable with those on a
workbook, but limited to the data watches that are relevant for the module. The
other are the 'global' ones, comparable with those on the application. To find an
existing data watch, you can use the FindDataWatch method on an Application
on an IBook, or on an IModule.

On an IBook and an IModule, you can even create your own data watches
(method CreateDataWatch on an IBook and an IModule). These methods return
a DataWatch-object. Reading and writing on the data watch is done via its
property Data.

It is possible to a callback on a DataWatch -object, that is called any time the


value on it changes. Therefore, the "ValueChanged" event is used.

Section 5.6.3 Properties

AsyncData

84 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Data
 Signature
Data As Object
 Type
Read-only
 Description
Ports are the carriers that are being used to communicate specific data packages
between subscribers. This property is the means to either get or such a data
package.
Getting data means the latest data package is returned to the client.
Putting data will instruct Test.Lab to broadcast the supplied data to other
subscribers.
Since each port is designed for a specific purpose, it is only able to transport
data of a specific type. It is the users' responsibility to provide correctly typed
data packages. There are a number of different ways in which the user can get a
hold of data to put on ports.
 Data objects, gotten from another port. The types of both ports have to be
compatible.
 A Test.Lab data object, altered by means of the 'Edit' method in the IData
interface. (Ref Edit)
 A Test.Lab data object, created with the 'CreateObject' method in the
Application interface. (Ref CreateObject)
 A non-Test.Lab native data object, which fully supports the automation
interfaces as laid out in the Test.Lab object model, e.g. Visual Basic class
supporting the IBlock interface.
 Example
Public port_to_override As LMSTestLabAutomation.DataWatch
port_to_override =
testlab.ActiveBook.FindDataWatch("FS_Weighting_Acoustic")
Dim NewWeightingValue As LMSTestLabAutomation.IData
Dim attributes As LMSTestLabAutomation.AttributeMap
attributes =
CreateObject("LMSTestLabAutomation.AttributeMap")
attributes.Add "EnumWeighting", 5
NewWeightingValue =
testlab.CreateObject("LmsHq::DataModelI::DataAttributes::CB
ufferIEnumWeighting", attributes)
port_to_override.Data = NewWeightingValue

DataPathName
 Signature
DataPathName As String

Rev 13A 85
Chapter 5 Reference guide

 Type
Read-only
 Description
Returns the ID of the port the DataWatch represents. This is the ID which was
specified in the 'FindDataWatch' method that returned the DataWatch object in
the first place.
 Example
PortID = port_to_override.DataPathName

InitialFiring
 Signature
InitialFiring As Integer
 Type
Read-only
 Description
Returns if the InitialFiring property of the DataWatch is on or off.
IsAutoBuffered
 Signature
IsAutoBuffered As Integer
 Type
Read-only
 Description
Returns a Boolean value to indicate whether the data on the port needs to be
converted into a standardized data type, before handing it over to the client.
Leave this variable to on (=1).
Suppose we have a port, which can transfer real values. Such a data object could
be of the type 'TestLab_Real', holding the value 7.3. Not always do such a port
communicate calculated, self-contained values such as 7.3, but in some cases it
will hold recipes, resulting in a real value, but only after evaluating the recipe.
Lets say this recipe would be of the type 'TestLab_RealAdd', and hold two other
values e.g. 1.2 and 6.5. Evaluating the 'TestLab_RealAdd' would result in the
sum of both values, being 7.7, also a real value.

86 LMS Test.Lab Automation manual


Chapter 5 Reference guide

So even if the port can only hold real values, the actual data types passed, can
differ, depending on the recipe they represent. In order to avoid having to check
for all kinds of different 'recipes' passing on a single port, the user can request to
have the data converted to a predefined buffer-type before handing it over to the
client application. The next figure points out the meaning of the 'IsBuffered'
flag, which can be passed in the 'FindDataWatch' method. The default setting
value for this parameter is to return the buffered-type data.

In the previous scenario, the application holds a port of type real. Such a
Test.Lab real can hold a calculated value, as in the case of Buffer_Real, or it can
hold a recipe to calculate an real value, e.g. Sum_Real. If you turn
'IsAutoBuffered' off, you get the raw object types as they pass on the port. If it
is turned on, the recipe is evaluated and turned into a buffered form, which
contains the result. That way the client application does not have to take all
different possible Test.Lab object types into account.
 Example
Spectral_Start_Measure_Port =
TestLab.ActiveBook.FindDataWatch("Spectral\/Measure",5000,T
rue)
...
Does_this_datawatch_have_autobuffering_on =
Spectral_Start_Measure_Port.IsAutoBuffered

IsReadOnly
 Signature
IsReadOnly As Integer
 Type
Read-only
 Description
Returns of the DataWatch is read only or not.

Rev 13A 87
Chapter 5 Reference guide

UpdateFrequency
 Signature
UpdateFrequency As Integer
 Type
Read-only
 Description
Returns the time interval used for event notification. If no event routine is
registered this value is irrelevant. If event notification is required, this update
frequency in milliseconds will specify the rate at which Test.Lab will check for
new values on the port, identified by the datawatch object. This
'UpdateFrequency' is the worst-case latency before getting notified in the client
application. The smaller the value, the more frequent Test.Lab will check for
changes, thus consuming more the server CPU time, but communicating the
changes quicker to the client application.
 Example
tacho_value_datawatch =
TestLab.ActiveBook.FindDataWatch("Tacho_Value",250,True)
Rpm_value_update_freq = rpm_value_datawatch.UpdateFrequency
Have Test.Lab check the 'tacho_value' port every quarter of a second for new
values and call the "tacho_value_datawatch_ValueChanged" event routine if
anything has changed.
measurement_state_datawatch =
TestLab.ActiveBook.FindDataWatch("Measure_Acquisition_State",2000,True)
measurement_state_ update_freq =
measurement_state_datawatch.UpdateFrequency
Have Test.Lab check the Measurement state port every 1/2000th of a second for
new values and call the "measurement_state_datawatch_ValueChanged" event
routine if anything has changed.

Section 5.6.4 Events

ValueChanged
 Signature
Private Sub <DataWatchName>_ValueChanged(ByVal NewValue As
Variant)
 Description
Whereas properties and methods define a synchronous communication between
a client and server application, the automation 'Event' mechanism provides a
way to let the server notify a client application of a specific happening.
The 'ValueChanged' event, defined on the DataWatch object, allows a client to
register a callback routine. This routine, on the client side, will be called
whenever data changes on the specified port. The frequency, with which to

88 LMS Test.Lab Automation manual


Chapter 5 Reference guide

check for changes, can be configured by means of the 'UpdateFrequency'


parameter in the 'FindDataWatch' method. A 'Data' property on a datawatch
object returns the instantaneous data on the associated port, whereas an event
routine will be called whenever the data on the port changes.
 Example
Public WithEvents my_port As LMSTestLabAutomation.DataWatch
...
my_port = testlab.ActiveBook.FindDataWatch("Measure_Run")

Private Sub _ValueChanged(ByVal NewValue As Variant)
'Show the new runname on the screen
text1.text = NewValue
End Sub

Section 5.7 Enumerate

The usage of this interface is shown in example 4.

Section 5.7.1 Contents

 Definition
 Methods
 ReplaceIntValue
 ReplaceLocalValue
 Properties
 IntValue
 LocalValue
 Range

Section 5.7.2 Definition

Enumerate provides an interface to objects, that in Test.Lab represents


enumeration types.

Rev 13A 89
Chapter 5 Reference guide

Enumerate interfaces

There exist a lot of these so called enum-types. Some of them do have their own
implementation in the type library (ex. CONST_EnumWindowing), most of
them do not. This provides Automation users a generic interface to all these
types.

If you have a IData object, you can see at its type if it is a Enumerate or not: if
you find "Enum" in its type, it is!

You can read and write the current value of this enum-object, both as integer
and as a string (=LocalValue).

You also can ask all possible values of it.

Section 5.7.3 Methods

ReplaceIntValue
 Signature
ReplaceIntValue(NewValue As Integer) As Enumerate.
 Description
This function replaces the current value of an enumerate, by specifying its value
as a number. The number must be in the range. The result is another enumerate
with the replaced value. The original object still exists and is not changed.

90 LMS Test.Lab Automation manual


Chapter 5 Reference guide

ReplaceLocalValue
 Signature
ReplaceLocalValue(NewValue As Integer) As Enumerate.
 Description
This function replaces the current value of an enumerate, by specifying its value
as a string. This string can be found in the result of the ‘range’ method. The
result is another enumerate with the new value. The original object still exists
and is not changed.

Section 5.7.4 Properties

IntValue
 Signature
IntValue As Integer
 Type
Read-only
 Description
This function returns an integer, representing the current value of the enum
object.
LocalValue
 Signature
LocalValue As String
 Type
Read-only
 Description
This function returns a string, representing the current value of the enum object.
Range
 Signature
Range As AttributeMap
 Type
Read-only
 Description
This function returns an attributemap, containing all possible values of the
enumerate. The name of the items of the range are the possible stringvalues it
can have, the content of its items the possible numbers where it corresponds
with.

Rev 13A 91
Chapter 5 Reference guide

Section 5.8 Factory

Section 5.8.1 Contents

 Definition
 Methods
 COMPLEX_TO_SCALAR
 DOUBLE_TO_SCALAR
 CreateAttributeMap
 CreateEnumerate
 CreateObject
 CreateThroughputData

Section 5.8.2 Definition

With the factory, you can create a whole list of typical Test.Lab objects. The
same functionality can also be found in other places (for backwards
compatibility reasons) .

A Factory can be obtained via the property Factory on an IApplication or an


IModule.

92 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Factory interfaces

Section 5.8.3 Methods

COMPLEX_TO_SCALAR
 Signature
COMPLEX_TO_SCALAR(Real As Double, Imag As Double, Quantity As
IQuantity, UnitSelection As CONST_EnumUnitSelection = UserUnits) As
IScalar
 Description
This function creates a IScalar, starting from its real and imag value and its
quantity. The value can be specified in user units and in MKS, depending on the
UnitSelection.
DOUBLE_TO_SCALAR
 Signature
DOUBLE_TO_SCALAR(Value As Double, Quantity As IQuantity,
UnitSelection As CONST_EnumUnitSelection = UserUnits) As IScalar
 Description
This function creates a IScalar, starting from its value and its quantity. The
value can be specified in user units and in MKS, depending on the
UnitSelection.

Rev 13A 93
Chapter 5 Reference guide

CreateAttributeMap
 Signature
CreateAttributeMap() As IAttributeMap
 Description
This function returns an integer, representing the current value of the enum
object.
CreateEnumerate
 Signature
CreateEnumerate(DesiredEnumType As String, Value As Object = Nothing) As
Enumerate
 Description
This function can be used to create an Test.Lab enum type. The internal type of
the enum has to be specified. The Value of it can also be specified, both as an
int and as a string (= local value). If no value is specified, a default value is
taken.
CreateObject
 Signature
CreateObject(DesiredType As String, Attributes As IAttributeMap) As IData
 Description
This function returns an attributemap, containing all possible values of the
enumerate. The name of the items of the range are the possible stringvalues it
can have, the content of its items the possible numbers where it corresponds
with.
CreateThroughputData
 Signature
CreateThroughputData(TdfFileName As String) As IData
 Description
This function returns an IData object, openened from the data file, given as
parameter.

Section 5.9 IBlock2

The usage of this interface is shown in examples: 1, 4, 6 and 7.

94 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.9.1 Contents

 Definition
 Properties
 XCount
 XValues
 XAxisId
 YValues
 YAxisId
 RealYValues
 XQuantity
 YQuantity
 Header
 Label
 UserAttributes
 Properties
 Methods
 ReplaceXDoubleValues
 ReplaceXEquidistantValues
 ReplaceXIntValues
 ReplaceXEquidistantIntValues
 ReplaceXEquidistantDoubleValues
 ReplaceXQuantity
 DeleteXAxis
 ReplaceYComplexValues
 ReplaceYDoubleValues
 ReplaceYIntValues
 ReplaceYEquidistantIntValues
 ReplaceYEquidistantDoubleValues
 ReplaceYQuantity
 ReplaceHeader
 ReplaceUserAttributes

Section 5.9.2 Definition

IBlock2 is the interface to data blocks in Test.Lab.

Rev 13A 95
Chapter 5 Reference guide

IBlock2 interfaces

Section 5.9.3 Properties

XCount
 Signature
XCount As Integer
 Type
Read-only
 Description
Returns the number of X-axes in the block.
Since it is possible to define more then 1 x-axis on a block, this functionality
learns how many x-axes there actually are on the block.
 Example
Dim number_of_axes as Integer
number_of_axes = BlockData.XCount

XValues
 Signature
XValues(ac_nIndex As Integer = 0) As Array

96 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Type
Read-only
 Description
Returns an array of double values, holding all the values of the axisNumberth
X-axis. If no axis index is specified the values of the first one are returned.
Index values are zero-based.
 Example
If BlockPort.Data.Type =
"LmsHq::DataModelI::Expression::CBufferIBlock" Then
Dim BlockData As LMSTestLabAutomation.IBlock
BlockData = BlockPort.Data
'Get the X-values
Dim xval() As Double
xval = BlockData.Xvalues(1)
length = UBound(xval) - LBound(xval) + 1
End If
XAxisId
 Signature
XAxisId(ac-nIndex as Integer) As String
 Type
Read-only
 Description
Returns the ID of the nth x-axis.
YValues
 Signature
YValues As Double
 Type
Read-only
 Description
Returns a two-dimensional array of double values, holding in its first dimension
all real values and in the second dimension all imaginary values of the Y-axis.
YAxisId
 Signature
YAxisId As String
 Type
Read-only
 Description
Returns the ID of the y-axis.

Rev 13A 97
Chapter 5 Reference guide

RealYValues
 Signature
RealYValues As System.Array
 Type
Read-only
 Description
Returns only the real part of the y-values.
XQuantity
 Signature
XQuantity(ac_nIndex As Integer = 0) As IQuantity
 Type
Read-only
 Description
Gets quantity for the xisNumberth X-axis. Default value for n is zero, which is
the first one.
 Example
Read in the label of the unit of the Y-Axis
Dim XUnitLabel As String
XUnitLabel =
TestLab.UnitSystem.Label(BlockData.Xquantity(1))

YQuantity
 Signature
YQuantity As IQuantity
 Type
Read-only
 Description
Gets the Y-axis quantity.
 Example
Dim YUnitLabel As String
YUnitLabel = TestLab.UnitSystem.Label(BlockData.YQuantity)

Header
 Signature
Header As IHeader
 Type
Read-only
 Description
Returns the header of the data block. This is for advanced users only: normally
a user works via the properties!

98 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Example
BlockData = BlockPort.Data
Dim Blockheader As LmsTestLabAutomation.IHeader
Blockheader = BlockData.Header

Label
 Signature
Label As String
 Type
Read-only
 Description
Returns the label of the data block.
UserAttributes
 Signature
UserAttributes As IAttributeMap
 Type
Read-only
 Description
Shows the user attributes of this object. The attribute values are returned in an
AttributeMap. There is no application context limitation on the contents of the
'UserAttributes' list, and can be extended freely to host additional information.
This means that the application does not use the contents of the userattributes to
interpret the measurement data, as opposed to the header object.

Note: For UPA users: since headers in CADA-X were fixed and contained some
unused fields, depending on the type of blocks it described, these fields were
'used' to store some user annotation. In Test.Lab the header contains only those
fields essential for the application to interpret the data, these rarely need to be
modified.

All user annotation can be safely stored and retrieved in the UserAttributes.
 Example
Dim BlockData As LMSTestLabAutomation.IBlock
BlockData = BlockPort.Data
Dim user_attributes as LMSTestLabAutomation.AttributeMap
user_attributes = BlockData.UserAttributes

Properties
 Signature
Properties As IAttributeMap
 Type
Read-only

Rev 13A 99
Chapter 5 Reference guide

 Description
Shows the properties of this object. The properties are returned in an
AttributeMap object.
Shows some property values. They are a predefined, application dependent of
name value pairs. The information presented is a summary of information
coming from header, axis and user attributes.

Section 5.9.4 Methods

ReplaceXDoubleValues
 Signature
ReplaceXDoubleValues(ac_xXValues As System.Array, ac_nIndex As Integer
= 0) As IBlock2
 Description
This method creates a new IBlock2 object based upon the old block, but with
the X- MKS-values of the 'axisindex'-th axis replaced by the specified array of
doubles. If omitted AxisIndex = 0;
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim array_of_double_values () as Integer
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceXDoubleValues (
array_of_double_values,2 )

100 LMS Test.Lab Automation manual


Chapter 5 Reference guide

ReplaceXEquidistantValues
 Signature
ReplaceXEquidistantValues(ac_dStart As Double, ac_dIncrement As Double,
ac_nNumberOfValues As Integer = 0) As IBlock2
 Description
Replaces the ' ac_dStart '-th X-axis with an equidistant one, starting with the
Double ac_dStart and increment ac_dIncrement. If omitted, nNumberOfValues
= 0;
ReplaceXIntValues
 Signature
ReplaceXIntValues(ac_xValues As System.Array, ac_nIndex As Integer = 0)
As IBlock2
 Description
This method creates a new IBlock2 object based upon the old block, but with
the X- MKS-values of the 'axisindex'-th axis replaced by the specified array of
integers. If omitted AxisIndex = 0;
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim array_of_int_values() as Integer
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceXDoubleValues (
array_of_int_values,2 )

ReplaceXEquidistantIntValues
 Signature
ReplaceXEquidistantIntValues(ac_nStart As Integer, ac_nIncrement As Integer,
ac_nIndex As Integer = 0) As IBlock2
 Description
Replaces the ' ac_nIndex '-th X-axis with an equidistant one, starting with the
integer ac_nStart and increment ac_nIncrement. If omitted, ac_nIndex = 0.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceXEquidistantIntValues (16,2,2 )

ReplaceXEquidistantDoubleValues
 Signature
ReplaceXEquidistantDoubleValues(ac_nStart As Integer, ac_nIncrement As
Integer, ac_nIndex As Integer = 0) As IBlock2

Rev 13A 101


Chapter 5 Reference guide

 Description
Replaces the ' ac_nIndex '-th X-axis with an equidistant one, starting with the
double ac_nStart and increment ac_nIncrement. If omitted, ac_nIndex = 0.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceXEquidistantDoubleValues
(10.3,2.5,2 )

ReplaceXQuantity
 Signature
ReplaceXQuantity(ac_xXQuantity As IQuantity, ac_nIndex As Integer = 0) As
IBlock2
 Description
Replaces the quantity of the ‘ac_nIndex ‘-th X-axis with the specified one. If
omitted, ac_nIndex = 0.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceXQuantity (new_tl_quantity )

DeleteXAxis
 Signature
DeleteXAxis(ac_nIndex As Integer = 0) As IBlock2
 Description
Deletes the specified X-axis. If no index is specified the first one is taken as
default.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. DeleteXAxis (1 )

ReplaceYComplexValues
 Signature
ReplaceYComplexValues(ac_xYValues As System.Array) As IBlock2
 Description
This method creates a new IBlock2 object based upon the old block, but with
the Y-values replaced by the specified two-dimensional array of doubles. First
dimension will contain the real, second the imaginary values.

102 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Note: The Y-Values must be expressed in MKS, and not in User Unit values

 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim array_of_ complex _values (2)() as Integer
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceYComplexValues (
array_of_complex_values)

ReplaceYDoubleValues
 Signature
ReplaceYDoubleValues(ac_xYValues As System.Array) As IBlock2
 Description
This method creates a new IBlock2 object based upon the old block, but with
the real Y-values replaced by the specified one-dimensional array of doubles.

Note: The Y-Values must be expressed in MKS, and not in User Unit values

 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim array_of_double_values () as Integer
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceYDoubleValues (
array_of_double_values)

ReplaceYIntValues
 Signature
ReplaceYIntValues(ac_xYValues As System.Array) As IBlock2
 Description
Replaces the Y-axis with the values in the passed array of integers and return
the newly created IBlock2 object.

Note: The Y-Values must be expressed in MKS, and not in User Unit values

 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim array_of_int_values() as Integer
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceYDoubleValues (
array_of_int_values)

Rev 13A 103


Chapter 5 Reference guide

ReplaceYEquidistantIntValues
 Signature
ReplaceYEquidistantIntValues(ac_nStart As Integer, ac_nIncrement As Integer)
As IBlock2
 Description
Replaces the Y-axis with an equidistant one, starting with the integer
NewStartYValue and increment YaxisIncrement.

Note: The Y-Values must be expressed in MKS, and not in User Unit values

 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceYEquidistantIntValues (16,2)

ReplaceYEquidistantDoubleValues
 Signature
ReplaceYEquidistantIntValues(ac_nStart As Integer, ac_nIncrement As Integer)
As IBlock2
 Description
Replaces the Y-axis with an equidistant one, starting with the double
NewStartYValue and increment YaxisIncrement.

Note: The Y-Values must be expressed in MKS, and not in User Unit values

 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2
NewBlock = TlBlock. ReplaceYEquidistantIntValues (10.3,2.5)

ReplaceYQuantity
 Signature
ReplaceYQuantity(ac_xYQuantity As IQuantity) As IBlock2
 Description
Replaces the quantity of the Y-axis with the specified one, and returns the
newly created block.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
...
Dim NewBlock as LMSTestLabAutomation.IBlock2

104 LMS Test.Lab Automation manual


Chapter 5 Reference guide

NewBlock = TlBlock. ReplaceYQuantity (new_tl_quantity )

ReplaceHeader
 Signature
ReplaceHeader(ac_xHeader As IHeader) As IBlock2
 Description
Creates a new IBlock2 object, based on the original one, with only the header
object replaced with the passed NewHeader.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim NewBlock as LMSTestLabAutomation.IBlock2
Dim ModifiedHeader as LMSTestLabAutomation.IHeader
...
ModifiedHeader = OrigHeader.Edit((
"HeaderFieldZ",UpdatedvalueforZ )
NewBlock = TlBlock. ReplaceHeader (ModifiedHeader)

ReplaceUserAttributes
 Signature
ReplaceUserAttributes(ac_xAttributeMap As AttributeMap) As IBlock2
 Description
Creates a new IBlock2 object, based on the original one, with only the user
attributes replaced with the passed NewUserAttributes.
 Example
Dim TlBlock as LMSTestLabAutomation.IBlock2
Dim ModifAttrib as LMSTestLabAutomation.AttributeMap
ModifAttrib = TlBlock.UserAttributes
ModifAttrib.Add("MyOwnAnnotation","VehicleType ABC")
Dim NewBlock as LMSTestLabAutomation.IBlock2
...
NewBlock = TlBlock. ReplaceUserAttributes (ModifAttrib)

Rev 13A 105


Chapter 5 Reference guide

Section 5.10 IBook

Section 5.10.1 Contents

 Definition
 Properties
 ActiveMinorWatch
 ActiveAlternativeWatch
 ActiveSectionName
 ActiveSectionWatch
 ActuveSheetWatch
 AkternativeOnTop
 ID
 MinorOnTop
 SheetOnTop
 Sheets
 Methods
 Close
 CreateDataWatch
 Database
 FindDataWatch
 NewSection
 Save
 SaveAsTemplate
 SwitchSection

Section 5.10.2 Definition

An IBook corresponds in a running Test.Lab with a workbook, simply said an


open project. You can have more then 1 open project at the time, but there is
only one active book.

106 LMS Test.Lab Automation manual


Chapter 5 Reference guide

IBook interfaces

Section 5.10.3 Properties

ActiveMinorWatch

Rev 13A 107


Chapter 5 Reference guide

 Signature
ActiveMinorWatch As Watch
 Type
Read-only
 Description
This property returns a watch to the Minor sheet. It’s possible to define a
"Value-Changed’ callback on this watch, that will be fired the moment the
operator changes the active minor sheet.
An example of minor sheets is: "Project Info" or "Section Info" in the
Documentation sheet.

ActiveAlternativeWatch
 Signature
ActiveAlternativeWatch As Watch
 Type
Read-only
 Description
This property returns a watch to the Alternative sheet. It is possible to define a
"Value-Changed’ callback on this watch, that will be fired the moment the
operator changes the active alternative sheet.

108 LMS Test.Lab Automation manual


Chapter 5 Reference guide

An example of an ‘alternative sheet’: on the ‘Channel Setup’ sheet, these are


alternative sheets: ‘Channel Setup’, ‘Use Database’, ‘Read TEDS’, ‘Bridge
Settings’, ‘Use Geometry’.

ActiveSectionName
 Signature
ActiveSectionName As String
 Type
Read-only
 Description
This property will hold the currently active section name for the book of which
you retrieve this property.
 Example
Dim Selected_book As LMSTestLabAutomation.IBook
Selected_book = TestLab.Books(0)
SectionName = Selected_book.ActiveSectionName

ActiveSectionWatch
 Signature
ActiveSectionWatch As Watch
 Type
Read-only
 Description
This property returns a watch to the Active Section. It is possible to define a
"Value-Changed’ callback on this watch, that will be fired the moment the

Rev 13A 109


Chapter 5 Reference guide

operator switches sections.


ActiveSheetWatch
 Signature
ActiveSheetWatch As Watch
 Type
Read-only
 Description
This will hold a Watch object that allows access to the active sheet name. The
active sheet is the sheet in the active book that is on top. This function gives a
way to seek and modify the sheet that is activated.

 Example
Dim ActiveSheet as LMSTestLabAutomation.Watch
ActiveSheet = TestLab.ActiveBook.ActiveSheetWatch
Currentsheetname = ActiveSheet.Data
'reads the currently active sheetname
ActiveSheet.Data = "Measure"
'sets the Measure sheet on top
AlternativeOnTop
 Signature
AlternativeOnTop As Object
 Type
Write-only

110 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Description
Brings the specified alternative sheet on top.
An example of an ‘alternative sheet’: on the ‘Channel Setup’ sheet, these are
alternative sheets: ‘Channel Setup’, ‘Use Database’, ‘Read TEDS’, ‘Bridge
Settings’, ‘Use Geometry’.
 Example
gAppl.ActiveBook.MinorOnTop = "Use Database"

ID
 Signature
ID As String
 Type
Read-only
 Description
Returns the ID of the book.
MinorOnTop
 Signature
MinorOnTop As Object
 Type
Write-only
 Description
Brings the specified Minor sheet on top.
An example of minor sheets is: "Project Info" or "Section Info" in the
Documentation sheet.
 Example
gAppl.ActiveBook.MinorOnTop = "Section Info"

SheetOnTop
 Signature
SheetOnTop As Object
 Type
Write-only
 Description
A book presents a number of sheets to the user to offer some process guidance,
sequencing support, run-time add-in functionality, etc. Once a book is
instantiated, there is always one single sheet selected and drawn as the active
one. The UI content of the active sheet is the one that gets shown.
The property 'SheetOnTop' can be used to retrieve the localized name of the
active sheet. Setting this property however instructs the application to switch to
the indicated sheet. It can be to the localized name of the sheet or to its index

Rev 13A 111


Chapter 5 Reference guide

Note: The index to be used is the sheet sequence number, as it occurs in the
initial list of sheets. So if a sheet was moved forward or backwards, by means of
Tools Workbook Configuration ... its index still stays the same.

So if a sheet was moved forward or backwards, by means of Tools Workbook


Configuration ... its index still stays the same.
This method is just a subof the functionality offered by ActiveSheetWatch.
 Example
Active_sheet_name = TestLab.ActiveBook.SheetOnTop
Retrieves the localized name of the active sheet.
TestLab.ActiveBook.SheetOnTop = "Measure"
Brings up the sheet showing "Measure"
TestLab.ActiveBook.SheetOnTop = 3
Brings up the sheet which is in the third one in the original workbook
configuration.
Sheets
 Signature
Sheets As ISheets
 Type
Read-only
 Description
The 'Sheets' property will return an interface to a list of sheets.
Just as with the collection of books, to which you got access by means of the
'Books' method on the Application object, you can get a hold of all available
sheets in a single book.

112 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Example
Dim List_of_sheets as LMSTestLabAutomation.ISheets
List_of_sheets = TestLab.ActiveBook.Sheets

Section 5.10.4 Methods

Close
 Signature
Close()
 Description
Closes the book on which the method was issued. This method will remove all
runtime data from the Test.Lab application without saving any. If saving data is
required, use the, previously described, 'Save' method on the same IBook object.
 Example
Dim Open_book as LMSTestLabAutomation.IBook
TestLab.OpenProject("c:/MyProject/PRJ1234.lms")
Open_book = TestLab.ActiveBook
...
Open_book.Close()

CreateDataWatch
 Signature
CreateDataWatch(ID As String, PortDataType As String, WatchType As
CONST_EnumDataWatchType = CONST_DataWatchTypeData, IsPersistent
As Integer = 0, MaxUpdateFrequency As Integer = 1000, IsVisible As Integer =
1, IsAutoBuffered As Integer = 1, InitialFiring As Integer = 1) As IDataWatch
General Port ID: ID of the port.
DataType: Type of data the port can hold.
IsPersistent: Boolean value to specify if the value on the port has been saved
upon saving the project.
MaxUpdateFrequency: the interval, specified in milliseconds, with which the
system will check the contents of the port and notify the client application if the
value on the port has changed since the previous check. Default is 1000.
IsAutoBuffered: a Boolean value to indicate that the value returned from the
datawatch needs to be returned as a buffered, normalized type. Default is 1 is
autobuffered.
IsVisible: a Boolean value to indicate whether the port should be visible in the
'online-data' of the Test.Lab GUI. Default is 1 is visible.
 Description
Modules communicate by means of ports. All Test.Lab applications implicitly
define a of ports to allow their modules to communicate. Next to these

Rev 13A 113


Chapter 5 Reference guide

predefined ports, a user can create his own ports. Such externally created ports
can be used to store data to the active section, or to drag and drop into a
Test.Lab display.
When the user creates a port at runtime, it can be found in the 'Online-Data'
section in the navigator sheet. Once a port is created is treated no different from
any other predefined one and can be dragged and dropped in a display for
instance. Once it is dropped the display will get notified whenever the data on
de port changes. Independent whether the data comes from another Test.Lab
module or an external application.
 Example
Dim MyOwn_Port as LMSTestLabAutomation.DataWatch
MyOwn_Port =
TestLab.ActiveBook.CreateDataWatch("BreakSqual_Analysis_Res
ult")

Database
 Signature
Database() As IDatabase
 Description
This method allows a client application to have access to a project database,
without opening it in a new workbook. The interface IDatabase has all the
functionality of the project database.
 Example
Dim TL_DB As LMSTestLabAutomation.IDatabase
TL_DB = TestLab.ActiveBook.Database

FindDataWatch
 Signature
FindDataWatch(DataPathName As String, MaxUpdateFrequency As Integer =
1000, IsAutoBuffered As Integer = 1, InitialFiring As Integer = 1) As
IDataWatch
General Port ID: ID of the port.
MaxUpdateFrequency: the interval, specified in milliseconds, with which the
system will check the contents of the port and notify the client application if the
value on the port has changed since the previous check. Default is 1000.
IsAutoBuffered: a Boolean value to indicate that the value returned from the
datawatch needs to be returned as a buffered, normalized type.
 Description
Each book has its own of DataWatches. With the function "FindDataWatch",
they can be retrieved.
A user can have different books running, when, for instance, preparing a setup
in one while launching a measurement in another one. In such scenarios,
pushing a start- measure button in one book shouldn't be communicated out of
the boundaries of that one book.
A 'FindDataWatch' call for 'measurement_start' on book1 will return a different

114 LMS Test.Lab Automation manual


Chapter 5 Reference guide

DataWatch object then the same call on book2.

 Example
Dim Spectral_Start_Measure_Port as
LMSTestLabAutomation.DataWatch
Spectral_Start_Measure_Port =
TestLab.ActiveBook.FindDataWatch("Start_Measure")

NewSection
 Signature
NewSection(av_sSectionName As String)
 Description
Creates a new section on the project associated with this book object. This

Rev 13A 115


Chapter 5 Reference guide

method has the same effect as if a user would go to Data New Section....
An error status will be returned when the supplied name is the name of an
existing section.
 Example
TestLab.OpenProject("c:/MyProject/PRJ1234.lms")
Open_book = TestLab.ActiveBook
Open_book.NewSection("MyAutomationSession")

Save
 Signature
Save(ac_SaveAsName As Object = Nothing, Compress As Integer = 0)
 Description
Saves all application related information to the active project, with which the
book was created.
When an explicit filename is provided as parameter, the 'Save' method will act
as a 'save as'. If not, it will be saved with the same name as the one it was
opened with. Should the book be created on a temporary project, e.g. with the
CreateProject method, the 'Save' will return an error.
The optional <compress> parameter indicates whether the database should be
compressed upon saving or not. Default value is FALSE.
 Example
TestLab.OpenProject("c:/MyProject/PRJ1234.lms")
Open_book = TestLab.ActiveBook
...
Open_book.Save("c:/MyProject/Updated_PRJ1234.lms")

SaveAsTemplate
 Signature
SaveAsTemplate(ac_szSaveAsTemplateName As String,
ac_bSaveWithoutMeasuredData As Integer = 1)
 Description
This function saves the book as a template project. The name of the template
can be specified. The optional parameter "SaveWithoutMeasuredData" gives
the opportunity to save the measured data or not.
SwitchSection
 Signature
SwitchSection(av_sSectionName As String)
 Description
Switches all settings data of the book to that in the specified section on the
project associated with this book object. This method has the same effect as if a
user would select a different section name in the toolbar.
An error status will be returned when the supplied name does not exist as

116 LMS Test.Lab Automation manual


Chapter 5 Reference guide

section.
 Example
TestLab.OpenProject("c:/MyProject/PRJ1234.lms")
Open_book = TestLab.ActiveBook
Open_book.SwitchSection("Section2")

Section 5.11 IBooks

Section 5.11.1 Contents

 Definition
 Properties
 Count
 Item

Section 5.11.2 Definition

IBooks is a list of books, e.g. all open workbooks in Test.Lab. As indicated


previously, this interface offers some functions on the list of running workbook
instances. The 'IBooks' interface meets all requirements, forth by automation,
for being a collection.

Rev 13A 117


Chapter 5 Reference guide

IBooks interfaces

Section 5.11.3 Properties

Count
 Signature
Count As Integer
 Type
Read-only
 Description
Returns the number of books currently running in the application. This allows
you to iterate all running instances.
 Example
Dim List_of_opened_books As LMSTestLabAutomation.IBooks
number_of_books = List_of_opened_books.Count
For loopcounter = 1 To number_of_books ...
end for

Item

118 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Signature
Item(index As Object) As Object
 Type
Read-only
 Description
Using the Item property you can retrieve a specific book. The desired book can
be indicated by passing an sequence number n to the 'Item' property, saying give
me a reference to the nth book.
Another way of retrieving a book from the list of books, is by means of its
unique id. Such an id is returned when creating a book. For example when you
have a NewProject or OpenProject.
 Example
Dim SingleBook As LMSTestLabAutomation.IBook
SingleBook = List_of_opened_books.Item(1)
SingleBook = List_of_opened_books.Item(Bookid)
SingleBook = List_of_opened_books.Item1
SingleBook = List_of_opened_books.Bookid
All these examples retrieve a book from the available books' list. The last two
are Visual Basic shorthand.

Section 5.12 ICmd

The usage of this interface is shown in example 6.

Rev 13A 119


Chapter 5 Reference guide

Section 5.12.1 Contents

 Definition
 Methods
 BLOCK_ADD
 BLOCK_ADD_SCALAR
 BLOCK_ARTICULATION_INDEX
 BLOCK_AUTOPOWER_SPECTRUM
 BLOCK_CONJUGATE_MULTIPLY
 BLOCK_CROSSPOWER_SPECTRUM
 BLOCK_DIFFERENTIATE
 BLOCK_DIVIDE
 BLOCK_DIVIDE_SCALAR
 BLOCK_FFT
 BLOCK_INTEGRATE
 BLOCK_INVERSE
 BLOCK_LINEARSMOOTHING
 BLOCK_LOUDNESS
 BLOCK_MULTIPLY
 BLOCK_MULTIPLY_SCALAR
 BLOCK_OCTAVE
 BLOCK_PHASEREFERENCE_SPECTRUM
 BLOCK_POL_INTERPOLATE
 BLOCK_PULSE
 BLOCK_RANDOM
 BLOCK_RMS
 BLOCK_SAWTOOTH
 BLOCK_SHARPNESS
 BLOCK_SINE
 BLOCK_SMOOTHING
 BLOCK_SPECTRUM
 BLOCK_SUBTRACT
 BLOCK_SUBTRACT_SCALAR
 BLOCK_WEIGHTING
 BLOCK_WINDOW
 COMPLEX_TO_SCALAR
 DOUBLE_TO_SCALAR
 RECIPROCAL_SWITCH
 Properties
 AdvancedCmd

120 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.12.2 Definition

This interface provides access to the list of mathematical functions, which you
can perform on different types of Test.Lab data. From 6A on, the standard
interfaces are rewritten, so that they are easy to use.

Via the "AdvancedCmd" property, some extended commands are available.

ICmd interfaces

Section 5.12.3 Methods

BLOCK_ADD
 Signature
BLOCK_ADD (Source as IBlock2, Operand As IBlock2) As IBlock2
 Description
This command allows you to add a Source and an Operand block. The X- axes
of both blocks must be equal, the Y-quantities also.
BLOCK_ADD_SCALAR

Rev 13A 121


Chapter 5 Reference guide

 Signature
BLOCK_ADD_SCALAR ( Source As IBlock2, Operand as IScalar) As IBlock2
 Description
This command allows you to add a 'scalar' to the Source block. The value of the
scalar will be added to all Y-values. The quantity of the scalar must be equal to
the quantity of the X-axes of the block.
BLOCK_ARTICULATION_INDEX
 Signature
BLOCK_ARTICULATION_INDEX (Source As IBlock2, ArtMethod As
CONST_EnumArticulationMethod =ArticulationMethodNormal) As IScalar
 Description
This calculation will get the Articulation Index out of a 3rd Octave Block.
ArticulationMethod can be normal (default) or open.

Note: the input block already must be a 3rd Octave Spectrum!

BLOCK_AUTOPOWER_SPECTRUM
 Signature
BLOCK_AUTOPOWER_SPECTRUM (SourceBlock As IBlock2,
AmplitudeScaling As CONST_EnumAmplitudeScaling = 0, SpectrumFormat
As CONST_EnumSpectrumFormat = 0) As IBlock2
 Description
This command does the processing of the Auto Power with given
AmplitudeScaling and SpectrumFormat from a time SourceBlock. If the
SourceBlock already is a spectrum, the result is scaled to the given
AmplitudeScaling and SpectrumFormat.
BLOCK_CONJUGATE_MULTIPLY
 Signature
BLOCK_CONJUGATE_MULTIPLY ( Source As IBlock2, Operand As
IBlock2) As IBlock2
 Description
This command allows you to do a conjugate multiply between a Source and an
Operand block. The X-axes of both blocks must be equal. The dimensions of
the Y-axes will be added.
BLOCK_CROSSPOWER_SPECTRUM
 Signature
BLOCK_CROSSPOWER_SPECTRUM (SourceBlock As IBlock2,
ReferenceBlock As IBlock2, AmplitudeScaling As
CONST_EnumAmplitudeScaling = 0) As IBlock2
 Description
This command calculates the Cross Power with given AmplitudeScaling from a

122 LMS Test.Lab Automation manual


Chapter 5 Reference guide

time SourceBlock. If the SourceBlock already is a spectrum, the result is scaled


to the AmplitudeScaling. Source and Reference must have the same length,
window type, weighting type and function record type. The spectrum format is
always to Power.
BLOCK_DIFFERENTIATE
 Signature
BLOCK_DIFFERENTIATE(SourceBlock As IBlock2, DiffTimes As Long = 1,
PolyOrder As Long = 2) As IBlock2
 Description
This command can differentiate both time signals and spectra. The PolyOrder is
only used for time blocks: first a curve of this degree is fitted trough the data,
afterwards a differentiation is done on this fitted curve.
BLOCK_DIVIDE
 Signature
BLOCK_DIVIDE (Source as IBlock2, Operand As IBlock2) As IBlock2
 Description
This command allows you to divide the Source block with an Operand block.
The X-axes of both blocks must be equal. The dimensions of the Y- axes will be
subtracted.
BLOCK_DIVIDE_SCALAR
 Signature
BLOCK_DIVIDE_SCALAR (Source As IBlock2, Operand As IScalar) As
IBlock2
 Description
This command allows you to divide a Source Block with a 'scalar'. The value of
the scalar will be divided to all Y- values. The dimension of the scalar will be
subtracted from the dimension of the X-axes of the block.
BLOCK_FFT
 Signature
BLOCK_FFT (SourceBlock As IBlock2) As IBlock2
 Description
This command executes an FFT on the SourceBlock. If it is a time signal, the
spectrum is calculated.
BLOCK_INTEGRATE
 Signature
BLOCK_INTEGRATE(SourceBlock As IBlock2, IntegrateTimes As Long = 1,
IntegrationMethod As CONST_EnumIntegrationMethod =
IntegrationMethodTrapezium) As IBlock2
 Description
This command integrates both time signals as spectra. The Integration Method

Rev 13A 123


Chapter 5 Reference guide

is only used for time blocks.


BLOCK_INVERSE
 Signature
BLOCK_INVERSE (Source As IBlock2) As IBlock2
 Description
This command allows you to inverse a Source block (inverse concerning a
multiplication).
BLOCK_LINEARSMOOTHING
 Signature
BLOCK_LINEARSMOOTHING(Source As IBlock2) As IBlock2
 Description
This command allows you to smooth a Source block lineairy.
BLOCK_LOUDNESS
 Signature
BLOCK_LOUDNESS (Block As IBlock2, SoundField As
CONST_EnumSoundField = SoundFieldDiffuse) As IScalar
 Description
This calculation will get the loudness out of a 3rd octave Block. If the Y- axis is
complex, only its real values will be taken into account. With the option
"SoundField" you can indicate how the data was achieved: in the "free field" or
in the "diffuse field".

Note: the input block already must be a 3rd Octave Spectrum!

BLOCK_MULTIPLY
 Signature
BLOCK_MULTIPLY ( Source As IBlock2, Operand As IBlock2) As IBlock2
 Description
This command allows you to multiply a Source and an Operand block. The
X-axes of both blocks must be equal. The dimensions of the Y-axes will be
added.
BLOCK_MULTIPLY_SCALAR
 Signature
BLOCK_MULTIPLY_SCALAR (Source As IBlock2, Operand As IScalar) As
IBlock2
 Description
This command allows you to multiply a 'scalar' with the Source block. The
value of the scalar will be multiplied to all Y-values. The dimension of the
scalar will be added to the dimension of the X-axes of the block.

124 LMS Test.Lab Automation manual


Chapter 5 Reference guide

BLOCK_OCTAVE
 Signature
BLOCK_INTEGRATE(SourceBlock As IBlock2, IntegrateTimes As Long = 1,
IntegrationMethod As CONST_EnumIntegrationMethod =
IntegrationMethodTrapezium) As IBlock2
 Description
This command integrates both time signals as spectra. The Integration Method
is only used for time blocks.
BLOCK_PHASEREFERENCE_SPECTRUM
 Signature
BLOCK_ PHASEREFERENCE_SPECTRUM (SourceBlock As IBlock2,
ReferenceBlock As IBlock2, AmplitudeScaling As
CONST_EnumAmplitudeScaling = 0) As IBlock2
 Description
This command does the calculation of the spectrum with given
AmplitudeScaling from the time SourceBlock. If the SourceBlock already is a
spectrum, the result is scaled to the given AmplitudeScaling. The
PhaseReferenceBlock is used to calculate the phase of the result.
BLOCK_POL_INTERPOLATE
 Signature
BLOCK_POL_INTERPOLATE (SourceBlock As IBlock2, ReferenceBlock as
IBlock2, NrOfXaxes As Int =0, InterpolationMethod as
CONST_EnumInterpolationMethod InterpolationMethod =
InterpolationMethodLinXLinY) As IBlock2
 Description
This calculation interpolates the SourceBlock to the same axis as the
ReferenceBlock. If your ReferenceBlock contains a multivariable x-axis, you
can indicate which axis to use by NrOfXAxis. Also the interpolation method
can be specified.
BLOCK_PULSE
 Signature
BLOCK_PULSE(Duration As IScalar, OffAs IScalar, Samplerate As Double,
PulseLength As IScalar, PulsePeakLevel As IScalar, PulseRaiseTime As
Double, PulseFallTime As Double, PulseRepetitionRate As Long, PulseType
As CONST_EnumPulseType = PulseTypeHalf_Sine) As IBlock2
 Description
This command creates a transient pulse signal in time for a given sample rate.
The duration and the offare scalars in quantity time. The PulseRepetitionRate
indicates the number of pulses during the complete duration! The Peaklevel is a
scalar, indicating the maximum level of the pulse.
BLOCK_RANDOM

Rev 13A 125


Chapter 5 Reference guide

 Signature
BLOCK_RANDOM (Duration As IScalar, OffAs IScalar, SampleRate As
Double) As IBlock2
 Description
This command creates a random time signal with a specific Samplerate.
Duration and Offare Scalars with quantity time.
BLOCK_RMS
 Signature
BLOCK_RMS(SourceBlock As IBlock2, LowerX As IScalar, UpperX As
IScalar) As IScalar
 Description
Returns the RMS value of a block between 2 x-axis points. Those 2 points
(LowerX and UpperX) are scalars, with the same quantity as the x-axis of the
SourceBlock. The result is an IScalar.
BLOCK_SAWTOOTH
 Signature
BLOCK_SAWTOOTH(Duration As IScalar, OffAs IScalar, Samplerate As
Double, Amplitude As IScalar, Frequency As IScalar, Width As IScalar,
DcLevel As IScalar) As IBlock2
 Description
This command creates a saw tooth in time for a given Samplerate. Duration,
Offand Width are scalars in quantity time. The amplitude and the DcLevel are
scalars, indicating the minimum level and the amplitude. Frequency is a scalar
with quantity frequency.
BLOCK_SHARPNESS
 Signature
BLOCK_SHARPNESS (Block As IBlock2, in SoundField asEnumSoundField
SoundField = SoundFieldDiffuse) As IScalar
 Description
This calculation will get the sharpness out of a 3rd octave Block. If the Y- axis is
complex, only its real values will be taken into account. The parameter
SoundField indicates how the data was achieved: in the "free field" or in the
"diffuse field".

Note: the input block already must be a 3rd Octave Spectrum!

BLOCK_SINE
 Signature
BLOCK_SINE (Duration As IScalar, OffAs IScalar, Samplerate As Double,
Amplitude As IScalar, Frequency As IScalar, PhaseShift As IScalar) As
IBlock2

126 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Description
This command creates a sine wave time signal with a specific Samplerate.
Duration and Offare scalars with quantity time. Frequency is a scalar with
quantity frequency. PhaseShift is a scalar in quantity Angle. The amplitude is a
scalar, indicating the maximum amplitude.
BLOCK_SMOOTHING
 Signature
BLOCK_SMOOTHING ( Source As IBlock2, AveragingParameter As Double)
As IBlock2
 Description
The Block will be transformed to a smoother one by using exponential
averaging. The Averaging parameter is a weighting function between 0 and 1. 0
implies no smoothing.
BLOCK_SPECTRUM
 Signature
BLOCK_SPECTRUM (SourceBlock As IBlock2, AmplitudeScaling As
CONST_EnumAmplitudeScaling =0) As IBlock2
 Description
This command does the calculation of the spectrum with given
AmplitudeScaling from the time SourceBlock. If the SourceBlock already is a
spectrum, the result is scaled to the given AmplitudeScaling.
BLOCK_SUBTRACT
 Signature
BLOCK_SUBTRACT (Source as IBlock2, Operand as IBlock2) AsIBlock2
 Description
This command allows you to subtract the Operand block from the Source block.
The X-axes of both blocks must be equal, the Y-quantities also.
BLOCK_SUBTRACT_SCALAR
 Signature
BLOCK_SUBTRACT_SCALAR ( Source As IBlock2, Operand As IScalar) As
IBlock2
 Description
This command allows you to subtract a 'scalar' to the Source block. The value of
the scalar will be subtracted from all Y-values. The quantity of the scalar must
be equal to the quantity of the X-axes of the block.
BLOCK_WINDOW
 Signature
BLOCK_WINDOW (ReferenceBlock As IBlock2, Window As
CONST_EnumWindowType) As IBlock2

Rev 13A 127


Chapter 5 Reference guide

 Description
The result of this command is a window in time that can be applied on the
ReferenceBlock (being a time block).
BLOCK_WEIGHTING
 Signature
BLOCK_WEIGHTING (SourceBlock As IBlock2, WeightType As
CONST_EnumWeighting) As IBlock2
 Description
This command applies weighting to a block, both in time as in frequency
domain. Weighting A, B, C, NONE are possible WeightTypes for time signals
Weighting A, B, C, D, AB, BC, NONE are possible weightings for spectrums.
COMPLEX_TO_SCALAR
 Signature
COMPLEX_TO_SCALAR(Real As Double, Imag As Double, Quantity As
IQuantity, UnitSelection As CONST_EnumUnitSelection = UserUnits) As
IScalar
 Description
This commands creates a scalar from a complex value and its quantity. The
value can be entered in MKS or in the User Units of the quantity. Internally, the
MKS value is stored.
DOUBLE_TO_SCALAR
 Signature
DOUBLE_TO_SCALAR(Value As Double, Quantity As IQuantity,
UnitSelection As CONST_EnumUnitSelection = UserUnits) As IScalar
 Description
This commands creates a scalar from a single value and its quantity. The value
can be entered in MKS or in the User Units of the quantity. Internally, the MKS
value is stored.
RECIPROCAL_SWITCH
 Signature
RECIPROCAL_SWITCH(OriginalBlock As IBlock2, ModifySignOfPhase As
Integer) As IBlock2
 Description

Section 5.13 AdvancedCmd

The usage of this interface is shown in example 6.

128 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.13.1 Properties

 Signature
AdvancedCmd As ICmd
 Type
Read-only
 Description
This property gives you access to some advanced commands, via the interface
IAdvancedCmd. The list of functions available here is a dynamic list: it will be
extended regularly. If you have Block commands implemented in 5A or earlier,
they can be retrieved here: this replaces the earlier ICmd.

Section 5.14 ICrossCursor

Same as in documentation.

Section 5.15 ICursor

Same as in documentation.

Section 5.16 ICursorManager

Same as in documentation.

Section 5.17 IData

Same as in documentation.

Rev 13A 129


Chapter 5 Reference guide

Section 5.18 IDatabase

Section 5.18.1 Contents

 Definition
 Methods
 AddAttachment
 AddFolder
 AddItem
 AddMemo
 AddProperties
 AddRun
 AddSection
 Delete
 GetAttachment
 GetBridgeElement
 GetItem
 GetMemo
 GetProperties
 Rename
 Save
 Properties
 ProjectName
 ElementNames
 ElementType
 SectionNames

Section 5.18.2 Definition

IDatabase interfaces

130 LMS Test.Lab Automation manual


Chapter 5 Reference guide

The automation object called IDatabase encapsulates all the functionality


regarding the project database.

This interface allows you to interact with 'offline' databases stored on disk and
those, which are 'online' that is open in a workbook. There are two ways of
getting a hold of such an object:
 Explicitly refer to a database on the file system.
Dim TL_DB As LMSTestLabAutomation.IDatabase
TL_DB =
TestLab.Database(e:\local\data\Archive\PRJ990604.lms"")
 Refer to an active project associated with an open book.
Dim TL_DB As LMSTestLabAutomation.IDatabase
TL_DB = TestLab.ActiveBook.Database
A Test.Lab Project Database is a hierarchical structure, which contains two
kinds of hierarchical elements, being 'folders' and 'items'. An item is a
hierarchical endpoint, which contains binary system or user information, while a
folder is a hierarchical structure, which in turn can contain hierarchical
elements. This can be compared with the representation of any normal file
system, thus consisting of directories or folders and files or items.

Rev 13A 131


Chapter 5 Reference guide

Project structure

Let us take the tree view on the 'Navigator' sheet in a Test.Lab application to
inspect the Project Database. The red text box points out to the root of the
hierarchical structure of the project database associated with this book. The
black text boxes refer to some of the different folders. Next to general folders
such as the "frequencies" there are two predefined type of folders. First of all
there is the folder that holds the section information (e.g. "Section2" in the
example above) and secondly there is the 'Run' folder, which can hold some
snapshot information associated with one single run.

The blue text box represents an item, containing any type of data.

132 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Attachments

The Test.Lab project database can also embed user informational items like an
attachment or a memo. The above figure shows the visual representation of an
attachment and a memo.

Section 5.18.3 Methods

AddAttachment
 Signature
AddAttachement(PathToTop As String, AttachmentName As String,
AttachmentFilePath As String)
 Description
Embeds the contents of any file as an attachment item on the hierarchical path
in the database. An error is returned if there is already such an item on the
specified path.
AddFolder
 Signature
AddFolder(PathToTop As String, Name As String
,PropertyContainer As AttributeMap)
 Description
Adds a folder entry to the database project on the given PathToTop. An error is
returned if there is already a folder on the specified path.
AddItem

Rev 13A 133


Chapter 5 Reference guide

 Signature
AddItem(PathToTop As String, Name As String, Value As IData
,PropertyContainer As AttributeMap ,Override As Boolean =
false)
 Description
Adds a data entity to the database project on the given PathToTop. The default
is not to override existing items. In this case an error is returned that there was
an attempt to do so. An error is returned if the PathToTop is invalid.
AddMemo
 Signature
AddMemo(PathToTop As String, MemoName As Object = Nothing,
MemoPathName As Object = Nothing)
 Description
Adds a memo to the database project on the given PathToTop.
AddProperties
 Signature
AddProperties(PathToTop As String, PropertyContainer As
AttributeMap , OverrideIfExists As Boolean = true)
 Description
Adds properties to the existing property associated with the database element.
Existing properties will be overridden depending on the setting of the
OverrideIfExists flag. The default value is true. An error is returned if there is
no item on the path specified.
AddRun
 Signature
AddRun(PathToTop As String, NewName As String, ac_xPropertyContainer
As Object = Nothing)
 Description
Adds properties to the database project on the given PathToTop.
AddSection
 Signature
AddSection (NewName As String)
 Description
Adds a section to the database in a Test.Lab application independent way, there
will be no settings copied to the newly created section. For creating new
sections and having them taking over settings of a previous section, you can use
'NewSection' on IBook for any specific workbook, since it is part of the
knowledge of each application.
Delete

134 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Signature
Delete(PathToTop As String)
 Description
Deletes any type of element (folder or data entity) in the database hierarchy
specified by path. An error is returned if there is no item on the path specified.
GetAttachment
 Signature
GetAttachment(PathToTop As String) As String
 Description
Retrieves the attachment stored in a Test.Lab database on the hierarchical path
specified by PathToTop. This method returns the pathname to a temporary file,
where the attachment content has been expanded. An error is returned if the
PathToTop is invalid or if the pointed element does not contain an attachment.
GetBridgeElement
 Signature
GetBridgeElement(PathToTop As String) As IData
 Description
Function to get a bridge element by specifying its top path.
GetItem
 Signature
GetItem(PathToTop As String) As IData
 Description
Retrieves the value entity stored in a Test.Lab database on the hierarchical path
specified by PathToTop. An error will be returned if the PathToTop is invalid or
if the pointed element is not an hierarchical endpoint.
GetMemo
 Signature
GetMemo(PathToTop As String) As String
 Description
Retrieves the memo stored in a Test.Lab database on the hierarchical path
specified by PathToTop. This method returns the pathname to a temporary file,
where the memo content has been expanded. An error is returned if the
PathToTop is invalid or if the pointed element does not contain an memo.
GetProperties
 Signature
GetProperties(PathToTop As String) As AttributeMap
 Description
Returns the complete property associated with a database element. An error is
returned if there is no item on the path specified.

Rev 13A 135


Chapter 5 Reference guide

Rename
 Signature
Rename(PathToTop As String, NewName As String)
 Description
Renames an element on the hierarchical path to the root of the database and
changes the name to NewName. An error is returned if there is no item on the
path specified.
Save
 Signature
Save()
 Description
Saves the Database object and its changes to disc.
AddToInputBasket
 Signature
AddToInputBasket(ByVal PathToTop As String)
 Description
Adds an element available in database to input basket. PathToTop is path to
element available in database.

Section 5.18.4 Properties

ProjectName
 Signature
ProjectName As String
 Type
Read-only
 Description
Returns the full path name, including the name of the project itself.
ElementNames
 Signature
ElementNames(PathToTop As String) As AttributeMap
 Type
Read-only
 Description
Returns the list of element names contained in a folder, pointed to by the
PathToTop, in the database hierarchical structure. An error will be returned if
the PathToTop is invalid or if the pointed element is not an hierarchical folder.

136 LMS Test.Lab Automation manual


Chapter 5 Reference guide

ElementType
 Signature
ElementType(PathToTop As String) As String
 Type
Read-only
 Description
Returns the type of an database element on the hierarchical level as string. An
error will be returned if there is no item on the path specified. .
Examples of possible database element types are:
 "section"
 "block"
 "waterfall"
 "run"
 SectionNames
 Signature
SectionNames As AttributeMap
 Type
Read-only
 Description
Returns the list of element names contained in a folder, pointed to by the
PathToTop, in the database hierarchical structure. An error will be returned if
the PathToTop is invalid or if the pointed element is not an hierarchical folder.

Rev 13A 137


Chapter 5 Reference guide

Section 5.19 IDataBrowser

Section 5.19.1 Contents

 Definition
 Methods
 Elements
 GetItem
 GetProperties
 Properties
 ElementType
 ElementLabel

Section 5.19.2 Definition

The IDatabrowser interface gives the opportunity to browse into not-standard


Test.Lab files (like CADA-X Project databases). It only has read-access.

IDataBrowser interfaces

138 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.19.3 Methods

Elements
 Signature
Elements(PathToTop As String, Labels() As String, IDs() As
String)
 Description
This function returns the list of element labels and IDs contained in folder,
pointed by PathToTop.
GetItem
 Signature
GetItem(PathToTop As String, PathAsLabels As Long = 1) As IData
 Description
This function retrieves the value entity stored in a datafile on the hierarchical
path specified by PathToTop.
GetProperties
 Signature
GetProperties(PathToTop As String) As AttributeMap
 Description
This function returns the complete property associated with a data element on
path 'PathToTop'.
AddToInputBasket
 Signature
AddToInputBasket(ByVal PathToTop As String)
 Description
Adds an element available in browser to input basket. PathToTop is path to
element currently being browse in browser.

Section 5.19.4 Properties

ElementType
 Signature
ElementType(PathToTop As String) As String
 Type
Read-only
 Description
Returns the type of an database element on the hierarchical level as a string.

Rev 13A 139


Chapter 5 Reference guide

ElementLabel
 Signature
ElementLabel(PathToTop As String) As String
 Type
Read-only
 Description
Returns the label of an database element on the hierarchical level as a string.

Section 5.20 IDisplay

Same as in documentation.

Section 5.21 IDoubleCrossCursor

Same as in documentation.

Section 5.22 IDoubleCursor

Same as in documentation.

Section 5.23 IDoubleRatioCursor

Same as in documentation.

Section 5.24 IExplorer

The usage of this interface is shown in examples: 2 and 3.

140 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.24.1 Contents

 Definition
 Properties
 Browser
 NetworkBrowser
 Search
 InputBasket
 TecManagerBrowser
 Workspace

Section 5.24.2 Definition

How to get an IExplorer object? An Explorer object can be obtained via a


datawatch ("Navigator_Explorer) on application or a module, that contains a
navigator.

Dim datawatch_expl As LMSTestLabAutomation.DataWatch

Dim my_eplorer As LMSTestLabAutomation.IExplorer

datawatch_expl =
TL.ActiveBook.FindDataWatch("Navigator_Explorer")

my_eplorer = datawatch_expl.Data

Rev 13A 141


Chapter 5 Reference guide

IExplorer interfaces

Section 5.24.3 Properties

Browser
 Signature
Browser(DataFilePath As String) As IDataBrowser
 Type
Read-only
 Description
This function returns a DataBrowser object. This way, you can have access to
all data on "My Computer".
NetworkBrowser
 Signature
NetworkBrowser As IDataBrowser
 Type
Read-only
 Description
This function returns a Network DataBrowser object. This way, you can have

142 LMS Test.Lab Automation manual


Chapter 5 Reference guide

access to all data that is on your ‘Network’. The "Network hub" add-in should
be loaded and configured (more information about the Network hub: see Help
for desktop).
Search
 Signature
Search As SearchEngine
 Type
Read-only
 Description
This function returns a search engine object that allows launching searches.
InputBasket
 Signature
InputBasket() As nputBasket
 Type
Read-only
 Description
This function returns an input basket object that allows inputbasket interaction.
TecManagerBrowser
 Signature
TecManagerBrowser() As IDataBrowser
 Type
Read-only
 Description
This function returns a DataBrowser object.
Workspace
 Signature
Workspace As Workspace
 Type
Read-only
 Description
This function returns a Workspace object.

Rev 13A 143


Chapter 5 Reference guide

Section 5.25 IGeometry

Section 5.25.1 Contents

 Definition
 Methods
 AddComponent
 AddComponentLine
 AddComponentNode
 AddComponentNodes
 AddComponentQuad
 AddComponentTria
 AddLine
 AddNodeAddNodes
 AddQuadAddTria
 ComponentLines
 ComponentNodesValues
 ComponentNodeValues
 ComponentQuads
 ComponentsValues
 ComponentTrias
 ComponentValues
 DeleteComponent
 DeleteComponentNode
 DeleteComponentNodes
 DeleteNode
 DeleteNodes
 EditComponent
 EditComponentNodesValues
 EditComponentNodeValues
 EditNodesValues
 EditNodeValues
 Lines
 NewGeometry
 NodesValues
 NodeValues
 Quads
 Trias

144 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Properties
 ComponentNames
 ComponentNodeNames
 NodeNames

Section 5.25.2 Definition

IGeometry interfaces

Section 5.25.3 Methods

AddComponent
 Signature
AddComponent(ComponentName As String, X As Double, Y As Double,
Z As Double, XY As Double, XZ As Double, YZ As Double, AxisType
As CONST_EnumGeomAxisType = Cartesian) As IGeometry
 Description
With this method, you add a component to a geometry, the result is a new
geometry object.

Rev 13A 145


Chapter 5 Reference guide

AddComponentLine
 Signature
AddComponentLine(ComponentName As String, NodeName1 As
String, NodeName2 As String) As IGeometry
 Description
Add a line to a component. The result is a new geometry object.
AddComponentNode
 Signature
AddComponentNode(ComponentName As String, NodeNames As
String, X As Double, Y As Double, Z As Double, XY As Double,
XZ As Double, YZ As Double, LocalCoordinates As Long = 1) As
IGeometry
 Description
Add a node to a component. The result is a new geometry object.
AddComponentNodes
 Signature
AddComponentNodes(ComponentName As String, NodeNames() As
String, X() As Double, Y() As Double, Z() As Double, XY() As
Double, XZ() As Double, YZ() As Double, LocalCoordinates As
Long = 1) As IGeometry
 Description
Add a list of nodes to a component. The result is a new geometry object.
AddComponentQuad
 Signature
AddComponentQuad(ComponentName As String, NodeName1 As
String, NodeName2 As String, NodeName3 As String, NodeName4 As
String) As IGeometry
 Description
Add a quad component to the geometry.
AddComponentTria
 Signature
AddComponentTria(ComponentName As String, NodeName1 As
String, NodeName2 As String NodeName3 As String) As IGeometry
 Description
Add a tria component to the geometry.
AddLine
 Signature
AddLine(NodeName1 As String, NodeName2 As String) As IGeometry
 Description
Add a line to the geometry.

146 LMS Test.Lab Automation manual


Chapter 5 Reference guide

AddNode
 Signature
Function AddNode(NodeName As String, X As Double, Y As Double,
Z As Double, XY As Double, XZ As Double, YZ As Double) As
IGeometry
 Description
Add a node directly to this geometry. There is no connection with a component
for this node. The result is a new geometry object.
AddNodes
 Signature
AddNodes(NodeNames() As String, X() As Double, Y() As Double,
Z() As Double, XY() As Double, XZ() As Double, YZ() As Double)
As IGeometry
 Description
Add a list of nodes to this geometry. There is no connection with a component
for these nodes. The result is a new geometry object.
AddQuad
 Signature
AddQuad(NodeName1 As String, NodeName2 As String, NodeName3 As
String, NodeName4 As String) As IGeometry
 Description
Add a quad to this geometry. There is no connection with a component for this
quad. The result is a new geometry object.
AddTria
 Signature
AddTria(NodeName1 As String, NodeName2 As String, NodeName3 As
String) As IGeometry
 Description
Add a tria to this geometry. There is no connection with a component for this
tria. The result is a new geometry object.
ComponentLines
 Signature
ComponentLines(ComponentName As String, NodeNamesA As
System.Array, NodeNamesB As System.Array)
 Description
Function to get the lines from a component.
ComponentNodeValues
 Signature
ComponentNodeValues(ComponentName As String, NodeName As
String, X As Double, Y As Double, Z As Double, XY As Double,
XZ As Double, YZ As Double, LocalCoordinates As Long = 1)

Rev 13A 147


Chapter 5 Reference guide

 Description
This function retrieves the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a
specific node in a specific component. There is no return value.
ComponentNodesValues
 Signature
ComponentNodesValues(ComponentName As String, NodeNames() As
String, X() As Double, Y() As Double, Z() As Double, XY() As
Double, XZ() As Double, YZ() As Double, LocalCoordinates As
Long = 1)
 Description
This function retrieves the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a
list of nodes in a specific component. There is no return value.
ComponentQuads
 Signature
ComponentQuads(ComponentName As String, NodeNamesA As
System.Array, NodeNamesB As System.Array, NodeNamesC As
System.Array, NodeNamesD As System.Array)
 Description
This function retrieves the quads from a component.
ComponentsValues
 Signature
ComponentsValues(ComponentName As System.Array, X As
System.Array, Y As System.Array, Z As System.Array, XY As
System.Array, XZ As System.Array, YZ As System.Array)
 Description
This function retrieves the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a
specific component. There is no return value.
ComponentTrias
 Signature
ComponentTrias(ComponentName As String, NodeNamesA As
System.Array, NodeNamesB As System.Array, NodeNamesC As
System.Array)
 Description
This function returns the trias from a component.
ComponentValues
 Signature
ComponentValues(ComponentName As String, X As Double, Y As
Double, Z As Double, XY As Double, XZ As Double, YZ As Double)
 Description
This function retrieves the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a
specific component. There is no return value.

148 LMS Test.Lab Automation manual


Chapter 5 Reference guide

DeleteComponent
 Signature
DeleteComponent(ComponentName As String) As IGeometry
 Description
This function deletes a specific component. The result is a new geometry object.
DeleteComponentNode
 Signature
DeleteComponentNode(ComponentName As String, NodeName As
String) As IGeometry
 Description
This function deletes a node in a specific component. The result is a new
geometry object.
DeleteComponentNodes
 Signature
DeleteComponentNodes(ComponentName As String, NodeNames() As
String) As IGeometry
 Description
This function deletes a list of nodes in a specific component. The result is a new
geometry object.
DeleteNode
 Signature
DeleteNode(NodeName As String) As IGeometry
 Description
This function deletes a node that is not associated to any component. The result
is a new geometry object.
DeleteNodes
 Signature
DeleteNodes(NodeNames() As String) As IGeometry
 Description
This function deletes a list of nodes that are not associated to any component.
The result is a new geometry object.
EditComponent
 Signature
EditComponent(ComponentName As String, X As Double, Y As
Double, Z As Double, XY As Double, XZ As Double, YZ As Double,
AxisType As CONST_EnumGeomAxisType = Cartesian) As IGeometry
 Description
With this function, the axes coordinates and the axis type of a specific
component can be changed. The result is a new geometry object.

Rev 13A 149


Chapter 5 Reference guide

EditComponentNodeValues
 Signature
EditComponentNodeValues(ComponentName As String, NodeName As
String, X As Double, Y As Double, Z As Double, XY As Double,
XZ As Double, YZ As Double, LocalCoordinates As Long = 1) As
IGeometry
 Description
Modifies the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a node in a
specific component. The result is a new geometry object.
EditComponentNodesValues
 Signature
EditComponentNodesValues(ComponentName As String, NodeName As
String, X As Double, Y As Double, Z As Double, XY As Double,
XZ As Double, YZ As Double, LocalCoordinates As Long = 1) As
IGeometry
 Description
Modifies the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a list of nodes
in a specific component. The result is a new geometry object.
EditNodeValues
 Signature
EditNodeValues(NodeNames As String, X As Double, Y As Double,
Z As Double, XY As Double, XZ As Double, YZ As Double) As
IGeometry
 Description
Modifies the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a node that is
not associated to any component. The result is a new geometry object.
EditNodesValues
 Signature
EditNodesValues(NodeNames() As String, X() As Double, Y() As
Double, Z() As Double, XY() As Double, XZ() As Double, YZ() As
Double) As IGeometry
 Description
Modifies the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a list of nodes
that are not associated to any component. The result is a new geometry object.
Lines
 Signature
Lines(NodeNamesA As System.Array, NodeNamesB As System.Array)
 Description
Function that retrieves the lines.
NewGeometry

150 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Signature
NewGeometry() As IGeometry
 Description
This function returns a new Geometry.
NodeValues
 Signature
NodeValues(NodeName As String, X As Double, Y As Double, Z As
Double, XY As Double, XZ As Double, YZ As Double)
 Description
This function retrieves the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a
node that is not associated to any component. There is no return value.
NodesValues
 Signature
NodesValues(NodeName() As String, X() As Double, Y() As Double,
Z() As Double, XY() As Double, XZ() As Double, YZ() As Double)
 Description
This function retrieves the X,Y,Z coordinates and XY,XZ,YZ Euler angles for a
list of nodes that are not associated to any component. There is no return value.
Quads
 Signature
Quads(NodeNamesA As System.Array, NodeNamesB As System.Array,
NodeNamesC As System.Array, NodeNamesD As System.Array)
 Description
Function to retrieve the quads.
Trias
 Signature
Trias(NodeNamesA As System.Array, NodeNamesB As System.Array,
NodeNamesC As System.Array)
 Description
Function to retrieve the trias.

Section 5.25.4 Properties

ComponentNames
 Signature
ComponentNames As System.Array
 Type
Read-only

Rev 13A 151


Chapter 5 Reference guide

 Description
This property returns a list of all component names in the geometry.
ComponentNodeNames
 Signature
ComponentNames(ComponentName As String) As System.Array
 Type
Read-only
 Description
This property returns a list of all node names belonging to a specific component.
NodeNames
 Signature
NodeNames As System.Array
 Type
Read-only
 Description
This property returns a list of all node names not associated to a component.

Section 5.26 IHarmonicCrossCursor

Same as in documentation.

Section 5.27 IHarmonicCursor

Same as in documentation.

Section 5.28 IHarmonicRatioCursor

Same as in documentation.

Section 5.29 IHeader

Same as in documentation.

152 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.30 IModule

Section 5.30.1 Contents

 Definition
 Methods
 CreateAttributeMap
 CreateDataWatch
 CreateObject
 Database
 FindDataWatch
 ReplicateWatch
 Properties
 ActiveProjectName
 cmd
 Factory
 UnitSystem

Section 5.30.2 Definition

As explained in the definition of the Application object, the user can launch the
main executable that allows them to load an application description. These
descriptions are stored in workbooks and specify the list of modules necessary
to make up the whole application. The modularity of these components is such
that modules are not bound to one single context but they can be reused in
several combinations.

The ActiveX Module loader is an ActiveX control that allows loading and
running a single Test.Lab module. This virtually allows any Test.Lab module to
be loaded and run inside an application that can host ActiveX controls. The only
difference between an ActiveX control and a regular executable is that it needs
a host application to run in. So it runs in process with its host and displays its
GUI into the GUI of the host. Internet Explorer, Visual Basic 6.0, C++, .NET
development environments are only a couple of examples in which you can use
ActiveX controls.

Test.Lab currently only supports four modules.

Rev 13A 153


Chapter 5 Reference guide

 Default
 PictureManager
 Picture
 Explorer
There are a couple of properties you can specify to configure the behavior upon
loading a module. There are four properties, specific for the Test.Lab Control:.
These are:
 ModuleName
 OpenProject
 ProjectName
 SectionName
The module name indicates the type of the module. Supported types are:
 Default
 PictureManager
 Picture
 Explorer

Section 5.30.3 Methods

CreateAttributeMap
 Signature
CreateAttributeMap() as Attributemap
 Description
This method creates an Attributemap object in Test.Lab and returns a reference
to it. Such an 'Attributemap' is a general implementation of a list or a map and is
used for passing lists of arguments to and from several Test.Lab automation
commands.
CreateDataWatch
 Signature
CreateDataWatch (<General Port ID>as String, <DataType> as
String,<IsPersistent> as Long , MaxUpdateFrequency as Long =
1000 , Is Visible As Long = 1 ,IsAutoBuffered As Long = 1 )
General Port ID: ID of the port.
DataType: (TestLab) Type of data the port can hold.
IsPersistent: Boolean value to specify if the value on the port has be saved upon
saving the project.
MaxUpdateFrequency: the interval, specified in milliseconds, with which the
system will check the contents of the port and notify the client application if the
value on the port has changed since the previous check. Default is 1000.

154 LMS Test.Lab Automation manual


Chapter 5 Reference guide

IsAutoBuffered: a Boolean value to indicate that the value returned from the
datawatch needs to be returned as a buffered, normalized type.
IsVisible: a Boolean value to indicate whether the port should be visible in the
'online-data' of the Test.Lab GUI.
 Description
Modules communicate by means of ports. All Test.Lab applications implicitly
define a of ports to allow their modules to communicate. Next to these
predefined ports, a user can create his own ports. Such externally created ports
can be used to store data to the active section, or to drag and drop into a
Test.Lab display.
When the user creates a port at runtime, it can be found in the 'Online-Data'
section in the navigator sheet. Once a port is created is treated no different from
any other predefined one and can be dragged and dropped in a display for
instance. Once it is dropped the display will get notified whenever the data on
de port changes. Independent whether the data comes from another Test.Lab
module or an external application.
CreateObject
 Signature
CreateObject(DesiredType As String, Attributes As
AttributeMap) As IData
 Description
This method allows a client application to create native Test.Lab objects such as
commands, weighting types, data blocks, calculations, etc. To do so it needs a
string to indicate the type of data to create, and an attribute list, a kind of
parameter list, as input for creation.
Database
 Signature
Database(ProjectPathName as String) as IDataBase
 Description
This method allows a client application to get hold of the automation object
called IDatabase for databases solely stored on disk. The database is not opened
in a workbook.
This IDatabase interface holds all the functionality for interacting with the
project database.
FindDataWatch
 Signature
FindDataWatch(DataPathName as String, MaxUpdateFrequency As
Long = 1000 , IsAutoBuffered As Long = 1, ModuleScope As Long
= 1) As DataWatch
DataPathName: ID of the port. This can be a path, so the conventions
concerning path parsing must be taken into account.
MaxUpdateFrequency: the interval, specified in milliseconds, with which the
system will check the contents of the port and notify the client application if the

Rev 13A 155


Chapter 5 Reference guide

value on the port has changed since the previous check. Default is 1000
IsAutoBuffered: a Boolean value to indicate that the value returned from the
datawatch needs to be returned as a buffered,
ModuleScoop: this parameter indicates where internally the datawatch has to be
found. If the moduleScoop is ON, it is searched for on the module itself. If it is
OFF, it is searched for generally. Practically, use it like this: when there exists a
similar datawatch on the Application, it to 0, else if there exists a similar
datawatch on a ActiveBook, it to 1 (Default).
 Description
The communication between different modules in a Test.Lab Application uses
datawatches. When an automation users wants to use this, he first has to find the
specific port.
The method will return a DataWatch object that encapsulates a connection to
one port and some additional information on the frequency with which to access
it and the data returned.
ReplicateWatch
 Signature
ReplicateWatch(Source As Watch, Optional MaxUpdateFrequency
As Integer = 1000, IsAutoBuffered As Integer = 1, InitialFiring
As Integer = 1) As Watch
 Description
Replicate a watch.

Section 5.30.4 Properties

ActiveProjectName
 Signature
Signature As String
 Type
Read-only
 Description
Returns the name of the currently active project.
cmd
 Signature
cmd As ICmd
 Type
Read-only
 Description
This method returns a handle to the command interpreter used in the Icmd

156 LMS Test.Lab Automation manual


Chapter 5 Reference guide

interface.
Factory
 Signature
Factory As Factory
 Type
Read-only
 Description
This function return a handle to the factory interface.
UnitSystem
 Signature
UnitSystem() As IUnitSystem
 Type
Read-only
 Description
The UnitSystem property, returns a reference to an object in Test.Lab that is
responsible for handling unit system operations. Further interaction with this
unit- system-managing object can be done by means of the members defined on
the IUnitSystem interface.

Section 5.31 InProcApplication

The InProcApplication has completely the same functionality as the Application


interface. It can only be used if the client application runs inside Test.Lab, to
avoid some overhead.

The Windows Automation mechanism has to maintain some cross process


information for each reference that is distributed to a client application.
However light-weighted this may be, it can have some effects on both
performance and data integrity.

In scenarios, in which the client application is run inside Test.Lab, this cross
process 'wrapping' of data is some unnecessary overhead. Connecting and using
Test.Lab automation functionality in an ActiveX control, running in one of the
Test.Lab user sheets, is one of those possible scenarios.

Next picture indicates the members of InProcApplication. Mark that these are
identical to the ones in the Application object. In most cases switching to the
better performing in-process object is usually merely a matter of specifying a
different class name.

Rev 13A 157


Chapter 5 Reference guide

Section 5.32 InputBasket

The usage of this interface is shown in example 2.

Section 5.32.1 Contents

 Properties
 Count
 Item
InputBasket interfaces

Section 5.32.2 Methods

Clear
 Signature
Clear()
 Description
Removes all elements available in input basket.

158 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.32.3 Properties

Count
 Signature
Count As Integer
 Type
Read-only
 Description
This function return the number of items that are currently in the Input Basket.
Item
 Signature
Item(Index As Integer, DataEndPointAsLink As Boolean = False) As Object
 Type
Read-only
 Description
This function returns the item from the Input Basket at a specific index.

Section 5.33 IPicture

Same as in documentation.

Section 5.34 IPictureManager

Same as in documentation.

Section 5.35 IPrintManager

Same as in documentation.

Section 5.36 IQuantity

Same as in documentation.

Rev 13A 159


Chapter 5 Reference guide

Section 5.37 IRatioCursor

Same as in documentation.

Section 5.38 IScalar

Same as in documentation.

Section 5.39 ISheet

Same as in documentation.

Section 5.40 ISheets

Same as in documentation.

Section 5.41 ISingleCursor

Same as in documentation.

Section 5.42 IUnitSystem

The usage of this interface is shown in example 5.

160 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.42.1 Contents

 Definition
 Methods
 AddQuantityCase
 Convert
 CreateQuantity
 Label
 MKSToUserValue
 MKSToUserValues
 Power
 Product
 SetDefaultCase
 UserToMKSValue
 UserToMKSValues
 Properties
 Quantity…

Section 5.42.2 Definition

IUnitsystem provides an interface to the unitsystem of Test.Lab.

Rev 13A 161


Chapter 5 Reference guide

IUnitSystem interfaces

Section 5.42.3 Methods

AddQuantityCase
 Signature
AddQuantityCase(QuantityName As String, CaseName As String, UnitLabel
As String, LogReference As Double = 10.0, IsPower As Integer = 0, Factor As
Double = 1.0, OffAs Double = 0.0, MakeThisDefaultCase As Integer = 0) As
IQuantity
 Description
Function to add a case to a quantity.
Convert
 Signature
Convert(Quantity As IQuantity) As IQuantity
 Description
Function to convert a quantity.
CreateQuantity

162 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Signature
CreateQuantity(QuantityName As String, CaseName As Object = Nothing) As
IQuantity
 Description
Create a IQuantity.
Label
 Signature
Label(Quantity As IQuantity) As String
 Description
Function to return the label of a quantity.
MKSToUserValue
 Signature
MKSToUserValue(Quantity, MKSValue)
 Description
Returns a converted User Value for a given MKS Value in the represented
quantity in the current unit set.
MKSToUserValues
 Signature
MKSToUserValues(Quantity, MKSValues)
 Description
Returns the converted User Values for the given array of MKS Values in the
represented quantity in the current unit set.
Power
 Signature
Power(Quantity, Power)
 Description
Returns a quantity corresponding to Quantity ** Power, whereas Power is an
integer value.
Product
 Signature
Product(Quantity1 , Quantity2)
 Description
Returns a quantity that represents the product of Quantity1 and Quantity2.
SetDefaultCase
 Signature
SetDefaultCase(Quantity As LMSTestLabAutomation.IQuantity)

Rev 13A 163


Chapter 5 Reference guide

 Description
Sets the default quantity.
UserToMKSValue
 Signature
UserToMKSValue (Quantity, UserValue)
 Description
Returns a converted MKS Value for a given User Value in the represented
quantity in the current unit set.
UserToMKSValues
 Signature
UserToMKSValues (Quantity, UserValues)
 Description
Returns a converted MKS Value for a given User Value in the represented
quantity in the current unit set.

Section 5.42.4 Properties

Quantity…
 Description
Returns the quantity for 'Acceleration', 'Angle', 'Articulation Index', etc.

Section 5.43 LMS Unit System

You can get all visible units of all quantities with the following Python code:

import win32com.client

tl = win32com.client.Dispatch("LMSTestLabAutomation.Application")

us = tl.UnitSystem

nq = us.QuantityCount

for q in range(nq):
 qts = us.QuantityByIndex(q)
 print qts
 nu = us.UnitCount(qts)
 for u in range(nu):

164 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 ul = us.UnitLabelByIndex(qts, u)
 print ul

Section 5.44 IWatch

Whereas a DataWatch is a handle to a communication port between modules, a


Watch object is a handle to an internal port. You can explicitly query and
retrieve a DataWatch with a specific name, but not a Watch. A watch object can
only be provided by some dedicated function, allowing you to intervene with
internal ports. The 'ActiveSheetWatch' method on IBook, for instance, hands a
reference to an internal port that controls the active sheet for that book instance.
The only difference between a watch and a datawatch object is the 'Pathname'
property. Since it is not a published port, you will not be able to retrieve its
pathname, by which it can be located. All other methods and properties are
identical to that of DataWatch.

Section 5.45 IWaterfall (not yet implemented)

IWaterfall interfaces

Rev 13A 165


Chapter 5 Reference guide

Section 5.45.1 Content

 Methods
 AddBlock
 DeleteBlock
 DeleteZAxis
 ReplaceBlock
 ReplaceHeader
 ReplaceUserAttributes
 ReplaceZQuantity
 ReplaceZValues
 Properties
 BlockCount
 Header
 Properties
 UserAttributes
 ZCount
 Block
 ZQuantity
 ZValues

Section 5.45.2 Methods

AddBlock
 Signature
AddBlock(ac_nZValues As System.Array, ac_xBlock As IBlock) As IWaterfall
 Description
Add a block to the Waterfall.
DeleteBlock
 Signature
DeleteBlock(ac_nIndex As Integer) As IWaterfall
 Description
Remove a block from the Waterfall.
DeleteZAxis
 Signature
DeleteZAxis(ac_nIndex As Integer = 0) As IWaterfall

166 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Description
Delete a z axis by index from the Waterfall.
ReplaceBlock
 Signature
ReplaceBlock(ac_nIndex As Integer, ac_xBlock As IBlock) As IWaterfall
 Description
Replace a block in the Waterfall.
ReplaceHeader
 Signature
ReplaceHeader(ac_xHeader As IHeader) As IWaterfall
 Description
Replace the header of the Waterfall.
ReplaceUserAttributes
 Signature
ReplaceUserAttributes(ac_xAttributeMap As AttributeMap) As IWaterfall
 Description
Replace the user attributes of the Waterfall.
ReplaceZQuantity
 Signature
ReplaceZQuantity(ac_xZQuantity As IQuantity, ac_nIndex As Integer = 0) As
IWaterfall
 Description
Replace the Z quantity of the Waterfall.
ReplaceZValues
 Signature
ReplaceZValues(ac_xZValues As System.Array, ac_nIndex As Integer = 0) As
IWaterfall
 Description
Replace the z values of the Watrfall.

Section 5.45.3 Properties

BlockCount
 Signature
BlockCount As Integer

Rev 13A 167


Chapter 5 Reference guide

 Type
Read-only
 Description
This property is the number of block contained in this Waterfall.
Header
 Signature
Header As IAttributeMap
 Type
Read-only
 Description
This property is the header from this Watefall.
Properties
 Signature
Properties As IAttributeMap
 Type
Read-only
 Description
This property is the properties of this Waterall.
UserAttributes
 Signature
UserAttributes As IAttributeMap
 Type
Read-only
 Description
This property is the user attributes of the Waterfall.
ZCount
 Signature
ZCount As Integer
 Type
Read-only
 Description
This property is the number of z values.
Block
 Signature
Block(index As Integer) As IBlock2

168 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Type
Read-only
 Description
This property is the block at a specific index.
ZQuantity
 Signature
ZQuantity(index As Integer) As IQuantity
 Type
Read-only
 Description
This property is the quantity of z values at a specific index.
ZValues
 Signature
ZValues(index As Integer) As System.Array
 Type
Read-only
 Description
This property is the z values of the waterfall at a specific index.

Section 5.46 SearchBasket

Same as in documentation.

Section 5.47 SearchEngine

The usage of this interface is shown in example 3.

Rev 13A 169


Chapter 5 Reference guide

Section 5.47.1 Contents

 Definition
 Methods
 Search
 Properties
 Criterion
 SearchBasket
 StartPoint
 State

Section 5.47.2 Definition

The automation search mechanism is directly connected to the standard search


interface of the Navigator: it is the same search that is used. The results of the
search, launched in an automation program, can be seen in the standard
interface. Searches, done in the standard interface influence also the automation
program! The object "SearchEngine" is the drive for the complete search
mechanism. It is via this object that the definition of the search happens.

An automation user can specify the type of data that is been looking for (a
block, a run, a section, a database, CADA-X Data). The startpoint from where
to search is indicated (a place on the file system, a specific file, the active
project, the current search basket). The StartPointFactory is used to define this.
Specifying extra criteria is not yet supported. Via the method "Search" on the
search engine, the search is launched.

A property of it is the state, returning a watch. On this, the automation user can
implement a value-changed callback, so that he knows when the search is done.
The results of the search are found in the SearchBasket. The object
"SearchEngine" is the drive for the complete search mechanism in automation.

170 LMS Test.Lab Automation manual


Chapter 5 Reference guide

SearchEngine interfaces

Section 5.47.3 Methods

Search
 Signature
Search(StartPoint As StartPoint, SearchType As CONST_EnumSearchTypes)
 Description
This function launches the search. The StartPoint and the SearchType are
parameters to define this search.

Section 5.47.4 Properties

Criterion
 Signature
Criterion As IDomainSearchCriteria
 Type
Read-only

Rev 13A 171


Chapter 5 Reference guide

 Description
Get the search criteria.
SearchBasket
 Signature
SearchBasket As SearchBasket
 Type
Read-only
 Description
This property returns the searchbasket. Here, the results of the search can be
found.
StartPoint
 Signature
StartPoint As StartPointFactory
 Type
Read-only
 Description
This property returns the StartPointFactory.
State
 Signature
State As Watch
 Type
Read-only
 Description
This property returns a watch to the state of the search. This way, a callback can
be implemented that is called when the state of the search changes (it is busy, it
is not busy anymore).
The parameter of the callback is a variant, presenting a Boolean. It is ‘TRUE’
when the search is running

Section 5.48 StartPointFactory

The usage of this interface is shown in example 3.

172 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Section 5.48.1 Content

 Definition
 Properties
 ActiveProject
 SearchBasket
 Directory
 File

Section 5.48.2 Definition

This object allows to define startpoints for the search. Getting an


StartPointFactory object is done via the StartPoint property on an
ISearchEngine object. Its different properties are the different possibilities for
startpoints of a search.

StartPointFactory interfaces

Rev 13A 173


Chapter 5 Reference guide

Section 5.48.3 Properties

ActiveProject
 Signature
ActiveProject As StartPoint
 Type
Read-only
 Description
Property that returns the active project as startpoint.
SearchBasket
 Signature
SearchBasket As StartPoint
 Type
Read-only
 Description
Property that returns the searchbasket as startpoint.
Directory
 Signature
Directory(DirectoryPath As String) As StartPoint
 Type
Read-only
 Description
Property that returns the specified directory as StartPoint.
File
 Signature
File(FilePath As String) As StartPoint
 Type
Read-only
 Description
Property that return the specified file as StartPoint.

Section 5.49 Workspace

The usage of this interface is shown in example 2.

174 LMS Test.Lab Automation manual


Chapter 5 Reference guide

Workspace interfaces

Section 5.49.1 Contect

 Methods
 AddFolder
 AddItem
 AddProperties
 Delete
 GetBridgeElement
 GetItem
 GetProperties
 Properties
 ElementNames
 ElementTypes

Section 5.49.2 Methods

AddFolder

Rev 13A 175


Chapter 5 Reference guide

 Signature
AddFolder(PathToTop As String, NewName As String,
ac_xPropertyContainer As Object = Nothing)
 Description
Add a folder by specifying its name and parent folder.
AddItem
 Signature
AddItem(PathToTop As String, NewName As String, ac_xData As
Object, ac_xPropertyContainer As Object = Nothing,
OverwriteIfExists As Integer = 0)
 Description
Add an item to the workspace.
AddProperties
 Signature
AddProperties(PathToTop As String, ac_xPropertyContainer As
Object, OverwriteIfExists As Integer = 1)
 Description
Add properties to the workspace.
Delete
 Signature
Delete(PathToTop As String)
 Description
Delete objects or folders from the workspace.
GetBridgeElement
Signature
GetBridgeElement(PathToTop As String) As IData
 Description
Function that returns a bridge element by specifying its path to top.
GetItem
 Signature
GetItem(PathToTop As String) As IData
 Description
Function that returns an element by specifying its path to top.
GetProperties
 Signature
GetProperties(PathToTop As String) As AttributeMap

176 LMS Test.Lab Automation manual


Chapter 5 Reference guide

 Description
Function that return a property by specifying its path to top.
AddToInputBasket
 Signature
AddToInputBasket(ByVal PathToTop As String)
 Description
Adds an element available in workspace to input basket. PathToTop is path to
element available in workspace.

Section 5.49.3 Properties

ElementNames
 Signature
ElementNames(PathToTop As String, ReturnAsPathToTop As Integer = 0) As
AttributeMap
 Type
Read-only
 Description
Property that returns the names of the elements contained in the specified parent
directory.
ElementType
 Signature
ElementType(PathToTop As String) As String
 Type
Read-only
 Description
Property that returns the type of the element, specified by PathToTop

Rev 13A 177


Examples • 59
Index Explorer • 73
F
A
Factory • 95
AdvancedCmd • 136 FE35 • 86
B Freeware tools • 67

Block commands • 28 G

C General guidelines • 43
General: • 59
Changes in ISignatureAcquisitionCtr interface Getting started • 13
• 12 Gow to add a scalar to a block • 30
Changes to the Factory interface • 10
Changes to the IApplication and IModule H
interface • 8 How to access data via a Module Loader • 43
Changes to the IBlock2 interface • 7 How to access the PictureManager of a
Changes to the IBook interface • 8 Module Loader • 42
Changes to the ICmd interface • 7, 11 How to access the Test.Lab Type library in VB
Changes to the IDatabase interface • 10 • 43
Changes to the IDataBrowser interface • 10 How to access the Test.Lab Type library in
Changes to the IDisplay interface • 11 VB.NET • 45
Changes to the IGeometry interface • 7, 12 How to add a single x-cursor to the front of a
Changes to the InputBasket interface • 10 Front/back display • 34
Changes to the IQuantity interface • 11 How to add elements to Input Basket • 28
Changes to the IUnitSystem interface • 11 How to calculate the loudness of a block • 31
Changes to the SearchBasket interface • 10 How to change the run name and to be
Changes to the TdfSink interface • 8 informed if it is changed • 36
Changes to the Workspace interface • 10 How to change the X values of a block • 23
Connceting with the application • 19 How to change the Y values of a block • 23
Contect • 191 How to change the Y values of a block from
Content • 180, 187 MKS to user units • 26
Contents • 68, 82, 86, 92, 95, 99, 111, 124, How to create a random block • 29
127, 137, 146, 150, 154, 165, 171, 174, 184 How to create a scalar • 28
Controlling a measurement in Signature • 35 How to create a sine wave • 29
How to deal with Test.Lab objects • 54
D
How to define the Channel Setup parameters •
Default • 71 36
Definition • 68, 82, 86, 92, 95, 99, 112, 124, How to display a block in a running
128, 138, 146, 150, 156, 165, 174, 184, 187 application • 32
Display and plotting • 32 How to do a weighting on a block • 30
How to load a module (in VB.NET) • 39
E
How to load a module (in VB6.0) • 37
Enumerate • 92 How to make your own add-in in VB.6.0 • 49
Events • 91 How to make your own add-in in VB.NET • 51
Example 1: • 59 How to modify axis properties of any display •
Example 2: • 59 34
Example 3: • 59 How to multiply 2 blocks • 31
Example 4: • 60 How to print a block in a word document • 32
Example 5: • 60 How to read and change the header fields of a
Example 6: • 60 block • 24
Example 7: • 60 How to read and change the Y unit of a block •
Example 8: • 60

Rev 13A 179


25 ISingleCursor • 173
How to read the X/Y values of a block • 22 IUnitSystem • 174
How to read/write an enumeration value • 56 IWatch • 178
How to save the new created blocks • 22 IWaterfall (not yet implemented) • 179
How to search for all blocks on the active
project • 26 K
How to select a block in the navigator • 21 Key concepts • 62
How to select a block of a database • 20
How to specify a path • 57 L
How to start a measurement • 35 LMS Unit System • 178
How to start up a Test.Lab application • 19
How to stop a measurement • 35 M
How to use data watches • 47 Methods • 74, 83, 94, 96, 105, 119, 129, 141,
How to use this help • 13 147, 157, 166, 172, 175, 180, 185, 191
How yo connect to a running Test.Lab
application • 19 N
I New interface AutomaticTuningResult • 9
New interface AutomaticTuningSettings • 8
IApplication • 67 New interface AutomaticTuningState • 8
IAttributeMap • 81 New interface IExternalAutomaticTuning • 9
IBlock2 • 98 New interface ISignatureAcquisitionCtr • 9
IBook • 111 New interface TRMEventsSink • 9
IBooks • 124 New interface TRMEventsSinkNotify • 9
ICmd • 126
ICrossCursor • 136 O
ICursor • 136 Object browser • 67
ICursorManager • 136 Object interfaces • 64
IData • 137 Object models • 63
IDatabase • 137 OLE viewer • 67
IDataBrowser • 146
IDataWatch • 85 P
IDisplay • 149 Picture • 72
IDoubleCrossCursor • 149 PictureManager • 72
IDoubleCursor • 149 Properties • 78, 84, 88, 94, 100, 113, 125, 136,
IDoubleRatioCursor • 149 145, 148, 151, 164, 168, 172, 177, 181, 186,
IExplorer • 149 188, 192
IGeometry • 154
IHarmonicCrossCursor • 164 R
IHarmonicCursor • 164 Reading and changing a block • 22
IHarmonicRatioCursor • 165 Reference guide • 13, 61
IHeader • 165 Revision news • 7
IModule • 165
InProcApplication • 169 S
InputBasket • 170 Sample code • 19, 20, 22, 28
Introduction to Automation • 62 SearchBasket • 183
IPicture • 172 SearchEngine • 183
IPictureManager • 172 Searching • 26
IPrintManager • 173 Selecting and saving a block • 20
IQuantity • 173 Setup • 70
IRatioCursor • 173 StartPointFactory • 187
IScalar • 173
ISheet • 173
ISheets • 173

180 LMS Test.Lab Automation manual


T
The Test.Lab Automation Library • 67
Tutorial 1 • 13
Tutorial 2 • 15
Type library files • 66
U
Using Test.Lab Automation • 13, 19
Using the module loader • 37
W
What's New • 7
What's new in LMS Test.Lab Automation 10A
•7
What's new in LMS Test.Lab Automation
10ASL1 • 10
What's new in LMS Test.Lab Automation 11A
• 10
What's new in LMS Test.Lab Automation
12A? • 11
Workspace • 189

Rev 13A 181

Potrebbero piacerti anche