Author Topic: LTspice wont simulate a circuit with some component values  (Read 3510 times)

0 Members and 1 Guest are viewing this topic.

Online AnthocyaninaTopic starter

  • Frequent Contributor
  • **
  • Posts: 312
  • Country: 00
  • The Sara
LTspice wont simulate a circuit with some component values
« on: April 11, 2021, 12:30:13 pm »
I've been using LTspice for a few months now, it's simple and easy to use, so that's really nice, but i don't understand why some component values cause the simulation to not work. for example in thie circuit, i've been changing some values of resistors just to find one where it happens, since while designing this circuit i've had to use odd resistor values for it to show something in the simulation and it's getting annoying. In this case, R4, one value that doesn't work if 5400 ohm, but 5399 does work. (this is also the reason why i have R7 and R5  as milliohm and micro-ohm, because with a wire the simulation won't work, i'll just get a line on the left. Any idea what may be happening? this is getting incredibly annoying.
Thank you!
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6136
  • Country: ro
Re: LTspice wont simulate a circuit with some component values
« Reply #1 on: April 11, 2021, 01:01:59 pm »
Is there any error message?

Attach the .asc file of the two working/not working schematics, so others can run the simulation and try to debug it.

When the simulation end in an error, usually those are convergence problems.  SPICE simulations means matrix algebra, and sometimes trying to solve those matrix equations doesn't converge.  In SPICE there are some coefficients that fine tune the math behind matrix solving.

For a start, resets those settings to their default values (from Tools -> Control panel -> SPICE -> Reset to Default Values), and see if it starts working.  Most of the times the default values are working, sometimes they need manual adjustment.
« Last Edit: April 11, 2021, 02:02:48 pm by RoGeorge »
 
The following users thanked this post: Anthocyanina

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: LTspice wont simulate a circuit with some component values
« Reply #2 on: April 11, 2021, 01:53:44 pm »
Hi,

Two observations:

1) the coupling capacitors are HUGE for the frequency (5MHz) you are simulating with. Try reducing the values of C1-C4 to 1nF.

2) The transistor model for the 2N3866 is not included in the LTspice distribution. Where did you get the model for the 2N3866? Please attach the model if you share your .asc files.

Here is a quick model of the center amplifier:




It works fine.
I have embedded the transistor model in the .asc file.

The .asc file is attached.

Regards,
Jay_Diddy_B

* 2N3866 amp bjt.asc (2.96 kB - downloaded 118 times.)
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: LTspice wont simulate a circuit with some component values
« Reply #3 on: April 11, 2021, 02:27:57 pm »
Hi group,

I managed to reproduce the issue that was reported by Anthocyanina.




The issue is that are very few data points in the output, making it impossible to draw a graph. This is why you get 'empty' waveforms.

The problems is caused by the large time constant in the coupling capacitors in the model and the short analysis time.

The issue can be fixed by either:

1) Increase the simulation, 10us should work

or

2) set the maximum time step to 0.1us

or

3) reduce the value of the coupling capacitors.

I have attached my model.

Jay_Diddy_B

* 2N3866 amp bjt 2.asc (3.6 kB - downloaded 94 times.)
 
The following users thanked this post: Ian.M, RoGeorge

Online AnthocyaninaTopic starter

  • Frequent Contributor
  • **
  • Posts: 312
  • Country: 00
  • The Sara
Re: LTspice wont simulate a circuit with some component values
« Reply #4 on: April 11, 2021, 09:53:53 pm »
Is there any error message?

Attach the .asc file of the two working/not working schematics, so others can run the simulation and try to debug it.

When the simulation end in an error, usually those are convergence problems.  SPICE simulations means matrix algebra, and sometimes trying to solve those matrix equations doesn't converge.  In SPICE there are some coefficients that fine tune the math behind matrix solving.

For a start, resets those settings to their default values (from Tools -> Control panel -> SPICE -> Reset to Default Values), and see if it starts working.  Most of the times the default values are working, sometimes they need manual adjustment.

Hi! I don't get any error message, just with some values the simulation will only output one green line on the left. i have all the settings as default and resetting them didn't help. Thank you! here i attach the .asc and the 2n3866 model i used for this simulation is the one provided by digikey.
 

Online AnthocyaninaTopic starter

  • Frequent Contributor
  • **
  • Posts: 312
  • Country: 00
  • The Sara
Re: LTspice wont simulate a circuit with some component values
« Reply #5 on: April 11, 2021, 10:06:14 pm »
Hi,

Two observations:

1) the coupling capacitors are HUGE for the frequency (5MHz) you are simulating with. Try reducing the values of C1-C4 to 1nF.

2) The transistor model for the 2N3866 is not included in the LTspice distribution. Where did you get the model for the 2N3866? Please attach the model if you share your .asc files.

Here is a quick model of the center amplifier:

It works fine.
I have embedded the transistor model in the .asc file.

The .asc file is attached.

Regards,
Jay_Diddy_B

(Attachment Link)

Hi Jay! yes the capacitors are large for that frequency but i need this amplifier to work across a wide range of frequencies, from <1Khz to ~25MHz, if the capacitors are too small, the lower frequencies will be too attenuated. the 5MHz you see there was one of the frequencies i tested to see everything was working as expected (no clipping or too much distortion) that i can't see with the AC analysis option which just shows me magnitude and phase
Hi group,

I managed to reproduce the issue that was reported by Anthocyanina.

The issue is that are very few data points in the output, making it impossible to draw a graph. This is why you get 'empty' waveforms.

The problems is caused by the large time constant in the coupling capacitors in the model and the short analysis time.

The issue can be fixed by either:

1) Increase the simulation, 10us should work

or

2) set the maximum time step to 0.1us

or

3) reduce the value of the coupling capacitors.

I have attached my model.

Jay_Diddy_B


But if the problem is the time of the simulation, or the time constant, why does changing the value of a component by an insignificant amount make the simulation run correctly? I've also found out it's changing any value of any component after the simulation does run properly, like if i increase or decrease the 12 volt supply by a millivolt, it will work properly. Thank you!
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6136
  • Country: ro
Re: LTspice wont simulate a circuit with some component values
« Reply #6 on: April 11, 2021, 11:33:16 pm »
here i attach the .asc and the 2n3866 model i used for this simulation is the one provided by digikey.

You need to attach the model file too, or at least put a link to the exact file if you didn't attach it because of licensing reasons or else there is no guarantee others will download the same file as you have (for example from EU there are no models, I had to search on a NZ digikey site https://www.digikey.co.nz/product-detail/en/central-semiconductor-corp/2N3866-PBFREE/1514-2N3866PBFREE-ND/4806874 to find this one https://www.centralsemi.com/docs/csm/2N3866.LIB attached - delete the .txt part from the attached filename, that was added by me only because EEVblog forum does not allow .lib files to be attached).

Also, my request was for both .asc files, one for the working version and one for the not working version.

Anyway, it seems like you found some sort of bug.

To me it worked, but only at the first run, then it didn't work any more.   :-//
However, if I put minimum simulation step 0.01u, as Jay_Diddy_B suggested, it works just fine.
 
The following users thanked this post: Anthocyanina

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: LTspice wont simulate a circuit with some component values
« Reply #7 on: April 11, 2021, 11:37:36 pm »
Hi,

The issue with SPICE is that it solves all the equations for one operating point, to within a certain tolerance. It then jumps to a time in the future and tries to solve again, if it is successful it jumps again. If was unsuccessful it try a time point closer to the original. With some circuit it can jump solve the equations and miss some events.

By setting the maximum time step, you stop this from happening.

Amplifier Model

Take a look at this model:




I have made the following changes:

1) dc coupled three stages. This reduces the number of components and improves the frequency response.
2) replaced the first two transistors with low-cost 2N3904. Significant cost saving.
3) set the bandwidth from 400Hz to 30 MHz

The model is attached.

Regards,
Jay_Diddy_B

* 2N3866 amp bjt 3.asc (2.96 kB - downloaded 76 times.)
« Last Edit: April 11, 2021, 11:40:48 pm by Jay_Diddy_B »
 
The following users thanked this post: Anthocyanina

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6136
  • Country: ro
Re: LTspice wont simulate a circuit with some component values
« Reply #8 on: April 11, 2021, 11:52:56 pm »
The curious thing is first time it run OK with  ".tran 1u".
Then I changed R4 to 5399 and also run OK.
Then I changed again R4 to the innitial 5400, and from that moment it didn't work any more.   :-//

I've tried closing LTspice and deleting intermediary created file and still didn't work with 5400 and .tran 1u
The only way to make it work again with R4 5400 was to add a max timestep, ".tran 1u 0 0.01u".

I'm very sure I've seen it working once with 5400 and ".tran 1u", that is why I reminded OP I was requested for both working and not working versions of asc (after first run I thought OP uploaded the working .asc and typed that part of the reply).
« Last Edit: April 11, 2021, 11:56:12 pm by RoGeorge »
 

Online AnthocyaninaTopic starter

  • Frequent Contributor
  • **
  • Posts: 312
  • Country: 00
  • The Sara
Re: LTspice wont simulate a circuit with some component values
« Reply #9 on: April 11, 2021, 11:54:03 pm »
delete the .txt part from the attached filename, that was added by me only because EEVblog forum does not allow .lib files to be attached).

Also, my request was for both .asc files, one for the working version and one for the not working version.

Anyway, it seems like you found some sort of bug.

To me it worked, but only at the first run, then it didn't work any more.   :-//
However, if I put minimum simulation step 0.01u, as Jay_Diddy_B suggested, it works just fine.
Hi! i've attached the model i've used. i just copied the data into the standard.bjt file to be able to just select the transistor from the list. I've als attached the working .asc with 5399 ohms R4. I'm going to start adding minimum simulation steps and see if this goes away and i can start simulating with any value! Thank you!
 

Online AnthocyaninaTopic starter

  • Frequent Contributor
  • **
  • Posts: 312
  • Country: 00
  • The Sara
Re: LTspice wont simulate a circuit with some component values
« Reply #10 on: April 12, 2021, 12:01:51 am »
Hi,

The issue with SPICE is that it solves all the equations for one operating point, to within a certain tolerance. It then jumps to a time in the future and tries to solve again, if it is successful it jumps again. If was unsuccessful it try a time point closer to the original. With some circuit it can jump solve the equations and miss some events.

By setting the maximum time step, you stop this from happening.

Amplifier Model

Take a look at this model:

I have made the following changes:

1) dc coupled three stages. This reduces the number of components and improves the frequency response.
2) replaced the first two transistors with low-cost 2N3904. Significant cost saving.
3) set the bandwidth from 400Hz to 30 MHz

The model is attached.

Regards,
Jay_Diddy_B


Thank you Jay! it wasn't clear to me how SPICE ran the simulations. About your model, isn't the dc operating point too high? in the second stage at 8.4V the voltage swing without distortion will be about 3 volts peak instead of 4, no? I was aiming for 8Volts peak to peak at the output, Thanks again!
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2731
  • Country: ca
Re: LTspice wont simulate a circuit with some component values
« Reply #11 on: April 12, 2021, 12:23:26 am »
Hi,



Thank you Jay! it wasn't clear to me how SPICE ran the simulations. About your model, isn't the dc operating point too high? in the second stage at 8.4V the voltage swing without distortion will be about 3 volts peak instead of 4, no? I was aiming for 8Volts peak to peak at the output, Thanks again!

No Extra Charge  ;)





Model is attached.

Jay_Diddy_B

* 2N3866 amp bjt 4.asc (3.02 kB - downloaded 87 times.)
 
The following users thanked this post: Anthocyanina

Online AnthocyaninaTopic starter

  • Frequent Contributor
  • **
  • Posts: 312
  • Country: 00
  • The Sara
Re: LTspice wont simulate a circuit with some component values
« Reply #12 on: April 12, 2021, 01:05:30 am »
Hi,



Thank you Jay! it wasn't clear to me how SPICE ran the simulations. About your model, isn't the dc operating point too high? in the second stage at 8.4V the voltage swing without distortion will be about 3 volts peak instead of 4, no? I was aiming for 8Volts peak to peak at the output, Thanks again!

No Extra Charge  ;)

(Attachment Link)



Model is attached.

Jay_Diddy_B

(Attachment Link)

Thank you very much! this looks like it will work perfectly for what i need it  :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf