Author Topic: Need help: INA193 in ngspice-30  (Read 1469 times)

0 Members and 1 Guest are viewing this topic.

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Need help: INA193 in ngspice-30
« on: August 30, 2019, 11:15:57 pm »
Hi,

I'm trying to simulate an INA193 in ngspice-30. I got the pspice model from the TI website and tried to convert it to ngspice.

ngspice doesn't have TEMP so I added a .PARAM TEMP=27 at places where it was needed.
I also replaced VSWITCH with ASWITCH according to the ngspice user manual.

ngspice then complained about this construct:

VCCVS4_in   42 2

I found some posting on the TI E2E forum suggesting to add a '0' as the third parameter, which I did.

Lastly, the resistor model in ngspice is called "R" not "RES", I changed that, too.

Unfortunately, still no luck. The output is always 0V.

I've attached the modified INA193.LIB and a simple test netlist for ngspice.

Maybe someone more experienced can help me out?

Everybody likes gadgets. Until they try to make them.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Need help: INA193 in ngspice-30
« Reply #1 on: August 31, 2019, 01:18:03 am »
I took a look. First, your test circuit doesn't look right. Apparently you're loading the output of the INA193 with a 1 ohm resistor? It's not going to like that much. ;D
Then, the load supply (couldn't see it?) and load current source (seems weirdly connected), that doesn't look right. I see it's generated from KiCad, dunno if it's a problem with KiCad or with your schematic. You could maybe post a picture of it.

That said, I fixed the test circuit, and still get 0V exactly at the output. Can't figure out what's wrong with the model, but it clearly is borked. It's not 100% Spice compatible. We can see it's been designed for Tina, and frankly I have already run into TI models (especially the more recent ones) that I couldn't figure out how to use in ngspice or LTSpice... I did the same as you tried to fix them, and had no luck.

 
The following users thanked this post: thinkfat

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Need help: INA193 in ngspice-30
« Reply #2 on: August 31, 2019, 07:06:49 am »
Thanks for having a look. Yes, I noticed that the current source is upside down and also about the 1 ohm resistor, corrected netlist is attached. I also attached a screenshot of the circuit. It's really the most basic thing I could come up with.
Everybody likes gadgets. Until they try to make them.
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Need help: INA193 in ngspice-30
« Reply #3 on: August 31, 2019, 11:35:27 am »
Small progress: I found out that ngspice has a "limit" function that is incompatible with pspice' "LIMIT"  >:(

replacing that with a compatible "ps_limit" gives me a constant 4mV out  :-DD
Everybody likes gadgets. Until they try to make them.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Need help: INA193 in ngspice-30
« Reply #4 on: August 31, 2019, 12:33:24 pm »
On a broader note; what are you trying to learn from the model?  Are you simulating the behavior of a larger circuit and only need this for its normal functionality (a high-CMRR amp of nominal gain and bandwidth)?  Or are you testing the part itself, for function under somewhat unusual conditions and would like to evaluate the model under these conditions?

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Need help: INA193 in ngspice-30
« Reply #5 on: August 31, 2019, 01:21:35 pm »
On a broader note; what are you trying to learn from the model?  Are you simulating the behavior of a larger circuit and only need this for its normal functionality (a high-CMRR amp of nominal gain and bandwidth)?  Or are you testing the part itself, for function under somewhat unusual conditions and would like to evaluate the model under these conditions?

Tim

I'm trying to come up with a current limiting for my power supply, I did have a something with a difference amplifier and a comparator made from a dual opamp, but it has terrible CMRR and temperature drift. I'm trying to get the whole power supply simulated before I actually build it.
Everybody likes gadgets. Until they try to make them.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Need help: INA193 in ngspice-30
« Reply #6 on: August 31, 2019, 02:16:01 pm »
Low side sensing not practical..?

To play with limiting and compensation of the '723, it should at least be okay to use a fixed gain amplifier (which can be a couple dependent sources and an RC or two to set frequency response and phase).  I don't foresee any nasty problems within the range you'll be using it.  But yeah it's always nice to have at least a little verification from a more fleshed out model.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Need help: INA193 in ngspice-30
« Reply #7 on: September 01, 2019, 07:23:52 am »
I'm not so worried about static behaviour, that I'd not need to simulate the circuit for, but I had some pretty weird effects when simulating load changes, the whole circuit got into oscillation.
Everybody likes gadgets. Until they try to make them.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Need help: INA193 in ngspice-30
« Reply #8 on: September 01, 2019, 08:42:25 am »
Yeah, keywords there being the RC to set frequency response.  This should be derivable from the datasheet.  As for pathological edge cases, who knows, they probably didn't put those in their own model either.

I don't much like the switches or nonlinear dependent functions in the model, but I'd have to poke at it for some time to see if there's anything funny with it in my environment, and I don't know about ngspice specifically...

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Need help: INA193 in ngspice-30
« Reply #9 on: September 01, 2019, 09:18:03 pm »
After some more tinkering, I have the model working in ngspice now. See the attached file.
Everybody likes gadgets. Until they try to make them.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Need help: INA193 in ngspice-30
« Reply #10 on: September 01, 2019, 09:30:39 pm »
Huh, what is "temper"?

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline thinkfatTopic starter

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Need help: INA193 in ngspice-30
« Reply #11 on: September 01, 2019, 09:46:58 pm »


Huh, what is "temper"?

Apparently the equivalent of pspice' TEMP.

Gesendet von meinem Nokia 6.1 mit Tapatalk

Everybody likes gadgets. Until they try to make them.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3382
  • Country: gb
Re: Need help: INA193 in ngspice-30
« Reply #12 on: September 01, 2019, 10:09:28 pm »
Huh, what is "temper"?

Tim

It's what trying to convert spice models gives you. :)
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Need help: INA193 in ngspice-30
« Reply #13 on: September 01, 2019, 10:13:34 pm »
Nice job. The model is the 20V/V version apparently.
Note that this has a large non-linearity for low Vsense values. Thus the datasheet states all params for Vsense >= 20mV...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf