# Model identification for Cauer or Foster model

**URL:** https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767
**Category:** General Usage
**Tags:** question, modelling, identification
**Created:** [September 4, 2022, 5:45pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767 "2022-09-04T17:45:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [September 4, 2022, 5:45pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/1 "2022-09-04T17:45:07Z")

</div>

How can I identify the parameters of the Cauer or Foster model based on a measured temperature over time curve?

 ![Thermal](https://global.discourse-cdn.com/julialang/original/3X/b/6/b6bbc036b47f1d527b1c1d48d31324e54c32e3a3.png)  
Source: [Infineon application note](https://www.infineon.com/dgdl/Infineon-Thermal_equivalent_circuit_models-ApplicationNotes-v01_02-EN.pdf?fileId=db3a30431a5c32f2011aa65358394dd2)

The application note says: “as the coefficients can easily be extracted from a measured cooling curve”… But how can I do that using Julia?

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [September 4, 2022, 6:12pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/2 "2022-09-04T18:12:27Z")

</div>

I mean, I could create a model as described here: [Thermal Conduction Model · ModelingToolkitStandardLibrary.jl](http://mtkstdlib.sciml.ai/dev/tutorials/thermal_model/) But what I need is the parameter estimation…

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [September 4, 2022, 7:21pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/3 "2022-09-04T19:21:04Z")

</div>

My guess is that you have to set up an optimization problem with the capacitances and resistances as the unknowns. The objective function will be the difference between the measured response and that predicted from the circuit model with the given parameter values.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [September 4, 2022, 7:47pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/4 "2022-09-04T19:47:41Z")

</div>

Well, this might work, but is probably not the easiest/ best way. This library cannot be used?

> **[GitHub - baggepinnen/ControlSystemIdentification.jl: System Identification...](https://github.com/baggepinnen/ControlSystemIdentification.jl)**
>
> System Identification toolbox for LTI systems, compatible with ControlSystems.jl - GitHub - baggepinnen/ControlSystemIdentification.jl: System Identification toolbox for LTI systems, compatible wit...

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [September 4, 2022, 8:12pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/5 "2022-09-04T20:12:12Z")

</div>

You’re right. That looks like a much better approach.

---

<div class="post-metadata">

### Author: ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)
#### Post date: [September 5, 2022, 6:01am UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/6 "2022-09-05T06:01:16Z")

</div>

In my previous job I had to work with Foster/Cauer models for circuits. I am going to explain what I did, although it may not apply to your case.

My models were purely reactive (only LC elements in the Foster/Cauer model) and thus it had resonances (singularities), which made it very difficult/impossible to extract the parameters from a curve fitting tool. I got the results from a numerical simulation in terms of an [S-Matrix](https://en.wikipedia.org/wiki/Scattering_parameters) in the frequency domain. I transformed it to a [Z-matrix](https://en.wikipedia.org/wiki/Impedance_parameters) and worked from there.

First, I extracted an initial guess for the pole locations using Foster reactance theorem and transformations back and forth between admittance and impedance form. When I had the initial values, I created a function that calculated the immittance (admittance/impedance) with them. Then, I created another function that transformed the immittance of the two-port network back to an S-matrix, and created a cost function based on the [Frobenius norm](https://en.wikipedia.org/wiki/Matrix_norm) of the difference between my data and my model:

```julia
S # original S-matrix
Ŝ # reconstruction from model
f(x) = norm(S(x) - Ŝ(x))

```

This function is then fed to a global optimizer with the appropriate parameters and, some time later, voilà.

## In your case

First you need to know the exact number of terms needed in your Foster series. These may come from an analytical expression or you may have to perform several guesses.

If you want to work on the time domain, create initial guesses for your coefficients (r\_i, tau\_i) and create a function that accepts a vector of these and evaluates the expression on your time points.

Then create a cost function using the norm of the difference between your data vectors (original and estimation).

Feed these to the global optimizer.

Maybe you could work directly with curve fitting packages, but since it did not work for me I cannot say how they work.

My package is here: [https://github.com/nandoconde/BranchLineCouplers.jl](https://github.com/nandoconde/BranchLineCouplers.jl)  
Explore it at will

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [September 5, 2022, 5:43pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/7 "2022-09-05T17:43:57Z")

</div>

I mean, you find papers that describe very advanced approaches on this problem, e.g. [https://www.jstage.jst.go.jp/article/nolta/11/2/11\_157/\_pdf/-char/en](https://www.jstage.jst.go.jp/article/nolta/11/2/11_157/_pdf/-char/en) …  
But I try to find the simple, basic algorithm… Lots of papers about improved algorithms, but none about the basics…

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [September 5, 2022, 6:29pm UTC](https://discourse.julialang.org/t/model-identification-for-cauer-or-foster-model/86767/8 "2022-09-05T18:29:13Z")

</div>

I took a look at the package you mentioned previously, ControlSystemIdentification.jl. I think I understand in general how you want to proceed. You provide the time-domain input and output functions. Your output function is your “cooling curve”. The input is going to be something like a reverse step function (i.e., hot temperature is applied from time = -infinity to zero, then is turned off at time zero.) You will have to research the exact form depending on exactly how the ‘cooling curve’ is defined. These functions are provided as inputs to one of the functions listed [here](https://baggepinnen.github.io/ControlSystemIdentification.jl/stable/tf/#Time-series-modeling). The output will be a transfer function which is a rational function. The poles and residues of this rational function can be obtained from `residues` function of the `Polynomials` package. The poles are the (inverse) time constants and the residues are the resistances of the so-called “partial fraction” circuit.

I think this is correct in broad strokes. Of course the devil is in the details 😉
