NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving ResultList as binary file

Hi,
 
I like to store my ResultList as binary on file drive. The aim is to safe drive space and execution time for creating the report (XML or ASCII) for each UUT.
At the moment i had nothing figured out doing such stuff in TS.
Thats the reason why I started this thread to discuss with you what is possible or impossible.
Do not care about the programming language. LV,CVI,C++,C# or anything else is welcome.
 
My idea sounds simple
 
1.) Creating : Take the address space of the ResultList and save it to disk. Problem: Size of Buffer !!
 
2.) Consuming: Take the Binary file and put it back to TS and let a the TestReport (XML, ASCII or whatever you want) Callback running.
 
Greetings from the lake of Constance, Germany
 
Juergen
 
 
 
 
 
 
 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 1 of 14
(6,664 Views)

When you want save report as binary you must programm your own sequence for creating report. You can select it under report optons (use seq instead off dll). For that modify the reportgen_txt.seq you find in  C:\Programme\National Instruments\TestStand 4.0\Components\NI\Models\TestStandModels

Second - the sequence self is now (since TS 4.0) possible to save in binary format. Other way could be open the Report *.txt with other program and save then in binary format and del the *.txt. In Report Options you can use "On The fly" then report saves while writing. See attached in *.doc the screenshots of new sequence file format and the location of the reportgen_txt.seq -> save it to new name and look at steps how to generate here the *.txt report and then use it for your own format in other language like Labview and CVI and give the values via adapters to the language and then save it as binary file.

Hope this helps

Best Regards

AE Munich (germany)

0 Kudos
Message 2 of 14
(6,628 Views)

Hi Johann,

 

Thanks for your answer. But unfortunately it pointed not out what I really want to know. Or lets say what i want to discuss.
The major task is: Is there a way to safe a the complete ResultList (if you take a look into the TestReport-Callback it will be variable "Parameters.MainSequenceResults") as a binary-file without any modifiactions or generator/parser stuff.

The first aim of this procedure should be no loss of data by saving huge number of file drive space. The Second is saving execution time for generating the report file in the Testreport callback.

 

The last few "lunch-breaks" I have dealed with this question to figure out a useful solution.

I have found several things in TS4.0 that deal with this topic the serialization of data

One the one hand there is a Engine method "SerializeObjects" . I got this running (I hoped so) for binary data but for re-building

just for visualizing the data to an Operator. I found no running solution. On the other hand there is PropertyObject method

"Serialize" This stuff was working fine. But data always have been stored in INI-Format on file. So there was no great benefit

on file size.

 

While looking on the TS4.0 poster on the wall i was focused on PropertyObjectFile. And with it found a resonable solution for this task. It is simple. Create a  PropertyObjectFile, do some settings like binary and path, get the parent PropertyObject from it, and ceate a new varaiable in the data folder. Now take the ResultList, clone and add it to your variable. The last step is saving.

 

A comparsion to the XML-Report (shipped with NI)
Binary  <-->  XML
Filesize: 23 kB  <--> 2202 kB  that is a reduction of filedrive space of over 95% !!!
Executiontime 160ms <--> 1960ms  that means i have to spent only 8% of time as in XML

 

I have attached an example. It writes the report on Root C:\report.dat

For you and all other members feel free to test it and please tell me what you think about it.
If there is an other solution so lets discuss it.

 

Greetings 

 

juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 3 of 14
(6,602 Views)

Hi - i tested your file and it works very well Smiley Happy

yes - since teststand 4.x we have additionally activex objects specially for binary file possibility and that´s the way it used.

So thanks for your example and have a nice day

Best Regards

 

0 Kudos
Message 4 of 14
(6,589 Views)
What was the problem that you had with SerializeObjects? You should be able to use UnserializeObjectsAndTypes to get the data back as objects. Using a file should work fine too, but so should SerializeObjects with the binary option. It will give you binary data converted into string format though so it will be slightly larger than the binary file version, but still much smaller and faster than xml.

Also, you could probably save the cloning step and improve performance a little by removing the resultlist objects from the original location and attaching to the file directly without cloning them. You could even move them back after saving the file if you wanted. Might not matter much for small amounts of data though.

-Doug

0 Kudos
Message 5 of 14
(6,580 Views)
Hi Dug
 
I have tried serializing objects with the Engine class. But the stuff with UnserializeObjectsAndTypes seems not working. OK there was no TS-Error at all.
I got the ObjectArray back, i also got access to the first item as PropertyObject in the array. But at this point i was not able to put ResultList back  into a variable.
Now sorry i have to go home. But later this evening will post a trail from home. 
 
Please tell me something more about removing objects. First trail was doing it with GetPropertyObject method on adding the step i got an error. (see attched file for more details) 
TS_Message: .....The item named '' cannot be added to the object 'Data' because it already has a parent object. You must first clone the item or remove it from its parent......
 
So i tried cloning but well now I see it even in the errormessage: removing is a very good hint because i can save memcopy.
 
Greetings and good evening 
 
Juergen
 
 


Message Edited by j_dodek on 02-18-2008 10:18 AM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 6 of 14
(6,572 Views)
You can remove the object from its original parent (so that you can make the file be the parent) by calling DeleteSubProperty() after first getting a reference to it with GetPropertyObject().

Is this perhaps also why you couldn't get the object back from UnserializeObjectsAndTypes back into a variable? It should be doable if you want to go that route. Let me know if you still need help with that.

-Doug
Message 7 of 14
(6,566 Views)
Hi Doug,
 
I have tested the method with DeleteSubProperty. It works as aspected.
I makes the code more transparent and simplyfies it at all.
With this method i am now able save my data back to my "old" variable Parameters.MainSequnceResultList. This is pretty nice.
This this simple modification i can reduce TestCallback Time to near 100ms. that means reduction of more 60ms !
I assume if I disable recoding within the sequence i will get under 100ms.
 
I'll give 5!
 
So lets discuss tomorrow on Engine methods.
 
Good night
 
Juergen
 
Note: I have reamed serval Locals in version 2
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 8 of 14
(6,552 Views)
Hi Doug,
 
Here is my lates stuff dealing with engine serialization
 
It seems that there to much unnamed sub folders
 
This there a way to get rid of them or tell me how to access them.
 
The attachment is running into an error
 
Greetings
 
Juergen
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 9 of 14
(6,533 Views)
Hi Juergen,

Here is a fixed version of your sequence file. There are several changes so please have a look and ask questions if needed.

It's a bit complicated to explain because you are trying to modify the object from the parameter. Parameters that are passed by reference create what is called an Alias to an existing object. So Parameters.MainSequenceResults isn't really a result object, it is really an Alias to the parameter than is being passed in, in this case Locals.ResultList[0] from the calling sequence.

Some of the changes I made and the reasons for the changes follow:
1) No longer attempting to delete and readd the propertyobject. Because you are trying to set it via the Alias that is the parameter, if you try to delete and readd, setting the object later will not work because you don't have the real original parent on which to set the object (i.e. Parameters.MainSequenceResult isn't really the parent of the result object, Locals.ResultList in the calling sequence is). Luckily serialization does not require that an object not have a parent so there is no need for the delete, and luckily doing SetPropertyObject on an existing object when you set it at the end, replaces it in whatever parent it currently has. So it works out that your unserialized version of the object gets passed back up to the caller. I'm not sure if your other PropertyObjectFile solution is really working correctly with regards to passing the unserialized data back up to the caller. If you are going to go with that solution I recommend verifying that that is actually what's happening by setting a breakpoint before returning from your sequence, modifying the unserialized result, and setting a breakpoint in the calling sequence to verify that you see the modification there too. I haven't looked that sequence carefully so I cannot tell you for sure whether or not it's correct.

2) Changed your local variable you use for serializing to an array of object reference instead of an array of containers. it can now be set via expressions.

3) various other changes that mostly simplify the code.

One thing I want to let you know is that since you are using TestStand 4.0 you could use API in expressions now instead of using the activex adapter which would make the calls easier to make. I kept it the way you had it though in case you wanted it to work in eariler versions of teststand as well.

Hope this helps,
-Doug
Message 10 of 14
(6,523 Views)