cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Read a Binary COMTRADE Data File

SOLVED

Re: How to Read a Binary COMTRADE Data File

Caution, using the built-in READCSV of Prime instaed of the one I supplied, requires changes in ReadComtradeCfg, because the READCSV built into Prime already interprets evry field that looks like a number as a number.

In many cases that's OK, but e.g. the Recording device ID (a 1 in your .cfg file) could also be an alpha string.

Luc

Re: How to Read a Binary COMTRADE Data File

HI Files from another protection relay - cannot be opened with mathcad 15 though.

Re: How to Read a Binary COMTRADE Data File

I will have a look later today (your night I guess)

Luc

Re: How to Read a Binary COMTRADE Data File

There was an(other) error in the ReadComtradeCfg function.

It's corrected now, and I've changed the Prime (4) version to use the built-in READCSV function.

Now both implementations (Mathcad 11 and up, as well as Prime 4 and up) should be able to read both data sets.

Success! and Happy Easter,
Luc

Re: How to Read a Binary COMTRADE Data File

Hi Thanks so much. Happy Easter to you too. I like your sign off. You make it look too easy.

Re: How to Read a Binary COMTRADE Data File

You're welcome.

I know that I didn't implement every feature of the Comtrade specification (yet).

If there's anything wrong or missing, don't hesitate reply back.

Luc

Re: How to Read a Binary COMTRADE Data File

Found, and corrected a few more errors in the READCSV function. (applies to Mathcad 11...15 only)

Luc

Re: How to Read a Binary COMTRADE Data File

Oh, it slipped my attention - READCSV is also available in Mathcad 15/14

Here's the help entry:

Re: How to Read a Binary COMTRADE Data File

Is it really WRITECSV(M,"file") and not WRITECSV("file",M), like Prime (4) has it?

And does WRITECSV support the same (row, col, etc.) arguments as READCSV?

Re: How to Read a Binary COMTRADE Data File

LucMeekes wrote:

Is it really WRITECSV(M,"file") and not WRITECSV("file",M), like Prime (4) has it?

Yes, the MC15 help is correct. i just gave it a try.

And does WRITECSV support the same (row, col, etc.) arguments as READCSV?

No. WRITECSV only accepts 2 arguments, matrix and file name. It always writes from the beginning (1;1) and you cannot change the decimal character from  "."  to "," (in prime  the field separator is then automatically changed to ";").

The help in Prime 3.0 is missing the information that READCSV can have more arguments (the same as in MC 15).

BTW, Prime (3.0) can write files where the decimal symbol is a comma, but it can't read those files. Numbers are interpreted as text.

Re: How to Read a Binary COMTRADE Data File

"The help in Prime 3.0 is missing the information"

That is the same for Prime 4. Why am I not surprised...

Re: How to Read a Binary COMTRADE Data File

I am trying this with the following files (attached). (Page 5)  Based on the file you created.

 

I can get the Ia value as I expect,

 

I think the Ib should be 39.286, 95.7063,127.58 etc

 

Similarly Ic= -126.778,-133.204,-125609

 

The voltages

 

Va=270618,23169,168359 etc

Vb=-70.841,18666.5,108174,etc

Vc=-199898,-25.1208,-276949 etc

 

What am I doing wrong?

 

 

Re: How to Read a Binary COMTRADE Data File

Your picture did not come through. While it is possible to insert a picture by pasting it during editing a post, once posted it is lost. To insert a picture you have to use the camera button, above the edit window. It also means that you have to have your picture saved to a file (.png, .jpg, etc.) beforehand.

 

Success!
Luc

Re: How to Read a Binary COMTRADE Data File

Any way. I got these results from your file set:

LM_20181126_Comtrade1.png

So there are 8 analog channels, 4 with current and 4 with voltage.

And the data is:

LM_20181126_Comtrade2.png

ILA is in column 2, ILB is in colum 3...ULA is in column 6 etc.

From your info I gather that you get ILA as 5506, 2816 etc. What makes you think that ILB should be other than 59.05, 143.829 etc. ?

 

Luc

Re: How to Read a Binary COMTRADE Data File

Yes . Thanks

Re: How to Read a Binary COMTRADE Data File

Hmm, found one error. In the last statement of the ReadComtradeBinary function. You should correct as follows:

LM_20181125_Comtrade.png

 

The 'multiplier' is added, instead of the 'adder', but that should not make (such) a big difference in ILB.

Now the analog data reads:

LM_20181125_Comtrade1.png

Success!
Luc

Re: How to Read a Binary COMTRADE Data File

Hi

The reason I think it should be what I stated is that I have another software that is supposed to read the samples like we are doing here. 

 

The software is SEL SYNCROWAVE and a trial version  can be downloaded here.

 

Essentially it takes the data from a protection relay and then  displays graphically. As you move the cursor you can see the reconstructed data samples. The A phase seems to reconstructs ok. The other phases seem off.  

 

https://selinc.com/products/5601-2/#tab-downloads

 Appreciate if you could have  a look if you have the time .

 

Kind regards

 

 

Re: How to Read a Binary COMTRADE Data File

A former colleage of mine gave some good advice several years ago: There's always one more bug.

 

Found it. The for loop should read:

LM_20181125_Comtrade.png

I had double ORIGIN. But worse: I had a too high offset, 2 instead of 1.

Anyway that's now corrected. The data now reads:

LM_20181125_Comtrade1.png

(There's your 39.286 for ILB ).

Attached is a corrected Prime 4 file.

 

Success!

Luc

Re: How to Read a Binary COMTRADE Data File

You have saved me hours of work! - 

 

We had a fault on our 330kV interconnector and the relays have a bug and not giving a fault location. I can now use this data to do a fault location and send the helicopter out 

 

Thank you so much. 

Re: How to Read a Binary COMTRADE Data File

It is good and satisfying to know that a little bit of programming here can make a tremendous difference on the other side of the world.

 

Success with pinpointing!

Luc

Re: How to Read a Binary COMTRADE Data File

We found it !  Thank you.

Re: How to Read a Binary COMTRADE Data File

Great!

Have a nice day.

 

Luc

Re: How to Read a Binary COMTRADE Data File

Hi! I'm using the last file you sent (LM_20181125_Comtrade) and I'm having problems with the ReadComtradeBinary function. I'm using MAthcad Prime 5.

It says that it only works in an array.

Do you know what could be the problem?

Thanks for all your help!

Ana, from Argentina

Re: How to Read a Binary COMTRADE Data File

If you can post your config and data files, I may be able to find the cause.

It'll take me some time though, because it's long ago that I looked into this.

 

Success!
Luc

Re: How to Read a Binary COMTRADE Data File

Thank you for your quick reply! I wasn't very hopeful since the last message was from 2018 😄

 

I attached 3 .DAT and .CFG files.

 

Hope it works!

Regards,

Ana

Re: How to Read a Binary COMTRADE Data File

Hola Ana,

 

I found the cause of the error message.

Your config file specifies no sampling rate(s), so it uses variable (event driven) sampling. The read routine for the binary data file isn't equipped for that. I didn't include support for that, probably because I didn't have an example file set that actually uses it. So far all work was done with files provided earlier in this thread.

I'll see what I can do to have it handle that situation as well, now that I have your examples to work with.

 

Luc

Re: How to Read a Binary COMTRADE Data File

Hola Ana,

 

I guess this is what you are looking for:

LucMeekes_0-1613684836463.png

From the data file, I deduce that you probably used a 1600 Hz external clock signal to trigger the sampling (the samples are 625 microseconds apart), so it's not actually variable.

If I made no mistake, the attached update should allow you to make similar pictures for the OSC001 file set using Prime. (I can only change the program, I cannot run it because I'm using the free Express edition of Prime, which doesn't allow programming and a few other things).

So go ahead and use it, and thoroughly check that the output is correct, as far as you can. Don't hesitate to get back here with any problems you may encounter using this utility.

 

Buena suerte!
Luc

Re: How to Read a Binary COMTRADE Data File

Hi Luc, it's Ana from Argentina (I had a problem with my previous account).

 

I have great news: IT WORKS!

Your code has helped me so much!

 

Thank you so much for your time, I'm really greatful!

 

Best regards,

Ana 🙂

Re: How to Read a Binary COMTRADE Data File

Hi Ana,

 

That's great.

 

Success with your files!

Luc

Re: How to Read a Binary COMTRADE Data File

Hi

What analysis are you doing with your comtrade files.

I would be interested specially if you are working on fault location.

Announcements