LTspice - problem with definition of parameter - Page 1
Forum section: electronics / general

author: Roveniki
author_rank: Newbie
timestamp: March 09, 2018, 11:02:56 am
content: Hello.I am trying to make current dependent inductor in ltspice according my mesurements. How can I use for definiotn of any parameter measured value?If anyone can help me I would really appreciate it.Thanks

author: Ian.M
author_rank: Super Contributor
timestamp: March 09, 2018, 12:22:10 pm
content: LTspice .param statements are evaluated ONCE before the simulation run starts. They cannot contain any expression that involves dynamic variables (e.g, node voltages, currents, time etc.)If you need a user-defined expression using dynamic variables you can use a .func statement, either with empty parameters () or with a parameter list if you want per-instance control when you use it.However it is possible to directly specify a behavural inductor component using a special LTspice syntax in terms of the instantanious flux. Seehttp://ltwiki.org/index.php5?title=The_Arbitrary_Inductor_modelI've knocked together a three part example for you:based on the LTwiki example, but with the unity dI/dt current source bug-fixed*and the max current and sim time parameterised.current dependent inductor (using I1 from part 1), with 1mA AC exitation.simple fixed inductor but in behavioral syntax, also with 1mA AC excitation.* The duration of the unity dI/dt ramp in the LTwiki example netlist didn't match the simulation length.

author: Roveniki
author_rank: Newbie
timestamp: March 09, 2018, 01:21:05 pm
content: Thank you for your respond. I want to define dependance of indtuctance on current according measurements. After interpolation I get curve: y = 2E-11x2- 3E-09x + 1E-06 where y is Indtuctance of ferit coil and x is Current trough coil. I do not want to describe saturation or anything concenrnig Imax. I measured current from 60mA to 200mA what is sufficient for my application. Can you give me any advice how to sort it out?Thank you again.

author: Ian.M
author_rank: Super Contributor
timestamp: March 09, 2018, 02:54:41 pm
content: Behavioural inductors aren't just for handling saturation.You saw example 2 which was an inductor dependent on an arbitary current, amd exampe 3:flux=0.33*xwhich is equivalent to a fixed 330mH inductor. So all you need to do is multiply your equation for the inductance by x to get the flux:flux=(2E-11*x*x - 3E-09*x + 1E-06)*x

author: Roveniki
author_rank: Newbie
timestamp: March 12, 2018, 10:32:15 am
content: Dear Ian.M thank you very much!!!Now I get it, so I can carry on to solve other tasks.Have a nice day.

author: Roveniki
author_rank: Newbie
timestamp: March 13, 2018, 12:27:09 pm
content: Hi Ian.M,at first sight it looks like it really works so I was very happy but now I realize that it does not work properly. I compare it with other fixed inductor 1uH and they are the same even when I use definition of flux=(2E-11*x*x - 3E-09*x + 1E-06)*x - this expression should vary according to current, but it is always the same. By resistor in front of inductor I change the value of current and no matter the value of inductance it is always 1uH. Can you help me with this problem?Thank you in advance.

author: Ian.M
author_rank: Super Contributor
timestamp: March 13, 2018, 05:59:53 pm
content: I assure you it does vary, however your coefficients only produce a 0.3% variation in inductance between 0 and 1A.I've attached a zipped sim and plot with your behavioural inductor and a fixed 1uH inductor in series (with ground in between) that clearly shows the difference with 1KHz excitation and the DC current sweeping between 0 and 5A.

author: Roveniki
author_rank: Newbie
timestamp: March 14, 2018, 01:37:59 pm
content: After reading your message about 0.3% variation I realized that something is wrong with my polynomial because I made measurements for 4 currents and it definately varies more (see attached file) so I recount polynomial and it should be current now. Anyway when I try to make AC analysis it behaves like 1uH inductor (also in attached file) but it should varies around 1.2uH.

author: Ian.M
author_rank: Super Contributor
timestamp: March 15, 2018, 12:59:28 am
content: Don't expect a behavioural inductor to work as you think it should in a .ac analysis.LTspice does an .op operating point analysis to get the DC conditions then fixes the inductor at whatever value the .op analysis + its flux equation gives:Quote from: LTspice helpBehavioural instances of Sources, Resistors, Capacitors and Inductors only 'do their thing' dynamically in a .tran transient analysis.Also the PULSE() voltage sources will use their initial value of 0V in the .op analysis so even if there weren't capacitors blocking DC through the inductors from the voltage source, you still wouldn't see any difference unless you add a true DC bias current through the inductors.See attached sim and plot. Edit.param Ibias 10mAto add/remove bias current.

author: Roveniki
author_rank: Newbie
timestamp: April 04, 2018, 07:38:22 am
content: Dear Ian.M sorry for late response, thank you very much, you helped me a lot!

author: Ian.M
author_rank: Super Contributor
timestamp: April 04, 2018, 08:01:21 am
content: You are welcome.Whoops, I just spotted I missed the {} braces around the value of I2 in the zipped sim from reply#8. I assume you figured out what was wrong and fixed it, but for future readers, edit the value of I2 to be:{Ibias}before running the sim.

author: Roveniki
author_rank: Newbie
timestamp: April 04, 2018, 08:06:42 am
content: Yes I figure it out, at least I can sort out something without helpNow I am working on variable resistor, hope I can solve it soon.Have a nice day.

author: Ian.M
author_rank: Super Contributor
timestamp: April 04, 2018, 08:36:24 am
content: For parameter controlled potentiometers in LTspice, seehttps://www.eevblog.com/forum/eda/is-there-an-updated-massive-open-source-style-library-for-ltspice/If you need it to be voltage or current controlled, you'll have to roll your own, probably with a behavioural resistor.