Author Topic: LTSpice Thread  (Read 4136 times)

0 Members and 1 Guest are viewing this topic.

Offline yadaTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 264
  • Country: ca
LTSpice Thread
« on: May 03, 2017, 01:07:16 am »
So I made a multi vibrator circuit in spice. How do I use spice to see if it actually works? To make things simple I used a design that I know works in real life. Ultimately I want to be able to use this to test those impossibly hard RF circuits I keep trying to build.

All values are entered. I know there a online simulator where you can see the current run through your circuit as green/red dots, when you see the dots move you kind of know its working. I'm guessing that program is based off spice, but how do I tell the spice simulator what I want it to do?
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 28379
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: LTSpice Thread
« Reply #1 on: May 03, 2017, 01:19:46 am »
So I made a multi vibrator circuit in spice. How do I use spice to see if it actually works? To make things simple I used a design that I know works in real life. Ultimately I want to be able to use this to test those impossibly hard RF circuits I keep trying to build.

All values are entered. I know there a online simulator where you can see the current run through your circuit as green/red dots, when you see the dots move you kind of know its working. I'm guessing that program is based off spice, but how do I tell the spice simulator what I want it to do?
There's some guidance in the videos linked in this thread:
https://www.eevblog.com/forum/beginners/circuit-simulation-(sticky)/
Avid Rabid Hobbyist
Siglent Youtube channel: https://www.youtube.com/@SiglentVideo/videos
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: LTSpice Thread
« Reply #2 on: May 03, 2017, 02:29:16 am »
LTspice doesn't do any of that animated s--t.   Its designed by professional engineers for professional engineers, and one of the requirements in such an environment is that all results shall be repeatable.  Runtime user interaction isn't repeatable as any small change in the simulation speed or user's reaction time would result in different results.   What you can do is script external events using stuff like controlled switches and sources and behavioural  R, L, C passives, including pulling data for a source from an external file, and measure component currents and node voltages at specific times in the simulation or when specific criteria are met.   That's the way engineers like it - email a schematic to a colleague, and provided they have the same models installed, they will get the same results you did.
Its also got a waveform viewer which can display any node voltage or component current or complicated calculated functions of one or many voltages or currents.   For convenience it can also display multimeter-like results on the schematic (as unadorned numbers) calculated for the DC operating point.  Unfortunately it cant do the same with measured results so there is no way of displaying the voltage at time t on the schematic.

SPICE in general is extremely clumsy for RF work as it takes no account whatsoever of circuit layouts and electromagnetic interactions other than explicitly coupled inductors. If you want to model RF circuits accurately you are going to spend a lot of time calculating and/or measuring the parasitics from the physical board layout then, for each node or interconnect entering them as SPICE components on the schematic.


TLDR: If you want animation and interactivity, or easy RF circuit modelling, look elsewhere for your simulation 'fix'.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: LTSpice Thread
« Reply #3 on: May 03, 2017, 06:17:44 pm »
One thing to note is that LTSpice may fail, if a circuit is too symmetrical.

For example, attached is an example of a two transistor, astable multivibrator. It will work if you build it in real life but the attached file will not simulate because either side of the astable is exactly the same. If one of the resistor or capacitor values is changed, so it's slightly different to the other side, then it'll work.



The attached file is based on the one included in the LTSpices examples folder. The working circuit can be found in LTSpice/Examples/educational/astable.asc
« Last Edit: May 03, 2017, 06:19:22 pm by Hero999 »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: LTSpice Thread
« Reply #4 on: May 03, 2017, 06:39:42 pm »
Give it a bit longer - I tried .tran 50m startup and it started for me. YMMV as your LTspice installation may be at a different release.

Its vanishingly unlikely that a real circuit will be that symmetrical, but if you take the case of a bistable, you could start with well matched parts then tweak one of the resistors until it stopped showing a preference for a particular state after powerup.

For really difficult simulation cases, I sometimes add a current source set to give a brief, very small one-shot pulse or burst shortly after startup, and 0A the rest of the time.  This is especially useful for crystal oscillators, and doesn't clutter the schematic as you can connect it by labelled nets.
« Last Edit: May 03, 2017, 06:48:30 pm by Ian.M »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19522
  • Country: gb
  • 0999
Re: LTSpice Thread
« Reply #5 on: May 03, 2017, 10:34:22 pm »
Give it a bit longer - I tried .tran 50m startup and it started for me. YMMV as your LTspice installation may be at a different release.
I haven't tried but am not surprised that worked. I don't know much about SPICE but I believe the rounding errors in the calculations eventually get it going.
 

Offline yadaTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 264
  • Country: ca
Re: LTSpice Thread
« Reply #6 on: May 10, 2017, 02:48:08 pm »
One thing to note is that LTSpice may fail, if a circuit is too symmetrical.

For example, attached is an example of a two transistor, astable multivibrator. It will work if you build it in real life but the attached file will not simulate because either side of the astable is exactly the same. If one of the resistor or capacitor values is changed, so it's slightly different to the other side, then it'll work.



The attached file is based on the one included in the LTSpices examples folder. The working circuit can be found in LTSpice/Examples/educational/astable.asc

That was literally the fist circuit I made in it and every time I tried to get it to simulate it would crash. I thought it was my computers memory as is often the problem. I did get other circuits working and its not as glamourous as the fun green/red coloured dots.
 

Offline yadaTopic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 264
  • Country: ca
Re: LTSpice Thread
« Reply #7 on: May 10, 2017, 03:04:17 pm »
LTspice doesn't do any of that animated s--t.   Its designed by professional engineers for professional engineers, and one of the requirements in such an environment is that all results shall be repeatable.  Runtime user interaction isn't repeatable as any small change in the simulation speed or user's reaction time would result in different results.   What you can do is script external events using stuff like controlled switches and sources and behavioural  R, L, C passives, including pulling data for a source from an external file, and measure component currents and node voltages at specific times in the simulation or when specific criteria are met.  .

Which button do I press to make it do that? Do I click on the File tab at the top of the screen?  :scared: It seems like you can spend a whole semester in school just learning how to make accurate simulations. Seems almost easier to just make a circuit and power it up.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: LTSpice Thread
« Reply #8 on: May 10, 2017, 03:32:54 pm »
Its all a matter of setting the right parameters for sources and other special purpose components and adding the appropriate SPICE dot commands to the schematic - there's precious little that's 'just press a button', and yes you could spend a semester learning it - if your college is that enlightened.

I'm attaching a sim of a controlled switch.   S1 is controlled by the current through source V1, and to save unnecessary components I simply set its resistance to -1 Ohm and short it.  Of course that's totally unreal, but SPICE doesn't mind and it has the desired effect that a positive voltage for the source will result in a numerically identical positive current through it, ideal for controlling CSW type components.   There's a bit more to it than that - S1 needs to be linked to a .model statement that defines its switching characteristics, and also to its controlling source.  Right click it to see how that's done.  V1 doesn't have to be a triangle wave it could be any other waveform including arbitrary sequences entered point by point as a PWL or a PWL file.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf