Importing models into LTSpice for LM358 circuit.

Thread Starter

NICK318

Joined Aug 29, 2017
1
Hi I'm a beginner to ltspice. I have quite same problem. I want to import LM358 into my schematic. I've followed Ron H advice from this thread https://forum.allaboutcircuits.com/threads/importing-models-into-ltspice.36456/ but cannot simulate the circuit?
I also increase the trtol to 7..but still same. By cannot simulate, I mean, it shows this at the left bottom. And the probe doesnt come out. The plot window also does not come out. If I use existing opamp, can simulate.
Anyone can help me here?


Mods Note:
Please don't hijack other member's thread.
This thread was split from Importing models into LTSpice, time step too small error.
 

Attachments

wayneh

Joined Sep 9, 2010
17,496
I want to import LM358 into my schematic.
Which model for the LM358 are you trying? I use the file called "LM258 PSPICE MODEL.MOD" which I think I got from TI but I don't remember. You than need to place that file in the folder with your model and place an include statement (spice directive) in your simulation: ".incude LM258 PSPICE MODEL.MOD". Then you edit the details of the op-amp to tell it to use the LM358.

For what it's worth, I do have problems from time to time with the LM358 model not working. It gives endless iterations. In some simulations it gets done "instantly" and other times I cannot get it to work. I haven't figured out a reliable solution.
 
Last edited:

wayneh

Joined Sep 9, 2010
17,496
So do I. Likewise the LM324 model (LM358 and LM324 should be very similar in function). Multiple instances of either on a schematic seem to crash the sim.
Oddly, one of the most complex circuits I've simulated works great, but I just slapped together a simple square wave oscillator and it won't run.
 

Attachments

Alec_t

Joined Sep 17, 2013
14,280
Well that oscillator circuit seems to be the exception to the rule. I don't have the Pspice model file, but the sim runs fine using the LM358 model file I have!!
 

wayneh

Joined Sep 9, 2010
17,496
Well that oscillator circuit seems to be the exception to the rule. I don't have the Pspice model file, but the sim runs fine using the LM358 model file I have!!
Well now of course I want whatever model you're using. I've tried every other one I can find but so far that one is the only one I can get working at all, just not for that particular simulation.
 

Alec_t

Joined Sep 17, 2013
14,280
So between the two of us we should be able to run a bunch of sims :).
Here's the .sub file. It works with your .asy file. All I did was change the directive in your .asc sim to include LM358.sub.
 

Attachments

wayneh

Joined Sep 9, 2010
17,496
So between the two of us we should be able to run a bunch of sims :).
Here's the .sub file. It works with your .asy file. All I did was change the directive in your .asc sim to include LM358.sub.
Works perfectly! Where does that model come from?
 

eetech00

Joined Jun 8, 2013
3,859
Oddly, one of the most complex circuits I've simulated works great, but I just slapped together a simple square wave oscillator and it won't run.
Hi

Like any oscillator simulation, its recommended to place an "initial condition" directive in the circuit to ensure the oscillator will start.
Otherwise, the simulator engine may( or may not, depending on the circuit) spend an eternity attempting to converge.
You can specify IC=0 in the symbol file attribute field to set an initial condition. Or you can place it on the schematic and specify a node voltage.

You didn't supply the model file with the schematic. So I tested using both an LM258.MOD and LM358.MOD model file and placed an IC statement in the symbol of the timing capacitor C1. Both simulations took about 0.620 seconds to complete

.
 

Attachments

wayneh

Joined Sep 9, 2010
17,496
... I tested using both an LM258.MOD and LM358.MOD model file and placed an IC statement in the symbol of the timing capacitor C1.
Sorry to be dense but how exactly do you do that?

I've attached my simulation that does NOT work because it uses the LM358 model I obtained - I think - from ONSemi. This runs nicely if I instead use your LM358.sub file.
 

Attachments

wayneh

Joined Sep 9, 2010
17,496
The ones I have are from TI website..
I have not been able to get the TI models to work in LTspice. Can you elaborate on exactly what you use?

update – I stand corrected. The LM358.101 file from TI works fine. I think I had neglected to place a copy in the same folder with my simulation. Cool!
 
Last edited:

eetech00

Joined Jun 8, 2013
3,859
I have not been able to get the TI models to work in LTspice. Can you elaborate on exactly what you use?

update – I stand corrected. The LM358.101 file from TI works fine. I think I had neglected to place a copy in the same folder with my simulation. Cool!
Glad you got it working.

To place an IC=0 directive in the symbol, point to the symbol, when the cursor changes to a pointing hand ctl+rht-clk the symbol. This should open the attribute field window for the symbol. Type IC=0 in the Value2 or Spiceline fields, then click ok. There is a"visibity" field at the right end that will make the value visible if checked.
 
Last edited:

wayneh

Joined Sep 9, 2010
17,496
Glad you got it working.

To place an IC=0 directive in the symbol, point to the symbol, when the cursor changes to a pointing hand ctl+rht-clk the symbol. This should open the attribute field window for the symbol. Type IC=0 in the Value2 or Spiceline fields, then click ok. There is a"visibity" field at the right end that will make the value visible if checked.
FWIW, that did not fix the problem I have when using the LM258 PSPICE MODEL.MOD file. Now that I have other LM358 models that work, I guess I don't care about fixing that one.
 

eetech00

Joined Jun 8, 2013
3,859
FWIW, that did not fix the problem I have when using the LM258 PSPICE MODEL.MOD file. Now that I have other LM358 models that work, I guess I don't care about fixing that one.
Hmm.Then you probably have a bad LM258 model. The one I have converged quickly.
 
Top