Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Optimization with external simulator (SPICE)?

Subject: Optimization with external simulator (SPICE)?

From: Jens Benecke

Date: 1 Nov, 2005 15:40:36

Message: 1 of 6

Hello everybody,

I have a circuit simulator (SPICE) that runs a high frequency model of an
electrical device. I want to tune the parameters of this model to fit my
measurements. I am considering using the Optimization toolbox for this.
Basically I have two sets of frequency dependant variables m(f) and s(f),
and I need to tune about 20 variables (values of resistors, capacitors,
etc) within quite restrictive constraints (factor 10 at most) so that

        || m(f) - s(f) ||² == min

All circuit elements are linear, within certain limits. Just R, L, C.

Normally this would be simple (using \), however s(f) can only be provided
with an external circuit simulator (SPICE in this case), it is too
complicated to be formulated mathematically.

So I need to find a way to make the Matlab optimizer decide on the values
for the next iteration, but perform the actual calculation of s(f) by an
external program (and then read the external program's output file).

The idea is:
        Matlab decides on initial values for all variables
        Matlab writes SPICE netlist with those values
        Matlab calls SPICE simulator
        Matlab reads results
... loop until max iterations or required min. difference reached

My ultimate goal is to do this with m(f) and s(f) being matrices instead of
vectors, considering multiple "versions" of the circuit with different m(f)
and parameter constraints for each one (e.g. one circuit with filter, one
without filter), and running seperate external simulations for each one.


Any ideas? Is this possible with the opt. toolbox? Is it feasible? CPU power
and RAM is not the problem (I can order a new 8GB Dual Opteron if that's
what it takes). But I would like to have an idea whether Matlab is the
right tool for this at all beforehand. :-)


Thank you!


--
Jens Benecke

Subject: Optimization with external simulator (SPICE)?

From: Marcelo Marazzi

Date: 1 Nov, 2005 12:43:36

Message: 2 of 6

If you can invoke the simulator as a callable library,
then you can try to call it from within your MATLAB
objective function.

See the MATLAB External Interfaces section in the doc:
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/

-marcelo

Jens Benecke wrote:
> Hello everybody,
>
> I have a circuit simulator (SPICE) that runs a high frequency model of an
> electrical device. I want to tune the parameters of this model to fit my
> measurements. I am considering using the Optimization toolbox for this.
> Basically I have two sets of frequency dependant variables m(f) and s(f),
> and I need to tune about 20 variables (values of resistors, capacitors,
> etc) within quite restrictive constraints (factor 10 at most) so that
>
> || m(f) - s(f) ||² == min
>
> All circuit elements are linear, within certain limits. Just R, L, C.
>
> Normally this would be simple (using \), however s(f) can only be provided
> with an external circuit simulator (SPICE in this case), it is too
> complicated to be formulated mathematically.
>
> So I need to find a way to make the Matlab optimizer decide on the values
> for the next iteration, but perform the actual calculation of s(f) by an
> external program (and then read the external program's output file).
>
> The idea is:
> Matlab decides on initial values for all variables
> Matlab writes SPICE netlist with those values
> Matlab calls SPICE simulator
> Matlab reads results
> ... loop until max iterations or required min. difference reached
>
> My ultimate goal is to do this with m(f) and s(f) being matrices instead of
> vectors, considering multiple "versions" of the circuit with different m(f)
> and parameter constraints for each one (e.g. one circuit with filter, one
> without filter), and running seperate external simulations for each one.
>
>
> Any ideas? Is this possible with the opt. toolbox? Is it feasible? CPU power
> and RAM is not the problem (I can order a new 8GB Dual Opteron if that's
> what it takes). But I would like to have an idea whether Matlab is the
> right tool for this at all beforehand. :-)
>
>
> Thank you!
>
>

Subject: Optimization with external simulator (SPICE)?

From: Marcus M. Edvall

Date: 1 Nov, 2005 18:03:31

Message: 3 of 6

Hi Jens,

TOMLAB /CGO is specifically designed for costly global black-box
optimization. What's the time for one objective function evaluation?

 <http://tomlab.biz/products/cgo/>
 <http://tomlab.biz/products/cgo/solvers/rbfSolve.php>
 <http://tomlab.biz/products/cgo/solvers/ego.php>

Best wishes, Marcus
Tomlab Optimization Inc.
 <http://tomlab.biz>

Jens Benecke wrote:
>
>
> Hello everybody,
>
> I have a circuit simulator (SPICE) that runs a high frequency model
> of an
> electrical device. I want to tune the parameters of this model to
> fit my
> measurements. I am considering using the Optimization toolbox for
> this.
> Basically I have two sets of frequency dependant variables m(f) and
> s(f),
> and I need to tune about 20 variables (values of resistors,
> capacitors,
> etc) within quite restrictive constraints (factor 10 at most) so
> that
>
> || m(f) - s(f) ||² == min
>
> All circuit elements are linear, within certain limits. Just R, L,
> C.
>
> Normally this would be simple (using \), however s(f) can only be
> provided
> with an external circuit simulator (SPICE in this case), it is too
> complicated to be formulated mathematically.
>
> So I need to find a way to make the Matlab optimizer decide on the
> values
> for the next iteration, but perform the actual calculation of s(f)
> by an
> external program (and then read the external program's output
> file).
>
> The idea is:
> Matlab decides on initial values for all variables
> Matlab writes SPICE netlist with those values
> Matlab calls SPICE simulator
> Matlab reads results
> ... loop until max iterations or required min. difference reached
>
> My ultimate goal is to do this with m(f) and s(f) being matrices
> instead of
> vectors, considering multiple "versions" of the circuit with
> different m(f)
> and parameter constraints for each one (e.g. one circuit with
> filter, one
> without filter), and running seperate external simulations for each
> one.
>
>
> Any ideas? Is this possible with the opt. toolbox? Is it feasible?
> CPU power
> and RAM is not the problem (I can order a new 8GB Dual Opteron if
> that's
> what it takes). But I would like to have an idea whether Matlab is
> the
> right tool for this at all beforehand. :-)
>
>
> Thank you!
>
>
> --
> Jens Benecke
>

Subject: Optimization with external simulator (SPICE)?

From: Jens Benecke

Date: 2 Nov, 2005 09:48:07

Message: 4 of 6

Marcus M. Edvall wrote:

> Hi Jens,

Hi!
 
> TOMLAB /CGO is specifically designed for costly global black-box
> optimization. What's the time for one objective function evaluation?

A couple seconds only (~10).
But I have no idea how many iterations I will need. Maybe thousands.

The problem is that I need to implement this myself since this is supposed
to become part of my thesis. So I probably cannot use your product. I would
be grateful for any hints as to whether the opt. toolbox in Matlab is
suitable for this or what other algorithms are useable.

Thank you :-)


--
Jens Benecke
http://www.hitchhikers.de - Europas kostenlose Mitfahrzentrale seit 1998
http://www.rb-hosting.de - Webhosting mit Extras - PHP ab ¤9 - SSH ab ¤19
http://www.spamfreemail.de - 100% saubere Postfächer, garantiert!

Subject: Optimization with external simulator (SPICE)?

From: Jens Benecke

Date: 2 Nov, 2005 10:24:30

Message: 5 of 6

Marcelo Marazzi wrote:

> If you can invoke the simulator as a callable library,
> then you can try to call it from within your MATLAB
> objective function.

Hello,

I can invoke the simulator as an external executable, but not as a callable
library (AFAIK).
 
> See the MATLAB External Interfaces section in the doc:
> http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/

Thanks for the pointer, I'll try this!


--
Jens Benecke
http://www.hitchhikers.de - Europas kostenlose Mitfahrzentrale seit 1998
http://www.rb-hosting.de - Webhosting mit Extras - PHP ab ¤9 - SSH ab ¤19
http://www.spamfreemail.de - 100% saubere Postfächer, garantiert!

Subject: Optimization with external simulator (SPICE)?

From: Sandeep Sulakhe

Date: 14 Jul, 2013 07:52:07

Message: 6 of 6

Jens Benecke <jens@spamfreemail.de> wrote in message <3spd34Fpff0rU1@news.dfncis.de>...
> Hello everybody,
>
> I have a circuit simulator (SPICE) that runs a high frequency model of an
> electrical device. I want to tune the parameters of this model to fit my
> measurements. I am considering using the Optimization toolbox for this.
> Basically I have two sets of frequency dependant variables m(f) and s(f),
> and I need to tune about 20 variables (values of resistors, capacitors,
> etc) within quite restrictive constraints (factor 10 at most) so that
>
> || m(f) - s(f) ||² == min
>
> All circuit elements are linear, within certain limits. Just R, L, C.
>
> Normally this would be simple (using \), however s(f) can only be provided
> with an external circuit simulator (SPICE in this case), it is too
> complicated to be formulated mathematically.
>
> So I need to find a way to make the Matlab optimizer decide on the values
> for the next iteration, but perform the actual calculation of s(f) by an
> external program (and then read the external program's output file).
>
> The idea is:
> Matlab decides on initial values for all variables
> Matlab writes SPICE netlist with those values
> Matlab calls SPICE simulator
> Matlab reads results
> ... loop until max iterations or required min. difference reached
>
> My ultimate goal is to do this with m(f) and s(f) being matrices instead of
> vectors, considering multiple "versions" of the circuit with different m(f)
> and parameter constraints for each one (e.g. one circuit with filter, one
> without filter), and running seperate external simulations for each one.
>
>
> Any ideas? Is this possible with the opt. toolbox? Is it feasible? CPU power
> and RAM is not the problem (I can order a new 8GB Dual Opteron if that's
> what it takes). But I would like to have an idea whether Matlab is the
> right tool for this at all beforehand. :-)
>
>
> Thank you!
>
>
> --
> Jens Benecke
Hi did you solved this problem ??? I am also struck at this point and want guidance, can we use inbuilt optimazation toolbox in matlab???
Thanks and regards

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us