NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing data to a sequence step using C#

Writing data to a sequence step using C# I am using a .net adapter to calls a method in a .net assembly (C#). This method creates some data that has to be added to the sequence. The data should be stored into the actual sequence step. The next time the step is executed, the previously stored data has to be passed as an argument or as an input variable back to the .net assembly.  Does anyone know how to do this in TestStand or having an idea how to this in my .net application? Thanks.
0 Kudos
Message 1 of 7
(4,577 Views)

Hi ccds,

 

What kind of data are you using? Numbers, Strings or even Obejcts ?

I would use the feature of Local or FileGlobal variables.

 

Maybe find the anwer in this Thread.

http://forums.ni.com/ni/board/message?board.id=330&message.id=17663&query.id=281482#M17663

 

There is a small example which reads and write data from .net to TS

 

I also recomment to take a look on the

ProgrammFolder\National Instruments\TestStand 4.0\Examples\Demo\DotNet\computer.seq

that comes with TS

 

Hope this helps

 

juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 7
(4,572 Views)

Hi Juergen,

 

I think that my question was not clear, it will try to explain better.

 

I have .net code for several devices with a graphical interface to configure, measure ...

Now, for example lets focus on the code for a DMM.

I have an implementation to configure my DMM, another one to measure...

I want to use my existing .net code to create a sequence in TestStand, so I have made a class to instantiate the DMM, I have constructed this class from Teststand and called the appropriate method. Now, the graphical user interface is showed for the configuration. After changing some settings in the GUI, I want to store this settings into my TestStand sequence. In fact I want to be able to generate the code for my sequence, using the GUI's for my devices. All the settings made in GUI are stored into 1 string, so I am looking for a method to add this string content to the TestStand sequence for the current step executed. This is not possible using a local variable, because the settings are not added to the test sequence. This is also not possible using FileGlobal variables, because I need a universal method for all my devices.

After creating my complete Test sequence using my existing .net code, i want to be able to see all my configuration settings back in my GUI´s. So, for this reason I should have a method to dynamical add some data to the current executed Teststand step, this code has to be stored on disc.

 

best regards 

 

I hope that the question is more clear now.

0 Kudos
Message 3 of 7
(4,561 Views)

What you are describing sounds very much like the use case for creating custom step types. If you are not familiar with custom step types you should read about them in the documentation and search for articles here online (there is a best practices document available). If you do not already know, a step type is basically a custom data structure that you define (so you could add properties that you need to store the data that your configuration dialog needs to store) that the user can create instances of in their sequences as steps. Step types also can have builtin functionality which you can implement using code modules (C# or others) that are called as substeps. There are two main kinds of substeps, editsubsteps, and post/presubsteps. The editsubsteps show up as menu items in the sequence editor when you right-click on instances of your step that are inserted into the sequence. When the user selects your edit substep your code module for the edit substep is called and can then configure/set the properties on the step however you want it to (i.e. display your dialog). At runtime the pre/postsubsteps are called allowing your step type's code modules to implement additional runtime behaviors.

 

There are example step types in the TestStand examples directory (see the tcl example and StepTypes example).

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 7
(4,557 Views)

Hi

 

I agree with Doug. You have to write your own custom StepTye.

You are working with DMMs. So you should also read to source code of IVI-StepTypes

you will find it in the TS-Folder

 

I have also done my own StepType which i a have publicated at a NI-Event.

It deals with dmm, switches and power-supplies.

Maybe you can get some impressions for your task.

ftp://ftp.ni.com/pub/branches/germany/vip_days_sessions/teststand_step_type-mtu-dodek.pdf

 

Greetings

juergen

 

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 7
(4,549 Views)
Hi, Does anyone has an example, how to build a custom step type with C#? Thanks in advance
0 Kudos
Message 6 of 7
(4,533 Views)
Thanks a lot, I am using step types now and it works great!
0 Kudos
Message 7 of 7
(4,472 Views)