Post Reply 
Fitting multiple RC time constants
04-30-2024, 05:23 PM
Post: #1
Fitting multiple RC time constants
I am putting this here since I am trying to find the best tool for the job.

I am trying to model a thermal response as a series of RC time constants.

The basic model is
Tc + r1*(1-exp(-t/(r1*c1))) + r2*(1-exp(-t/(r2*c2))) + r3*(1-exp(-t/(r3*c3))) ...
where in this case I go up to 10.

I have the Zth as a function of t. (t ranges from 1 E-10 to 100 seconds, and Zth ranges from .02 to 2.8 so it is a pretty "stiff" system.)

This was solved by the folks that did the original work for us, but I am trying to build some local capability. They have a 10 element (10 r's and 10 c's) that fit very well. But when I try to use Excel and its solver, it does not do very well.

So does anyone have a good idea for a tool/procedure?
I am really tempted to try the HP71 since I have the curve fitting pack...

I also have a Prime.
Find all posts by this user
Quote this message in a reply
04-30-2024, 07:49 PM
Post: #2
RE: Fitting multiple RC time constants
(04-30-2024 05:23 PM)KeithB Wrote:  I am putting this here since I am trying to find the best tool for the job.

I am trying to model a thermal response as a series of RC time constants.

The basic model is
Tc + r1*(1-exp(-t/(r1*c1))) + r2*(1-exp(-t/(r2*c2))) + r3*(1-exp(-t/(r3*c3))) ...
where in this case I go up to 10.

I have the Zth as a function of t. (t ranges from 1 E-10 to 100 seconds, and Zth ranges from .02 to 2.8 so it is a pretty "stiff" system.)

This was solved by the folks that did the original work for us, but I am trying to build some local capability. They have a 10 element (10 r's and 10 c's) that fit very well. But when I try to use Excel and its solver, it does not do very well.

So does anyone have a good idea for a tool/procedure?
I am really tempted to try the HP71 since I have the curve fitting pack...

I also have a Prime.

I don't have details regarding a particular calculator program to handle fitting multiple exponential terms, so just some brief comments on the methods available in case it's of any use.

The problem of fitting multiple exponential terms occurs frequently and the methods employed are particularly susceptible to numerical instability and noise. The oldest (1795 !) method, Prony's method can work with clean data but doesn't handle noise well (inaccurate parameters are obtained), so many enhancements and alternatives have been developed over the centuries. While there are now better (and more sophisticated) methods, the "peeling method" that became popular in the 1960's is a nice compromise between usefulness and complexity. Here is a link to a very readable 1969 report that explains the steps to implement the peeling method (an iterative method using nonlinear least square that sequentlally "unpeels" each exponential term) from the Stanford Linear Accelerator lab and includes an example (though an IBM mainframe was used). Here's a link to the abstract of a 1980 paper that implemented the peeling method using a handheld calculator of that time, but unfortunately I don't have the paper itself.
Find all posts by this user
Quote this message in a reply
04-30-2024, 07:56 PM
Post: #3
RE: Fitting multiple RC time constants
Sounds interesting. Can you post a diagram or two to help explain the physical arrangement you're modelling, and how the RC analogy would be wired?
Find all posts by this user
Quote this message in a reply
04-30-2024, 08:34 PM
Post: #4
RE: Fitting multiple RC time constants
   


   
Find all posts by this user
Quote this message in a reply
04-30-2024, 08:41 PM
Post: #5
RE: Fitting multiple RC time constants
carey:
Thanks I am trying to do the "peeling" in excel by only using a few parameters at a time.

(Where is Sliderule when you need him!)
Find all posts by this user
Quote this message in a reply
04-30-2024, 09:25 PM
Post: #6
RE: Fitting multiple RC time constants
I'm reading {& looking}; so far - no positive results to report!

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
05-01-2024, 07:58 AM
Post: #7
RE: Fitting multiple RC time constants
Hi Keith, Thanks for posting the images

So if I'm understanding it, the underlying question is about solving a problem of hear flow in a one dimensional system. Ie heat flows from a source to a sink, controlled along the way by the conductivity and thermal cspacity? So in the RC analogy, the R parts capture length/( Area x conductivity) / and the C's capture mass x heat capacity.

I often work on such issues in the context of transfer of heat in a fire, or in solar problems.

If I'm using a spreadsheet, the easiest way is often just a discrete time step analysis. Maybe divide the whole path into the 10 segments as described above. and at each small time step, just assess the heat flowing into and out of each segment based on its temperature at the previous step and that of the adjacent segments, and work out its new temperature.

For a concrete wall in a four hour fire, I might have a spreadsheet line every 5 seconds. So it's a big file but a simple one., nothing is explicitly solved. It converges well if the time step is small enough for the problem. I've tested it against analytical solutions to check.
Find all posts by this user
Quote this message in a reply
05-01-2024, 02:02 PM
Post: #8
RE: Fitting multiple RC time constants
Not exactly what we are doing.

We have finite-element simulations of the heat flow, but would like to predict peak thermal resistance at any arbitrary pulse width. So you fit the simulated points to the curve using the quasi-physical RC model.

It might be easier to just use a graphical representation.

Sliderule:
Thanks!
Find all posts by this user
Quote this message in a reply
05-01-2024, 02:04 PM
Post: #9
RE: Fitting multiple RC time constants
I wish that 1969 report had Fortran source code. I kind of like the idea of adding a Fortran component from 1969 to my C# program!
Find all posts by this user
Quote this message in a reply
05-02-2024, 01:34 AM (This post was last modified: 05-02-2024 01:37 AM by Namir.)
Post: #10
RE: Fitting multiple RC time constants
(04-30-2024 05:23 PM)KeithB Wrote:  I am putting this here since I am trying to find the best tool for the job.

I am trying to model a thermal response as a series of RC time constants.

The basic model is
Tc + r1*(1-exp(-t/(r1*c1))) + r2*(1-exp(-t/(r2*c2))) + r3*(1-exp(-t/(r3*c3))) ...
where in this case I go up to 10.

I have the Zth as a function of t. (t ranges from 1 E-10 to 100 seconds, and Zth ranges from .02 to 2.8 so it is a pretty "stiff" system.)

This was solved by the folks that did the original work for us, but I am trying to build some local capability. They have a 10 element (10 r's and 10 c's) that fit very well. But when I try to use Excel and its solver, it does not do very well.

So does anyone have a good idea for a tool/procedure?
I am really tempted to try the HP71 since I have the curve fitting pack...

I also have a Prime.

I think Matlab would work by using an evolutionray optimization algorithm (like Paticle Swarm Optimization (PSO)) that minimizes the sum of errors-squared between the observed resposes and the calculated responses. PSO should be able to handle a model with 20 unknows given a large enough swarm population and maximum number of iterations.

Another tool is the Matlab Curve Fitting toolbx that can handle nonlinear fitting and gives results similar to the graphs you had shown.

Namir
Find all posts by this user
Quote this message in a reply
05-02-2024, 01:40 AM (This post was last modified: 05-02-2024 01:41 AM by Namir.)
Post: #11
RE: Fitting multiple RC time constants
(05-01-2024 02:04 PM)KeithB Wrote:  I wish that 1969 report had Fortran source code. I kind of like the idea of adding a Fortran component from 1969 to my C# program!

Try to find Particle Swarm Optimization code for C# on the internet. Writing the function to minimize is relatively easy.

I found a few C# implementations for PSO by a simple Google search!

Namir
Find all posts by this user
Quote this message in a reply
05-02-2024, 01:47 AM
Post: #12
RE: Fitting multiple RC time constants
The full length article Fast fitting of multi-exponential decay curves in Optics Communications 134 dated 15 January 1997 pages 371-378 may be a reference of note and some edification.

Abstract
In the analysis of time-resolved measurements of fluorescence decays, one is usually confronted with the essentially non-linear fitting problems. There are several standard methods for non-linear minimization, but they are all very sensitive to initial guess parameters and are time consuming. Recently, Sasaki and Masuhara and independently Apanasovich and Novikov proposed an elegant method of quasi-linearizing the problem of multi-exponential fitting. In the present paper it will be shown, that their method can be improved by better taking into account the statistical character of the measured data.

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
05-03-2024, 10:36 AM (This post was last modified: 05-03-2024 11:05 AM by SlideRule.)
Post: #13
RE: Fitting multiple RC time constants
An excerpt from EXPFIT: a program for simultaneous analysis of families of exponential decay curves, Computer Methods and Programs in Biomedicine 27 (1988) 61

5. Discussion
Many programs are available for computer fitting of data corresponding to exponential decay curves, especially in the field of pharmacokinetics.

Pharmacokinetic curve fitting and parameter determination by non-linear, iterative least squares regression analysis using a programmed minicalculator, International Journal Bio-Medical Computing 12 (1981) 503-517
pharmacokinetic non-linear, iterative least-squares program for the minicalculator TI-59 with adapted printer is descrbed. The program utilizes the Gauss-Newton gradient method in an iterative, non-linear regression analysis of up to 18 data pairs

A routine fitting of kinetic data to sums of exponentials with a programmable calculator, Computers in Biology and Medicine 14 (1984)363-376.
Abstract - … Two multioptional programs written for the Texas Instrument 59 programmable calculator and for the Sharp 1500 pocket computer were developed which provide for fully automated exponential stripping of pharmacokinetic data and which will allow workers to calculate the numerical values of all the coefficients and exponents for the tracer function fitting the monotone sequences of data. …

& this excerpt from AREA ESTIMATION IN PHARMACOKINETIC STUDIES USING A HAND-HELD PROGRAMMABLE CALCULATOR International Journal of Bio-Medical Computing 15 (1984) 219-224

A short program for area analysis in pharmacokinetic studies using the Hewlett-Packard [b]HP41C hand-held programmable calculator is described[/b] …

The decision can be facilitated by preliminary exponential regression analysis of an increasing number of terminal data pairs to determine the line of best fit. This can be accomplished rapidly on the HP41C calculator using the exponential curve fitting program in the statistics application module. Such a technique cannot be compared with advanced, complex automatic curve stripping computer programs such as AUTOAN, which incorporate iterative non-linear least squares regression analysis. Nevertheless, it has a significant advantage over manual graphical methods in that consistent results from a given set of data can be obtained by different people.

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
05-03-2024, 01:59 PM
Post: #14
RE: Fitting multiple RC time constants
Awesome,thanks.

Somehow, I imagine SlideRule's house to be full of stacks and stacks of old journals, indexes and periodicals. And when faced with a question like this goes straight to a particular stack and pulls out the correct document in a pile of a hundred or so...
Find all posts by this user
Quote this message in a reply
05-03-2024, 03:03 PM
Post: #15
RE: Fitting multiple RC time constants
(05-03-2024 01:59 PM)KeithB Wrote:  Somehow, I imagine SlideRule's house to be full of stacks and stacks of old journals, indexes and periodicals. And when faced with a question like this goes straight to a particular stack and pulls out the correct document in a pile of a hundred or so...

close, but mixed with numerous hard drives, memory cards … of scanned books, pubs …

BEST! SlideRule
Find all posts by this user
Quote this message in a reply
05-03-2024, 11:31 PM
Post: #16
RE: Fitting multiple RC time constants
(05-03-2024 03:03 PM)SlideRule Wrote:  
(05-03-2024 01:59 PM)KeithB Wrote:  Somehow, I imagine SlideRule's house to be full of stacks and stacks of old journals, indexes and periodicals. And when faced with a question like this goes straight to a particular stack and pulls out the correct document in a pile of a hundred or so...

close, but mixed with numerous hard drives, memory cards … of scanned books, pubs …

BEST! SlideRule

Just like my house!!!

:-)

Namir
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)