Author Topic: Make single component in LTspice  (Read 1755 times)

0 Members and 1 Guest are viewing this topic.

Offline ocsetTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 1516
  • Country: 00
Make single component in LTspice
« on: June 14, 2019, 05:22:17 am »
Hi
Do you know how i can make a single component out of the attached LED string?...we are using loads of them in the sim and its taking ages to run.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: Make single component in LTspice
« Reply #1 on: June 14, 2019, 08:57:36 am »
Hi
Do you know how i can make a single component out of the attached LED string?...we are using loads of them in the sim and its taking ages to run.

Google for "Hierarchical Blocks in LTSPICE".  There are many tutorials, for example:
http://www.sgh1.net/posts/ltspice-custom-block.md
 
The following users thanked this post: ocset

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20361
  • Country: gb
  • 0999
Re: Make single component in LTspice
« Reply #2 on: June 14, 2019, 09:41:07 am »
Why bother? Simply model it as a single diode with a forward voltage vs current curve mimicking the array of LEDs in series. That will be much faster to simulate, than a huge array of diodes.

https://electronics.stackexchange.com/questions/9510/how-do-i-model-an-led-with-spice
https://forum.allaboutcircuits.com/threads/ltspice-led.104269/
https://electronics.stackexchange.com/questions/379103/how-can-i-use-model-a-custom-diode-in-ltspice
 
The following users thanked this post: ocset

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: Make single component in LTspice
« Reply #3 on: June 14, 2019, 09:59:02 am »
Treez and the group,

You can use N=x to put parts in series in LTspice.

M=x will put parts in parallel.

Here is your example simplified:







I have attached the LTspice model.

I have done a dc sweep to show how the forward voltage changes with current.


Regards,
Jay_Diddy_B
 
The following users thanked this post: Zero999, 3roomlab, Ian.M, Wimberleytech, ocset, pwlps

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: Make single component in LTspice
« Reply #4 on: June 14, 2019, 10:11:20 am »
Edit: Jay_Diddy_b posted better instructions while I was typing this.

Hierarchical Blocks helps creating schematics but wont do anything whatsoever for runtime, as they are fully expanded when the netlist is generated before the SPICE run.  However the LTspice SPICE engine's D (diode) circuit element supports instance parameters N to set the number of series diodes and M to set number of parallel diodes (see 'D' in help file), which netlist as a single diode, with the modelled voltage across it multiplied by N or the current through it internally divided by M.

You need to set N to the number of identical diodes in the string.
<snip my instructions - use Jay's>
You can then choose the diode model as normal and LTspice will treat it as a series string of 14 of them. To avoid confusion, its probably a good idea to edit its designator (InstName) to reflect the fact its multiple parts e.g D1-14.   Do *NOT* use brackets in the designator as you don't want to create a bussed multiple component! (see: http://ltwiki.org/?title=Undocumented_LTspice#Bussing_of_Connections_and_Components_.28BUS_shorthand_notation.29 )

N.B. N and M instance parameters only work for diodes defined as a D model, not ones defined as a subcircuit or behavioural model.  You cant probe voltages inside the string or currents inside strings paralleled with the M instance parameter.  If you want to specify both N and N separate them with a comma and a space. 
« Last Edit: June 14, 2019, 10:15:54 am by Ian.M »
 
The following users thanked this post: ocset

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: Make single component in LTspice
« Reply #5 on: June 14, 2019, 10:19:09 am »
Hi,

You can also do this:






This uses E voltage controlled voltage source and F current controlled current source. E and F are SPICE primitives and simulate very fast.

Regards,
Jay_Diddy_B
 
The following users thanked this post: 3roomlab, ocset

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20361
  • Country: gb
  • 0999
Re: Make single component in LTspice
« Reply #6 on: June 14, 2019, 02:24:10 pm »
Wow, I didn't know about the N and M parameters!

The voltage controlled voltage source and current souse are also interesting ideas.

Hi
Do you know how i can make a single component out of the attached LED string?...we are using loads of them in the sim and its taking ages to run.
Do you have the data sheet for the LEDs? Does the manufacturer provide a SPICE model? If so, then it should be straightforward.
 
The following users thanked this post: ocset

Offline flair4ever

  • Newbie
  • Posts: 5
  • Country: us
Re: Make single component in LTspice
« Reply #7 on: July 17, 2019, 02:35:38 am »
A course at Udemy:
LTspice Tutorial for Beginners: A Complete Guide from A to Z (https://www.udemy.com/ltspice-tutorial-for-beginners/?couponCode=GO-LTSPICE)
You will get familiar with most of features in LTspice within one day.
Free preview is available.
 
The following users thanked this post: ocset


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf