Difference between revisions of "Filter Pages and LTspice Goodies"

From LTwiki-Wiki for LTspice
m (Filter)
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
=== Introduction ===
 
=== Introduction ===
&emsp;The following links contain macro models built for LTspice with the purpose of turning large-scale simulations into block-level schematics, similar to hierarchy design but with predefined models. The domains of interest include, but are not limited to, digital devices ('''[0101]'''), filtering and control theory ('''[Filt]'''), mathematics equations ('''[Math]'''), power electronics ('''[Pwr]'''). In addition, there is one more model, '''Filter''', that is made to be a sort of a universal filter for LTspice.<br>
+
&emsp;The following links contain macro models built for LTspice with the purpose of turning large-scale simulations into block-level schematics, similar to hierarchy design but with predefined models. The domains of interest include, but are not limited to, digital devices ('''[[#0101|<nowiki>[</nowiki>0101<nowiki>]</nowiki>]]'''), filtering and control theory ('''[[#Filt|<nowiki>[</nowiki>Filt<nowiki>]</nowiki>]]'''), mathematics equations ('''[[#Math|<nowiki>[</nowiki>Math<nowiki>]</nowiki>]]'''), power electronics ('''[[#Pwr|<nowiki>[</nowiki>Pwr<nowiki>]</nowiki>]]'''). In addition, there is one more model, '''[[#Filter|Filter]]''', that is made to be a sort of a universal filter for LTspice. All the files can be found in the provided links.<br>
&emsp;The links go to an external site, for now hosted on the same http://ltwiki.org, until I fully merge all the pages to blend in with LTwiki. The lists describing the contents of every folder is limited to enumeration and a simple description, details are in the links.
+
&emsp;The links go to an external site, for now hosted on the same http://ltwiki.org. The lists describing the contents of every folder is limited to enumeration and a simple description, details are in the links.
  
 
=== <div id="Filter">[http://ltspicegoodies.ltwiki.org/Filter_Manual/index.html Filter]</div> ===
 
=== <div id="Filter">[http://ltspicegoodies.ltwiki.org/Filter_Manual/index.html Filter]</div> ===
Line 40: Line 40:
 
|-
 
|-
 
|style="color:#007900"|<code>FIR</code>
 
|style="color:#007900"|<code>FIR</code>
 +
|-
 +
|style="color:#007900"|<code>FIRx</code>
 
|-
 
|-
 
|style="color:#007900"|<code>FIR2</code>
 
|style="color:#007900"|<code>FIR2</code>
Line 52: Line 54:
 
|}
 
|}
  
&emsp;The last two moving averages and just some analog approaches. In fact, all of them are since LTspice's engine is a dedicated analog simulator. Because of that, the digital filters will not be faster than their analog cousins, quite the contrary. They may also suffer from random spikes around transitions from one sample to another, mainly due to the imperfections of the simulation time-step or to tiny mismatches in sampling time (don't forget that the rise and fall times ''do'' count).<br>
+
&emsp;<code style="color:#007900">FIR</code>, <code style="color:#007900">FIRx</code>, <code style="color:#007900">FIR2</code> and <code style="color:#007900">FIR_FS</code> are, element-wise, the same, except for the windows/functions they perform and maximum  length, while the last two moving averages and just some analog approaches. In fact, all of them are since LTspice's engine is a dedicated analog simulator. Because of that, the digital filters will not be faster than their analog cousins, quite the contrary. They may also suffer from random spikes around transitions from one sample to another, mainly due to the imperfections of the simulation time-step or to tiny mismatches in sampling time (don't forget that the rise and fall times ''do'' count).<br>
&emsp;In the end, the '''Filter''' is a handy tool for anyone who needs a quick implementation of a filter without going through the hassle of calculating, placing all elements, attributing values and wiring them to form a filter when the purpose of the schematic is different, not to mention the bother of repeating the steps anytime a change is needed.
+
&emsp;In the end, the '''Filter''' is a handy tool for anyone who needs a quick implementation of a filter without going through the hassle of calculating, placing all elements, attributing values and wiring them to form a filter when the purpose of the schematic is different, not to mention the bother of repeating the steps anytime a change is needed.<br><br>
 +
&emsp;The files can be found in the [http://ltspicegoodies.ltwiki.org Home] link (the top menu), the '''Filter manual''' paragraph.
  
 
=== <div id="0101">[http://ltspicegoodies.ltwiki.org/0101.html <nowiki>[0101]</nowiki>]</div> ===
 
=== <div id="0101">[http://ltspicegoodies.ltwiki.org/0101.html <nowiki>[0101]</nowiki>]</div> ===
Line 160: Line 163:
 
|}
 
|}
  
=== <div id="Examples">[http://ltspicegoodies/ltwiki.org/Examples.html Examples]</div> ===
+
=== <div id="Examples">[http://ltspicegoodies.ltwiki.org/examples.html Examples]</div> ===
  
 
&emsp;The two purposes in creating these were to have some schematics concerning power conditioning, in general, and that they should be made with the symbols and libraries from the above folders. In no particular order, the schematics are:
 
&emsp;The two purposes in creating these were to have some schematics concerning power conditioning, in general, and that they should be made with the symbols and libraries from the above folders. In no particular order, the schematics are:
Line 180: Line 183:
 
&emsp;Not related specifically to LTspice, but with SPICE, in general, there are two files made to help editing netlist/librariy/subcircuit/model files (text files with ''*.net, *.cir, *.sp, *.lib, *,sub, *.mod'' extensions) with editors based on ''GtkSourceView'' (''gEdit, Mousepad, Scribes'' or others that may be using): a syntax highlighting and
 
&emsp;Not related specifically to LTspice, but with SPICE, in general, there are two files made to help editing netlist/librariy/subcircuit/model files (text files with ''*.net, *.cir, *.sp, *.lib, *,sub, *.mod'' extensions) with editors based on ''GtkSourceView'' (''gEdit, Mousepad, Scribes'' or others that may be using): a syntax highlighting and
 
an optional colour theme matching LTspice's.
 
an optional colour theme matching LTspice's.
 +
 +
=== <div id="files">The files</div> ===
 +
 +
&emsp;If only the files are needed and there's no need for extra browsing, below is the list with all the files:
 +
 +
{{#widget:Iframe
 +
|url=http://ltspicegoodies.ltwiki.org/files/
 +
|width=800
 +
|height=600
 +
|border=0
 +
}}
 +
 +
{{#widget:DISQUS
 +
|id=ltwiki
 +
|uniqid={{PAGENAME}}
 +
|url=http://ltwiki.org/index.php5?title=Filter_Pages_and_LTspice_Goodies
 +
}}

Revision as of 10:55, 30 March 2015

Introduction

 The following links contain macro models built for LTspice with the purpose of turning large-scale simulations into block-level schematics, similar to hierarchy design but with predefined models. The domains of interest include, but are not limited to, digital devices ([0101]), filtering and control theory ([Filt]), mathematics equations ([Math]), power electronics ([Pwr]). In addition, there is one more model, Filter, that is made to be a sort of a universal filter for LTspice. All the files can be found in the provided links.
 The links go to an external site, for now hosted on the same http://ltwiki.org. The lists describing the contents of every folder is limited to enumeration and a simple description, details are in the links.

 The Filter is a library encompassing analog and digital filters and it was made with the thought of making life easier when dealing with schematics that use filtering but don't emphasize the filters, in particular. The filters range from analog passive and active to digital IIR and FIR, where the IIRs are the digitized analog active filters and the FIRs are windows such as rectangular, Hann, Hamming, Blackman, Kaiser, Dolph-Chebyshev (and many others), but also differentiator, Hilbert transformer and frequency sampling method. The list contains:

Analog passive
Butterworth_LC
Chebyshev_LC
Analog active
3dBoct
Bessel (and Bessel2, an older version)
Butterworth
Chebyshev
InvChebyshev
Cauer
IIR
Butterworth_IIR
Chebyshev_IIR
InvChebyshev_IIR
Cauer_IIR
FIR
FIR
FIRx
FIR2
FIR_FS
Moving average
MAFv
RRS

FIR, FIRx, FIR2 and FIR_FS are, element-wise, the same, except for the windows/functions they perform and maximum length, while the last two moving averages and just some analog approaches. In fact, all of them are since LTspice's engine is a dedicated analog simulator. Because of that, the digital filters will not be faster than their analog cousins, quite the contrary. They may also suffer from random spikes around transitions from one sample to another, mainly due to the imperfections of the simulation time-step or to tiny mismatches in sampling time (don't forget that the rise and fall times do count).
 In the end, the Filter is a handy tool for anyone who needs a quick implementation of a filter without going through the hassle of calculating, placing all elements, attributing values and wiring them to form a filter when the purpose of the schematic is different, not to mention the bother of repeating the steps anytime a change is needed.

 The files can be found in the Home link (the top menu), the Filter manual paragraph.

 A few models which I found useful, this folder holds the following:

ADC16 an asynchronous (max) 16bit ADC
Bin2Dec a binary to decimal translator
CNT16asy an asynchronous (max) 16bit counter
DAC16 a (max) 16bit DAC
Dec2Bin a decimal to binary translator
JKFLOP a behavioural JK flip-flop

 The contents of this folder is mixed, in general, filtering and control theory, but can be applied anywhere.

AGC an automatic gain controller w/out external frequency control
DeadTime dead-time
DeadZone dead-zone
Delay analog -- exp(-sT) -- or digital -- z-1 -- delay
Diff differentiator
FFT actually a continuous-time Fourier decomposition, but FFT is shorter
FreqDet frequency detector
Gain a linear/dB gain/buffer with variable output resistance
Integ_r resettable integrator w/out external period control
LeadLag, LeadLag2 two versions for a <-π..π> lead-lag control, w/out external control
Lim hard limitter
MUX a simple externally controlled analog multiplexer
PhaseDet phase detector
PID a universal PID/PI/PD/ID/P/I/D analog/digital controller
PLL a phase-locked loop with single/quadrature inputs
SampledSource LTspice's own SINE and/or PULSE sources, sampled
StateSpace 1st/2nd/3rd order, SISO state-space block
UpDnSpl .AC-friendly up-/down-sampler

 LTspice's mathematical functions for behavioural sources plus a few others in a more accessible, streamlined package. There's no point in enumerating them since they're all packed into a specific symbol, depending on how many variables the functions allow.
 For example, the function abs() requires one variable and that variable is the input. The symbol that makes use of one variable functions is Math1. In the case of atan2(), the two variables are the two inputs and the symbols for these are Math2, Math2r and Math2rT. There are also two 5-input symbols, Math5 and Math5r but they do only summing and/or difference.

 Except a few models, all are three-phase and power electronics related.

3lvl_mod 3-level modulation w/out external carrier and dead-time
3ph_ACMotor a rather simplified DQ reference frame AC motor which allows either inductances/resistances or power/frequency inputs, respectively.
3ph_br_cm, 3ph_br_vm current-/voltage-mode switching bridges
3ph_gen harmonics generator up to 51st, w/out external amplitude/frequency/phase control
3ph_SW 3-phase to 3-phase timed switch
BrdgRect, BrdgRectThy simple and thyristor bridge rectifiers
Cable a simple Π LC with terminating resistances cable model
Disturb disturbance inducer, meant to be used together with 3ph_gen, but not only
HystComp single-phase hysteresis comparator w/out external error control and dead-time
Isense, Vsense isolated current and voltage sensors
RLC universal RLC load, can be series or parallel, w/out null, wye or delta
SVHCC, SVPWM space-vector hysteresis current controller and PWM, respectively
sym symmetrical components analyzer, abc-to-120 and inverse
Transforms Clarke and Park matrices, 2- or 3-inputs, direct and inverse, plus a cvasi-instantaneous approach for a symmetrical components analyzer
WattMeter one-phase wattmeter, outputs apparent/active/reactive powers, power-factor and RMS voltage/current
wt PLL angle generator

 The two purposes in creating these were to have some schematics concerning power conditioning, in general, and that they should be made with the symbols and libraries from the above folders. In no particular order, the schematics are:

  • two shunt active power filters, pq theory, sine and power strategies
  • shunt active power filter, dq theory
  • shunt active power filter, pq/sine strategy, full schematic but with ideal blocks
  • universal power quality conditioner, dq theory for both shunt and series filters
  • simple passive reactive power compensation
  • positive sequence detectors, pq and dq, and filtering methods test case
  • phase-locked loop for grid-tied inverters
  • quadrature signal generator based on generalized integrators
  • three-phase, three-level modulation example
  • three-phase thyristor bridge rectifier
  • a small extra find

 Not related specifically to LTspice, but with SPICE, in general, there are two files made to help editing netlist/librariy/subcircuit/model files (text files with *.net, *.cir, *.sp, *.lib, *,sub, *.mod extensions) with editors based on GtkSourceView (gEdit, Mousepad, Scribes or others that may be using): a syntax highlighting and an optional colour theme matching LTspice's.

The files

 If only the files are needed and there's no need for extra browsing, below is the list with all the files:

blog comments powered by Disqus