Cancel
Showing results for 
Search instead for 
Did you mean: 

Changing parameters value in LMS.TestLab by Automation (VB)

Creator
Creator

Good morning!

I'm using  LMS Test.Lab and I want to import data in the worksheet "Time Data Selection" by Input Basket and then I want to change the values of parameters that define the worksheets "Time Data Processing" by using Automation (and Visual Basic). How can I do it? I do not find an example regarding the modification or insertion of values ​​in the fields or how I can flag the options. Thanks in advance for any little help.

11 REPLIES

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Siemens Genius Siemens Genius
Siemens Genius

Adding data in the "Time Data Selection" with automation is not a problem, for this we can provide you a code snippet.

But, as you know in "Throughput Processing" there a lot of parameters, can you define some of them that you want to set? Or as alternative we can also load a TPS file with Automation instead of setting all value?

 

 

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Creator
Creator

Dear bvlassa, thank you very much for the reply and for your time! I have summarized the operations in the image provided. The desire is: importing the data from the Input Basket, selecting "Change settings", selecting "Edit throughput prestart", changing the values "Duration" and "Increment", selecting "Tacho" in the "Trigger" drop-down menu. I have not found information about similar operations in a worksheet. However, in general, I do not know how to change the fields in the various worksheets, how to change the parameter values. I don't find the right fuctions from the Automation manual. I hope I was clear. An example file could be very useful. Thank you very much for your attention! 

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Siemens Legend Siemens Legend
Siemens Legend

Hi,

As mentioned earlier you can save the process settings to .tps file and reuse it later or in a different project.

Picture1.jpg

Once you setup the "Edit throughput prestart", "Duration", "Increment", and "Tacho" settings...etc, click "Save Processing Setting..." it'll create a .tps file for you and remember all the settings.  Then the next time or different project, you can click Load Processing set...to recall these parameters without manually entering them again.

 

Hong

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Creator
Creator

Good evening Test_Geek! I don't want use the button Save .. or Load .. but I would like to automate the process by Visual Basic code. I would like to perform the operations listed by code, not manually. For example, in the attached figure, I want also to select the sheet "Manual zero Angle Definition" but again by VB code. Basically, I would like to be able to automate the postprocessing process, the values specification, options selection, by means of a VB code without mouse click or keyboard input.

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

To import data from the Input Basket to Time Data Selection, you can use the following routines:

Public Sub TDS_DSS_SelectSource(ByVal Source As Integer)
   '**********************************************************************
   '*** Select a source for the Data Source Selection dialog
   '*** 0 = Input Basket
   '*** 1 = Active Project
   '*** 2 = Data Set
   '*** 3 = Most recent run
   '**********************************************************************
gTL.ActiveBook.FindDataWatch("TPTProcessing\/DataCollection\/DataSource/EnumValue").Data = Source End Sub Public Sub TDS_DSS_ClickReplaceButton() '********************************************************************** '*** This sub simulates clicking the Replace button to put channels '*** in the "Data Set" table in the Time Data Selection worksheet. '********************************************************************** gTL.ActiveBook.FindDataWatch("TPTProcessing\/DataCollection\/NewDataSet").Data = gTL.CreateObject("LmsHq::DataModelI::DataArch::ICommand", gTL.CreateAttributeMap) End Sub

 

Regarding setting parameters for Time Data Processing... as bvlassa said earlier, there are many, many parameters and it is not possible to set them all.  What we normally do in this case is load a TPS file that will set as many parameters as possible, and then modify a few of them.  Most of these parameters are not documented, so we need to spend some time with a debugging tool and figure them out.  If you ask us about some specific parameters, we can try to give you routines to set them.

 

Below are some routines to load a TPS file, press the Calculate button, and a few other examples:

Sub TDP_LoadTPS(ByVal TPS_Filename As String)
   '**********************************************************************
   ' Load a Throughput Processing Set (TPS) file.
   '**********************************************************************
   gTL.ActiveBook.FindDataWatch("TPTProcessing\/DataProcessing\/LoadProcessingSetFileName").Data = TPS_Filename
End Sub

Sub TDP_Calculate()
   '**********************************************************************
   ' Press the "Calculate" button in the Time Data Processing worksheet.
   '**********************************************************************
   PushButton("TPTProcessing\/Start")
End Sub

' Select or De-select all traces in the Data Set Sub TDP_SelectAll() PushButton("TPTProcessing\/DataProcessing\/SelectAllTraces") End Sub Sub TDP_DeselectAll() PushButton("TPTProcessing\/DataProcessing\/DeselectAllTraces") End Sub
Public Sub PushButton(ByVal ButtonDataWatch As String)
'**********************************************************************
'*** For a data watch that represents a TestLab button,
'*** this subroutine "pushes the button".
'**********************************************************************
gTL.ActiveBook.FindDataWatch(ButtonDataWatch).Data = gTL.CreateObject("LmsHq::DataModelI::DataArch::ICommand", gTL.CreateAttributeMap)
End Sub

'*** Set the desired Frequency Resolution for processing Dim FreqResolution As Double Dim Bandwidth As Integer Dim Blocksize As Integer FreqResolution = 1.0
' Vibration group Bandwidth = gTL.ActiveBook.FindDataWatch("TPTProcessing\/BandwidthVib").Data Blocksize = Bandwidth * 2 / FreqResolution gTL.ActiveBook.FindDataWatch("TMon\/Acquisition\/FixedSampling\/BlockSize").Data = Blocksize
' Acoustic group Bandwidth = gTL.ActiveBook.FindDataWatch("TPTProcessing\/BandwidthAc").Data Blocksize = Bandwidth * 2 / FreqResolution gTL.ActiveBook.FindDataWatch("TMon\/Acquisition\/FixedSampling\/AcousticBlockSize").Data = Blocksize

 

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Creator
Creator

Dear PMoore, thanks for the code. I analyzed it but I didn't understand how you defined the parameters and where you found the right information about the DataWatch. My question is:- How do you know the right parameter/path, "TPTProcessing\/BandwidthVib" and then "TMon\/Acquisition\/FixedSampling\/BlockSize", to set the desired field?  I am very confused. I have Automation Manual and AutomationDocumentationTool_v1 but I don't find the parameters of the function FindDataWatch that you use in the code. Perhaps there is a more detailed manual about the functions..Is it right? Is it possible to have it? I can not automate processes, indicated in the images provided, without this information. Thank for your support.

 

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hello LeoMaD,

You asked about the arguments for the "FindDataWatch" functions; in fact, many of these are not readily available to users, they are intended for use by Testlab developers and are not "officially" supported or documented for automation. That being said, we are sometimes able to provide example routines to a user to perform some specific parameter setting (e.g. the code I posted for setting Frequency Resolution).
My suggestion is you use the capability to load TPS files to accomplish as much as possible, and then request help on how to change specific settings as necessary. I will see if I can find out how to set the Throughput Pre-start, Duration and Increment, as you requested previously. I would also suggest that your local Testlab support group may be able to help you with this information.

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Creator
Creator

Dear PMoore, I was almost certain of this obfuscation, but for what you tell me, now it is a certainty. Unfortunately, due to these strong constraints, the automation package is very limited and therefore is not very useful for developing automated processes.
However, to solve the problem, I tried to import the Automation library into Matlab but unfortunately it is not possible because it has the extension tlb. In Matlab, it seems only possible to create a local OLE Automation server (for example,'LMSTestLabAutomation.Application') but in this way the interfaces (IBlock, IDatabase, etc.) are not available. Do you have a solution for this problem? How can I import all the interfaces? My goal is to import all the project data (time histories) into Matlab for creating an automated post-processing process. Thanks.

Re: Changing parameters value in LMS.TestLab by Automation (VB)

Siemens Genius Siemens Genius
Siemens Genius

in attach you can find the requested ports and data type.

snippets can follow, if needed.