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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Importing SPICE data

Mr.E
1-Newbie

Importing SPICE data

I am using 5SPICE (5SPICE is an inexpensive SPICE program I use but it doesn't have any processing power beyond presenting the waveforms at various points in the circuit.) to do some circuit analysis and exported the data after clean up to Excel 2010. However, Excel can no longer handle time based data. So I am attempting to transfer the data to Mathcad 15 or Prime 1 or 2. It seems that Excel converted the data to scientific notation so I'll have to go back to the 5SPICE data file and start over.

I'm looking at a 5 millisecond window but it has over 8,000 data points. The task is to calculate the rms current in the input capacitor of a switched mode circuit. I could do it manually by integrating the area but that's not very accurate and I want to try several variations in the switching time, load current, components etc. I'm fairly new to Mathcad and thought this would be a good learning experience. Boy was I right about that.

While this is a switchmode circuit it is not a power supply and actually operates at 250 Hz so the 5 ms window only gives me the rise and fall for one cycle.

Is there anyone out there with experience in this type of data acquisition. This would actually be similar to processing the information from a DAQ system and as I get further along I'll probably want to try that too.

The answer is probably in the user's guide but I haven't found it as yet.

Thanks for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:Mr.E)

The attached worksheet shows to to get the same answer as you get in Excel. However, Mathcad is much more powerful than Excel and there is a much better way to integrate vectors of data. You should calculate an interpolating function and integrate that. In most cases the best choice of interpolating function is a cubic spline (this is not always the case though. Go to "Help", "E-books", "Data Analysis Extension Pack", and under "Application Examples" look at "Numerical Integration of Data).

View solution in original post

15 REPLIES 15
nas0k
7-Bedrock
(To:Mr.E)

In Mathcad 15 look at "insert, Object, Probe Document" to see if that will help you any.

There doesn't seem to be any information in the help files.

Norm

Mr.E
1-Newbie
(To:nas0k)

Norm,

Thanks for your advice. I'll give it a try.

Larry

MichaelH
1-Newbie
(To:Mr.E)

What do you mean by "Excel can no longer handle time based data"?

Mr.E
1-Newbie
(To:Mr.E)

Michael,

My problem with Excel was graphing a time based set of data. The graph wizard is gone and I simply couldn't get a reasonable plot. Searching online the common response was that Excel had changed and it was now very difficult to deal with time-based data. I didn't pursue it any further. I just switched to Mathcad. I tried Prime 2.0 but it isn't suited to what I'm trying to do.

Fortunately, my data is in 8,126 even increments of time. I can of course do a numerical integration and get where I want to go but I would also like to plot my data. Besides, Mathcad is more suited to the task. I have been able to import and plot the data and am now working on the integration of the current squared. The advantage of Mathcad over Excel is that you can write the equations directly without converiting to cell manipulation.

I started with Mathcad to help recover a lot of the math I've lost over the last 50 years. Just a little side note, I took my third or fourth course in calculus from none other than Theodore Kaczinski. I was a year older than him since I was working my way through school. I started school in 1959 and I believe this was about 1964. He was probably the best math instructor I had at The University of Michigan. I had held him on a pedestal through the years and it was terrible to learn that he was the Unabomber.

MichaelH
1-Newbie
(To:Mr.E)

I agree that you should go with Mathcad whenever possible.

I just didn't understand what you meant about Excel. It probably can do what you need, but why bother?

Mathcad can accomplish in a few lines what takes spreadsheet gymnastics in Excel.

RichardJ
19-Tanzanite
(To:Mr.E)

The advantage of Mathcad over Excel is that you can write the equations directly without converiting to cell manipulation.

I only wish more Excel users appreciated just how big an advantage that is!

I have been able to import and plot the data and am now working on the integration of the current squared.

Could you post a worksheet with your data and where you have got to (click on "advanced editor" at the top right)

Mr.E
1-Newbie
(To:RichardJ)

Richard,

Last night I actually got my answer using Excel but my aim is to learn Mathcad.

My problem at the moment is derivng a delta t from my time array. The time runs from .04sec to .044sec in 8,126 time slices. (I delayed the data for 10 cycles of 4ms to attain a steady state.) I thought the times were uniform which would make the job easy but evidentally 5SPICE takes longer to process some transitions than others. So like I did in Excel I have to calculate the delta-t for each time slice and multiply it by i-squared for that time slice. I'm assuming that because of the thin time slices I can assume a rectangular shape. So far I haven't figured out how to generate the delta-t from the array but I will get there. However, I'm not too proud too ask for help

This resembles the Reimann integral, you just can't take the time slices to 0.

I have attached the data arrays along with the graph for capacitor current. So far that's all I have. I've got this other problem I'm working on called 1040 that's due soon.

The Excel solution showed I had an rms current in the capacitor of about 900ma. Since this product will be operating at elevated temperature the 900ma is pushing it for the caps I can find. There are so many trade-offs. I can slow the turn-on and turn-off rates to lower the rms current but that will increase the dissipation in the MOSFET switches and we are fighting a thermal battle already.

If you are interested I could also attach the Excel file.

RichardJ
19-Tanzanite
(To:Mr.E)

The data in the Mathcad sheet got lost somewhere, so maybe attaching the Excel file is a good idea.

Mr.E
1-Newbie
(To:RichardJ)

Richard,

I'll attach both files. I thought about zipping them but they only total about 2MB.

Thanks,

Larry

Mr.E
1-Newbie
(To:Mr.E)

Richard,

I had a little time and got a little closer. I generated a second time vector offset by 1 slot. I had to lose a sample to make the vectors come out even but subtracting gave me the width of each time slice. However, when I tried to multiply the resulting vector by the i-squared vector I got just a number instead of a vector. The vectors are all the same length so I'll have to keep digging to figure it out.

At least I'm having fun and learning something new.

Larry

VladimirN
24-Ruby II
(To:Mr.E)

Something like this?

Pic_1.png

Mr.E
1-Newbie
(To:VladimirN)

Vladimir,

That's a lot neater than my worksheet. As I told Richard I multiplied the vector for I-squared by the vector for the width of the time slices and the result was a number instead of another vector as I expected. However, the magnitude of that number is about what I would expect for the sum of the samples. If I multiply by 250 (since the data is for one cycle and I am running at 250 cycles per second) and then extract the square root I get just over 1 amp, about what i expect.

I am attaching the worksheet and welcome comments.

I'll have to do some digging to determine if the result of the multiplication is the total I'm after or not. It certainly is close to what I would expect. In the sixties I worked for a laser company and the physicists all felt compfortable if it was in the right order of magnitude.

Thanks all, especially for the moral support,

Larry

Mr.E
1-Newbie
(To:Mr.E)

I just looked up dot product and it does indeed sum the result of the multiplication. It looks like I fell into it and learned a little more about mathcad.

Thanks for bearing with me,

Larry

RichardJ
19-Tanzanite
(To:Mr.E)

The attached worksheet shows to to get the same answer as you get in Excel. However, Mathcad is much more powerful than Excel and there is a much better way to integrate vectors of data. You should calculate an interpolating function and integrate that. In most cases the best choice of interpolating function is a cubic spline (this is not always the case though. Go to "Help", "E-books", "Data Analysis Extension Pack", and under "Application Examples" look at "Numerical Integration of Data).

Mr.E
1-Newbie
(To:RichardJ)

Richard,

Thanks, I'll take a look at that a little later. It's nice to get correlation. I did figure out a simple minded approach and came up within 10% of the Excel result. However, I simply used rectangular samples and multiplied to get the area of each sample. With the sample rate it's going to be fairly close. I think your are right though. Especially if I want more accurate results.

I also want to learn as much as I can. This problem although it threw me for a loop at first is pretty elementary and I need to learn the more sophisticated techniques. My technique of creating a new vector with an offset is time consuming but it does work.

The worst part of this whole thing is that 5SPICE doesn't fill in trailing zeroes so you don't get nice even columns. The columns were intertwined and Excel didn't like the data at all. There is probably an easier way but I went in and added the trailing zeroes.

Top Tags