Make single component in LTspice - Page 1
Forum section: electronics / beginners

author: ocset
author_rank: Super Contributor
timestamp: June 14, 2019, 05:22:17 am
content: HiDo 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.

author: pwlps
author_rank: Frequent Contributor
timestamp: June 14, 2019, 08:57:36 am
content: Quote from: treez on June 14, 2019, 05:22:17 amGoogle for "Hierarchical Blocks in LTSPICE". There are many tutorials, for example:http://www.sgh1.net/posts/ltspice-custom-block.md

author: Zero999
author_rank: Super Contributor
timestamp: June 14, 2019, 09:41:07 am
content: 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-spicehttps://forum.allaboutcircuits.com/threads/ltspice-led.104269/https://electronics.stackexchange.com/questions/379103/how-can-i-use-model-a-custom-diode-in-ltspice

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: June 14, 2019, 09:59:02 am
content: 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

author: Ian.M
author_rank: Super Contributor
timestamp: June 14, 2019, 10:11:20 am
content: 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.gD1-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.

author: Jay_Diddy_B
author_rank: Super Contributor
timestamp: June 14, 2019, 10:19:09 am
content: Hi,You can also do this:This usesEvoltage controlled voltage source andFcurrent controlled current source. E and F are SPICE primitives and simulate very fast.Regards,Jay_Diddy_B

author: Zero999
author_rank: Super Contributor
timestamp: June 14, 2019, 02:24:10 pm
content: Wow, I didn't know about the N and M parameters!The voltage controlled voltage source and current souse are also interesting ideas.Quote from: treez on June 14, 2019, 05:22:17 amDo you have the data sheet for the LEDs? Does the manufacturer provide a SPICE model? If so, then it should be straightforward.

author: flair4ever
author_rank: Newbie
timestamp: July 17, 2019, 02:35:38 am
content: 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.