NI Home > Community > NI Discussion Forums
Reply
Member
smoothdurban
Posts: 173
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hey Brad Looks good.

 

Thanks!

 

Is there a way I could take the Date time an convert it so it would start at zero and count up until the end of the file?

 

Basically I would like to have the time index start at zero. 

Tim Z
Test Engineer
Magna International
Trusted Enthusiast
Brad_Turpin
Posts: 2,716
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi smoothdurban,

 

The DataPlugin declares the Y channel as a waveform, so that if you drag the Y channel by itself, it will display vs. relative time on the X axis, starting at 0.  If you really don't want the date/time information, we could either remove that channel entirely or convert it to a relative time channel inside the DataPlugin-- no problem.  But you might want to retain the DateTime channel for comparison purposes.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Member
caracasnet
Posts: 17
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi everyone,

I have a similar require like in the title...

i already have (thanks to the forum) a working dataplugin to process an specific firmated CSV file, and i have been using really well.

After import with the dataplugin i create some scripts to process the data, however, i need to do to many changes and process that will be more efficient and faster if i could do it from the begining at import it.

 

Tasks:

- Solve bitwise the 3rd channel (original 3rd, after dataplugin 2nd) in different new channels in the same group (one is enought for an example: 58 decimal is 111010 in binary)

2ndCHNEWCH1NEWCH2NEWCH3NEWCH4NEWCH5NEWCH6

58    010111

Solution: 

i'm able to do it in SCRIPT with

Call ChnCalculate("Ch(""[1]/NEWCH1"") = GetB(Ch(""[1]/2ndCH"",0)") 

.....

 Call ChnCalculate("Ch(""[1]/NEWCH6"") = GetB(Ch(""[1]/2ndCH"",5)") 

but not in dataplugin, i'm able to create the channels but i have investing a lot of time and i'm still not able to fill them (for sure is really simple).

My last try was:

 

For i = 1 to oChn2.Size
oMyChn.Values(i) = anyoperationhere 
Next

 

and i get kind of error: Type not possible

 

Task 2:

The data that is not recorded is marked like "-". I will like to replace it to "novalue" when is loaded with the dataplugin.

eg:

TimeCh1CH2

2011.02.02 12:45:33:0000345578.0

2011.02.02 12:45:34:0000--

2011.02.02 12:45:35:000043234,1


(Actually should be in other post but i didn't found either)

 

Can anyone tell me what i'm doing wrong ? (not even the code example is working !!! )

 

I'm attach the uri, and the file.

 

Thanks in advance...

 

 

 

Member
caracasnet
Posts: 17
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

I read again my post and i apologize for the disorder

Here is more clear:

 

Task1:
2ndCH NEWCH1 NEWCH2 NEWCH3 NEWCH4 NEWCH5 NEWCH6
58        0             1              0              1              1             1

 

Task2:

 

Time                                    Ch1    CH2

2011.02.02 12:45:33:0000      345    578.0
2011.02.02 12:45:34:0000        -          -
2011.02.02 12:45:35:0000      432     34,1

 

i hope look better or understandable

Trusted Enthusiast
Brad_Turpin
Posts: 2,716

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi caracasnet,

 

Please submit an unencrypted DataPlugin next time-- I can use your DataPlugin to load your data file, but I can't see the source code, and I can't add the following line to turn "-" values into NoValues:

 

File.Formatter.NoValueSign = "-"

 

How many rows or bytes do these data files typically have?  Because your data file is ASCII, there is no parameter we can set to bitmask the values like we could with a binary file.  You could bitparse the second channel values and split them into a number of separate bit channels inside the DataPlugin, but if your data file is really large this will be much slower than what you're already doing in DIAdem.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

Member
caracasnet
Posts: 17
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Upsss...Sorry

I clicked to fast... here is it...

About the data yes, is quite a lot... 20MB file, around 40000 registers if i remember well...  i thought was better by dataplugin but if you say that is slower well i did already by script.

Now come the question:

When is more efficient do it by dataplugin ? Witch factor should i considerate to take that decition ? (Until now is just based in the possibility to programm it, so my limited knowledge about it)

I will like to clean or really process well the data before start to check it (analysis), things like values = - are no values or, if one of this bits is 0 (is false) so make some warning (paint in red something)...etc

i just ask to invest more efficient my toime trying to learn how use diadem and not ask each time in the forum... (just when i'm totally desperate):smileyfrustrated:

 

Thanks a lot

Trusted Enthusiast
Brad_Turpin
Posts: 2,716
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi caracasnet,

 

I added the one line to your DataPlugin that I mentioned in my last post, and now it loads NoValues whenever it finds a "-" value in the data columns.  If your files are long, then you're better off doing bit manipulation in a VBScript.  You should do anything that can be done in the DataPlugin by parametrizing the DataPlugin engine, but as little as possible with single value processing (like bit parsing).

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Member
caracasnet
Posts: 17
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hi,

I added the line before like you say and works really perfect... i knew that was a simple solution... i just didn't found it...

Now i have the with the NOVALUE in the right position, the problem that i have now is with my old Script code. I take the bits with GetB() and the interpretation of the NOVALUE is the max Long number type (2,14..E+09) and because are so many channels i will dont like to include a line that correct again after my calculation eg: if ch("[1]/bitx")>1 then NOVALUE in the 40 different bits.

Any suggestion ? why GetB() interprets NOVALUE like that ?

 

Btw: i check the speed and decided to create the channels in the dataplugin and fill them (extracting the correct bit) in the Script. I found a little bit more faster. Thanks for the tip.

 

 

 

 

Member
JL@NI
Posts: 125

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hello caracasnet,

 

This is incorrect behavior and I have filed a corrective action request. You can track the status of this request with Request #: 340961. Otherwise, it sounds that you have a viable solution.

 

Regards,


 

Applications Engineer | National Instruments
Member
JL@NI
Posts: 125
0 Kudos

Re: Manipulating dataplugin script files to add channel names, units, etc?

Hello caracasnet,

 

This issue has been fixed and will be reflected in DIAdem 2012. The beta version will be released in about a month.

 

Regards,

Applications Engineer | National Instruments