From a5ae129f3aa3a3a0aeaa21c55b75a1d543fe4111 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 4 Jun 2021 03:02:48 +0000 Subject: CTAN sync 202106040302 --- graphics/circuit_macros/libcct.m4 | 449 ++++++++++++++++++++++++-------------- 1 file changed, 291 insertions(+), 158 deletions(-) (limited to 'graphics/circuit_macros/libcct.m4') diff --git a/graphics/circuit_macros/libcct.m4 b/graphics/circuit_macros/libcct.m4 index d0c1e00d14..ed3356f4b0 100644 --- a/graphics/circuit_macros/libcct.m4 +++ b/graphics/circuit_macros/libcct.m4 @@ -1,7 +1,7 @@ divert(-1) libcct.m4 -* Circuit_macros Version 9.5, copyright (c) 2021 J. D. Aplevich under * +* Circuit_macros Version 9.6, copyright (c) 2021 J. D. Aplevich under * * the LaTeX Project Public Licence in file Licence.txt. The files of * * this distribution may be redistributed or modified provided that this * * copyright notice is included and provided that modifications are clearly * @@ -71,15 +71,17 @@ CUSTOMIZATIONS: DEBUGGING: The statement print "`$0'($@)" ; inserted into a macro will display the macro name and current arguments + Similarly, the m4 macro m4msg( text ) will display the text during m4 + processing. ============================================================================== This file redefines default arrow dimensions and the dotrad_ macro. ==============================================================================' - `capacitor( linespec,[char][+],R,height,wid ) - char: - F or none: flat plates - C = polarized, curved plate + `capacitor( linespec,chars,R,height,wid ) + Arg2 chars: + [d]F or blank: flat plates; d=hatched fill + [d]C = polarized, curved plate; d=variable E = polarized rectangular plates K = filled rectangular plates M = rectangular plates @@ -88,38 +90,40 @@ DEBUGGING: The statement + = polarity sign to right of drawing dir +L =polarity sign to left arg3 = R: reversed orientation - arg4 = height (defaults F: dimen_/3 - C,P: dimen_/4, E,K: dimen_/5) - arg5 = wid (defaults F: height*0.3, - C,P: height*0.4, E,K: height) ' + arg4 = height (defaults F: dimen_/3; + C,P: dimen_/4; E,K: dimen_/5) + arg5 = wid (defaults F: height*0.3; + C,P: height*0.4; E,K: height) ' define(`capacitor', - `ifelse(`$3',R,`reversed(`capacitor',`$1',`$2',,shift(shift(shift($@))))', +`ifelse(`$3',R,`reversed(`capacitor',`$1',`$2',,shift(shift(shift($@))))', `eleminit_(`$1') - define(`m4ctype',ifelse(`$2',,F,`$2',+,F,`$2',+L,F,`$2'))dnl - m4_dna(`m4ctype',+L)`'m4_dna(`m4ctype',+)dnl - { ifelse(m4ctype,F, + define(`dna_',`ifelse(`$2',,F,`$2')')dnl + { sc_draw(`dna_',F, `define(`m4cht',`ifelse(`$4',,`dimen_/3',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*0.3',`($5)')')dnl line to rvec_(rp_len/2-m4cwd/2,0) {line from rvec_(0,-m4cht/2) \ to rvec_(0,m4cht/2)} + ifelse(m4a,d,`for_(1,3,1,{line from rvec_(0,m4cwd*(m4x-5/2)) \ + to rvec_(m4cwd,m4cwd*(m4x-3/2))})') move to rvec_(m4cwd,0) {line from rvec_(0,-m4cht/2) \ to rvec_(0,m4cht/2)} - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,C, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',C, `define(`m4cht',`ifelse(`$4',,`dimen_/4',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*0.4',`($5)')')dnl define(`m4cr',`dimen_*0.25')dnl line to rvec_(rp_len/2-m4cwd/2,0) {line from rvec_(0,-m4cht/2) \ to rvec_(0,m4cht/2)} - {arc cw from rvec_(m4cwd,-m4cht/2) \ + {arc cw ifelse(m4a,d,-> wid lthick*4 ht lthick*4) \ + from rvec_(m4cwd,-m4cht/2) \ to rvec_(m4cwd,m4cht/2) \ with .c at rvec_(m4cwd+sqrt((m4cr)^2-(m4cht/2)^2),0) } line from last arc.c+vec_(-m4cr,0) \ - to rvec_(rp_len/2+m4cwd/2,0) ', - m4ctype,P, + to rvec_(rp_len/2+m4cwd/2,0) ') + sc_draw(`dna_',P, `define(`m4cht',`ifelse(`$4',,`dimen_/4',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*0.4',`($5)')')dnl define(`m4cr',`dimen_*0.25')dnl @@ -131,8 +135,8 @@ define(`capacitor', {line from rvec_(m4cwd*2/3,-m4cht*3/8) \ to rvec_(m4cwd*2/3,m4cht*3/8)} line from rvec_(m4cwd*2/3,0) \ - to rvec_(rp_len/2+m4cwd/2,0) ', - m4ctype,E, + to rvec_(rp_len/2+m4cwd/2,0) ') + sc_draw(`dna_',E, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl define(`m4cs',`(m4cwd/3.2)')dnl @@ -142,8 +146,8 @@ define(`capacitor', move to rvec_(m4cwd,0) {ifsvg(`lbox(-m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(-m4cs,m4cht))')} linethick_(m4linethicktemp) - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,M, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',M, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl define(`m4cs',`(m4cwd/3.2)')dnl @@ -153,8 +157,8 @@ define(`capacitor', move to rvec_(m4cwd,0) { lbox(-m4cs,m4cht) } linethick_(m4linethicktemp) - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,K, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',K, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht',`($5)')')dnl define(`m4cs',`(m4cwd/3.2)')dnl @@ -162,8 +166,8 @@ define(`capacitor', {ifsvg(`lbox(m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(m4cs,m4cht))')} move to rvec_(m4cwd,0) {ifsvg(`lbox(-m4cs,m4cht,fill_(0))',`m4fshade(m4fill,lbox(-m4cs,m4cht))')} - line to rvec_(rp_len/2-m4cwd/2,0) ', - m4ctype,N, + line to rvec_(rp_len/2-m4cwd/2,0) ') + sc_draw(`dna_',N, `define(`m4cht',`ifelse(`$4',,`dimen_/5',`($4)')')dnl define(`m4cwd',`ifelse(`$5',,`m4cht*2/3',`($5)')')dnl define(`m4cs',`(m4cwd/3.2*3/2)')dnl @@ -195,9 +199,10 @@ define(`capacitor', Q=offset H=squared N=IEEE (default) + B=not burnable V=varistor variant R=to right of drawing direction - arg4: cycle width, default dimen_/6' + arg4: cycle width (default dimen_/6)' define(`resistor', `define(`m4h',`ifelse(`$4',,`dimen_/6',`($4)')/4')dnl ifinstr( @@ -257,6 +262,12 @@ define(`resistor', then to last line.end [box invis ht_ m4hh*m4v wid_ m4hh*m4n*2] at 2nd last line.c+(0,m4hh*m4v/2) }') + sc_draw(`dna_',B, + `resistor(`$1',`$2',dna_,`$4'); M4LBC: last line.c + m4lbwd = last [].wid_+lthick*2; m4lbht = last [].ht_+lthick*2 + [lbox(m4lbwd,m4lbht,thick 0.4)] with .c at M4LBC + [lbox(m4lbwd+2bp__,m4lbht+2bp__,thick 0.4)] with .c at M4LBC ') +# line invis from 2nd last line.start to 2nd last line.end ')') define(`M4_varistor',`eleminit_(`$1') @@ -361,13 +372,29 @@ ifelse(`$2',,`undefine(`m4tap_x')popdef(`m4type')popdef(`m4name')', m4name`'m4tap_x: Here } addtaps(,shift(shift(shift($@))))')') - `tapped(`two-terminal element',[. | <- | -> | <->], + `tapped(`two-terminal element', . | <- | -> | <-> , fractional pos, length, fractional pos, length,...) Draw the two-terminal element and taps in a [] block' define(`tapped',`[ $1 Start: last line.start; End: last line.end; C: last line.c addtaps(shift($@)) ]') + `shielded(`two-terminal element',L|U, line attributes ) + L= shield left half (wrt drawing direction) + R= shield right half (default both halves)' +define(`shielded',`[ $1 + Start: last line.start; End: last line.end; C: last line.c + W: last line.c - vec_(last [].wid_/2+dimen_/8,0) + E: last line.c + vec_(last [].wid_/2+dimen_/8,0) + NW: last [].nw_ + vec_(-dimen_/8,dimen_/8) + NE: last [].ne_ + vec_(dimen_/8,dimen_/8) + SE: last [].se_ + vec_(dimen_/8,-dimen_/8) + SW: last [].sw_ + vec_(-dimen_/8,-dimen_/8) + ifinstr(`$2',L,`line from W to NW then to NE then to E dashed `$3'', + `$2',R,`line from W to SW then to SE then to E dashed `$3'', + `line from W to NW then to NE then to SE then to SW then to W dashed `$3'') + `$4']') + `b_current( label, above_|below_, O[ut], S[tart]|E[nd], frac ) Branch current for last-drawn element. The arrowhead @@ -402,78 +429,81 @@ define(`rarrow',`define(`m4h',`min(lin_leng(last line),linewid)/2')dnl to last [].s_+vec_(m4h,-m4v) \ m4lstring(`$1',"sp_`iflatex(`$ `$1'$',` $1')'sp_") below_}') - `inductor( linespec,W|L,cycles,M|P,loop wid ) + `inductor( linespec, W|L, cycles, M|P|K[n], + loop wid ) W=wide arcs (default narrow); L=looped arcs - M=metal core; P=powder core - loop wid defaults W,L: dimen_/5, - other: dimen_/8' + arg4= M[n]=metal core + P[n]=(ferrite) powder core (dashed lines) + K[n]=long-dashed core lines + n=integer (default 2 lines) + arg5 loop wid defaults W,L: dimen_/5, + other: dimen_/8' define(`inductor',`eleminit_(`$1') define(`m4hlw',`ifelse(`$5',,`dimen_/10',`($5)/2')')dnl half loop wid define(`m4n',`ifelse(`$3',,4,`$3')')dnl - ifelse(`$2',W, - `m4Inductor', - `$2',L, - `m4Lnductor', - `m4inductor(,ifelse(`$5',,,`($5)/2'))') - ifelse(ifelse(`$4',M,T,`$4',P,T),T,`m4m_core(rvec_(rp_len/2,0), - m4wd,m4ht+dimen_/24,dimen_/16,ifelse(`$4',P,dashed m4wd/(2*m4n+1))) - define(`m4hs',`(dimen_/24+dimen_/16)')',`define(`m4hs',0)') - {[box invis ht_ m4ht+m4hs+m4dp wid_ m4wd] \ - at rvec_(rp_len/2,(m4ht+m4hs-m4dp)/2)} + ifelse(`$2',W, `define(`m4wd',((2*m4n-2)*m4c2t+2)*m4hlw)', + `$2',L, `define(`m4wd',(m4n+1)*m4hlw)', + `define(`m4ht',`ifelse(`$2',,`dimen_/16',`$2')')define(`m4wd',m4n*m4ht*2)') + { line to rvec_((rp_len-m4wd)/2,0) + ifelse(`$2',W,`m4Ibody', `$2',L,`m4Lbody', `m4ibody') with .S at Here + line from last [].E to last [].E+vec_((rp_len-m4wd)/2,0) } + ifelse(ifinstr(`$4',M,T,`$4',P,T,`$4',K,T),T, + `define(`m4nL',ifelse(len(`$4'),1,2,substr(`$4',1)))dnl + define(`m4hs',`(dimen_/24+(m4nL-1)*dimen_/16)')dnl + m4m_core(rvec_(rp_len/2,0), m4wd, m4ht+dimen_/24, dimen_/16, + ifinstr( `$4',P,`dashed m4wd/(2*m4n+1)', + `$4',K,`dashed m4wd/(2*m4n+1)*3'), m4nL) + {[box invis ht_ m4ht+m4hs+m4dp wid_ m4wd] \ + at rvec_(rp_len/2,(m4ht+m4hs-m4dp)/2)}') line to rvec_(rp_len,0) invis ') - `Wide loop inductor' -define(`m4Inductor',`define(`m4ht',`(1+m4st)*m4hlw')dnl - define(`m4dp',`(m4s2t-m4st)*m4hlw')define(`m4wd',((2*m4n-2)*m4c2t+2)*m4hlw)dnl - { line to rvec_(rp_len/2-((m4n-1)*m4c2t+m4ct)*m4hlw,0); round - arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4st-m4s2t)) \ - with .c at rvec_(vscal_(m4hlw,m4ct,m4st)); round - for m4i=3 to m4n do { arc cw from Here to rvec_(vscal_(m4hlw,2*m4c2t,0)) \ - with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round } - arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4s2t-m4st)) \ - with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round - line to rvec_(rp_len/2-((m4n-1)*m4c2t+m4ct)*m4hlw,0) } ') + `Wide loop inductor body' +define(`m4Ibody',`define(`m4ht',`(1+m4st)*m4hlw')dnl + define(`m4dp',`(m4s2t-m4st)*m4hlw')dnl + [S: Here; round + arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4st-m4s2t)) \ + with .c at rvec_(vscal_(m4hlw,m4ct,m4st)); round + for m4i=3 to m4n do { arc cw from Here to rvec_(vscal_(m4hlw,2*m4c2t,0)) \ + with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round } + arc cw from Here to rvec_(vscal_(m4hlw,m4ct+m4c2t,m4s2t-m4st)) \ + with .c at rvec_(vscal_(m4hlw,m4c2t,m4s2t)); round + E: Here] ') define(`m4ct',`Cos(25)')define(`m4st',`Sin(25)') define(`m4c2t',`Cos(50)')define(`m4s2t',`Sin(50)') - `Looped inductor' -define(`m4Lnductor',`define(`m4ht',`m4hlw*10/8')dnl - define(`m4dp',`m4hlw/2')define(`m4wd',(m4n+1)*m4hlw)dnl - { line to rvec_(rp_len/2-m4wd/2,0); round + `Looped inductor body' +define(`m4Lbody',`define(`m4ht',`m4hlw*10/8')define(`m4dp',`m4hlw/2')dnl + [ S: Here; round spline ifdpic(0.55) \ - to rvec_(0,m4ht) for_(1,m4n,1,`\ - then to rvec_((m4x+0.3)*m4hlw, m4ht) \ - then to rvec_((m4x+0.3)*m4hlw,-m4dp) \ - then to rvec_((m4x-0.3)*m4hlw,-m4dp) \ - then to rvec_((m4x-0.3)*m4hlw, m4ht)\')\ - then to rvec_(m4wd,m4ht) \ - then to rvec_(m4wd,0) - round; line to rvec_(rp_len/2-m4wd/2,0) }') - `Narrow inductor' -define(`m4inductor',`define(`m4ht',`ifelse(`$2',,`dimen_/16',`$2')')dnl - define(`m4dp',0)define(`m4wd',m4n*m4ht*2)dnl + to rvec_(0,m4ht) for_(1,m4n,1,`\ + then to rvec_((m4x+0.3)*m4hlw, m4ht) \ + then to rvec_((m4x+0.3)*m4hlw,-m4dp) \ + then to rvec_((m4x-0.3)*m4hlw,-m4dp) \ + then to rvec_((m4x-0.3)*m4hlw, m4ht) \')\ + then to rvec_(m4wd,m4ht) \ + then to rvec_(m4wd,0); round; E: Here ] ') + `Narrow inductor body' +define(`m4ibody',`define(`m4dp',0)dnl ifelse(ifpstricks(T)`'ifmpost(T)`'ifpgf(T)`'ifsvg(T),T, `define(`m4y')',`undefine(`m4y')')dnl - { line to rvec_((rp_len-m4wd)/2,0) - ifdef(`m4y',`{line to rvec_(0,-hlth)};') - for m4i=1 to m4n do { - arc cw from Here to rvec_(m4ht*2,0) with .c at rvec_(m4ht,0) - ifdef(`m4y',`{line to rvec_(0,-hlth)}') } - line to rvec_((rp_len-m4wd)/2,0)} ') - - `m4m_core(bottom ctr, length, ht offset, - separation,linetype) - Two lines for the metal core' -define(`m4m_core',`dnl - {M4Core1: line from `$1'+vec_(-(`$2')/2,`$3') \ - to `$1'+vec_( (`$2')/2,`$3') `$5' - M4Core2: line from M4Core1.start+vec_(0,`$4') \ - to M4Core1.end+vec_(0,`$4') `$5'}') + [ S: Here; ifdef(`m4y',`{line to rvec_(0,-hlth)};') + for m4i=1 to m4n do { + arc cw from Here to rvec_(m4ht*2,0) with .c at rvec_(m4ht,0) + ifdef(`m4y',`{line to rvec_(0,-hlth)}') }; E: Here ] ') + `m4m_core(bottom center, length, ht offset, + separation, linetype, nlines) + nlines=lines for the metal core' +define(`m4m_core',`for_(1,`$6',1,`{M4Core`'m4x: line \ + from `$1'+vec_(-(`$2')/2,`$3'+(`$4')*(m4x-1)) \ + to `$1'+vec_( (`$2')/2,`$3'+(`$4')*(m4x-1)) `$5''})') `transformer( linespec, L|R, np, - [A|P][W|L][D1|D2|D12|D21], ns ) + [A|M[n]|P[n]|K[n]][W|L][D1|D2|D12|D21], ns ) 2-winding transformer or choke: np = number of primary arcs ns = number of secondary arcs - A = air core; P = powder (dashed) core + A = air core; + M[n] = metal core (default); n=number of lines + P[n] = powder (dashed) core + K[n] = long dashed core W = wide windings; L = looped windings D1: phase dots at P1 and S1 ends; D2: dots at P2 and S2 ends; D12: dots at P1 and S2 @@ -494,9 +524,12 @@ define(`transformer', `[ P1: Here define(`m4drt',m4dir) m4ns*m4ht*2)')dnl ifinstr(`$4',A, `move to last line.c+vec_(0,m4ht*ifelse(m4WL,W,3,m4WL,L,3,4))', - `m4m_core(rvec_(-(rp_len/2),0),max(m4wd,m4t),m4ht+dimen_/12,dimen_/8, - ifinstr(`$4',P,dashed m4wd/(2*m4n+1))) - move to last line.c+vec_(0,m4ht+dimen_/12)') + `define(`m4LL',`regexp(`$4',[MPK]\([0-9][0-9]*\),\1)')dnl + define(`m4nL',`ifelse(m4LL,,2,m4LL)')dnl + m4m_core(rvec_(-(rp_len/2),0), max(m4wd,m4t), m4ht+dimen_/12, dimen_/8, + ifinstr( `$4',P,`dashed m4wd/(2*m4n+1)', + `$4',K,`dashed m4wd/(2*m4n+1)*3'), m4nL) + move to last line.c+vec_(0,m4ht+dimen_/12) ') TS: Here S2: rvec_( ifelse(`$2',R,-)(ifelse(`$5',,rp_len/2,m4t/2)), 0 ) S1: 2 between S2 and Here @@ -662,19 +695,28 @@ define(`source',`ifelse(`$4',R, to rvec_(m4v,m4v)}', `{$2}' ) line from rvec_(m4h,0) \ - to rvec_(rp_len/2,0)} ') - { [box invis ht_ m4h*2 wid_ m4h*2] at rvec_(rp_len/2,0) } + to rvec_(rp_len/2,0)} + { [box invis ht_ m4h*2 wid_ m4h*2] at rvec_(rp_len/2,0) } ') line to rvec_(rp_len,0) invis ')') `Internal to source macro:' define(`m4_sourceGQ', -`{ line to rvec_(rp_len/2-3/2*m4h,0) - {[C1: circle rad m4h - L: C1+vec_(m4h/2, m4h*sqrt(3)/2) - R: C1+vec_(m4h/2,-m4h*sqrt(3)/2) - C2: ifelse(`$2',G,`circle rad m4h',`arc rad m4h from R to L') \ - with .c at C1 +vec_(m4h,0)] at rvec_(m4h*3/2,0)} - line from rvec_(m4h*3,0) \ - to rvec_(rp_len/2+3/2*m4h,0) } ') + `m4sv = m4h*2/3 + m4sh = sqrt((m4h)^2-m4sv^2) + { line to rvec_(rp_len/2-(m4h+m4sh),0) + {Body:[ Cx: rvec_(m4h,0) + ifelse(`$5',,,`{circle invis rad m4h `$5' with .c at Cx}') + L: Cx+vec_(m4sh, m4sv) + R: Cx+vec_(m4sh,-m4sv) + M1: Cx+vec_(-(m4h-m4sh)*3/5,0) + ifelse(`$5',,, + `{circle invis rad m4h `$5' with .c at Cx+vec_(m4sh*2,0)}') + C1: circle rad m4h with .c at Cx + C2: ifelse(`$2',G,`circle rad m4h',`arc rad m4h from R to L') \ + with .c at C1 +vec_(m4sh*2,0) + M2: C2+vec_((m4h-m4sh)*3/5,0) + ] at rvec_(m4h+m4sh,0)} + line from rvec_((m4h+m4sh)*2,0) \ + to rvec_(rp_len/2+(m4h+m4sh),0) } ') `ttmotor( linespec, string, diameter, brushwid, brushht )' define(`ttmotor',`eleminit_(`$1') @@ -1051,10 +1093,10 @@ define(`tbreaker',`eleminit_(`$1') define(`m4ho',0) m4j = max(0,rp_len/2-m4h/2) line to rvec_(m4j,0) {round - arc cw to rvec_( m4h/4,0)+vec_(Rect_(m4h/4,-60)) with .c at rvec_( m4h/4,0)} + arc cw to rvec_( m4h/4,0)+vec_(Rect_(m4h/4,-75)) with .c at rvec_( m4h/4,0)} move to rvec_(m4h,0) {round - arc cw to rvec_(-m4h/4,0)+vec_(Rect_(m4h/4,120)) with .c at rvec_(-m4h/4,0)} + arc cw to rvec_(-m4h/4,0)+vec_(Rect_(m4h/4,105)) with .c at rvec_(-m4h/4,0)} line to rvec_(m4j,0) ') } {[box invis ht_ m4v wid_ m4h ] at rvec_(rp_len/2,ifelse(`$2',R,-)m4ho) } @@ -1101,7 +1143,7 @@ define(`arrowline',`line ifelse(`$1',,`to rvec_(elen_,0)',`$1') T=truncated stem; N=normal ground, F=frame, S=signal, L=low-noise, P=protective, E=European; PA=protective alternate - down (default), up, left, right, angle (deg)' + Down (default), Up, Left, Right, angle (deg)' define(`ground',`box invis ht 0 wid 0 with .c ifelse(`$1',,`at Here',`$1') define(`m4v',`dimen_/6')define(`m4h',`dimen_/16')dnl {setdir_(ifelse(`$4',,-90,`$4')) @@ -1217,7 +1259,8 @@ define(`antenna',`[ T: Here then to rvec_(m4v*3/4,-m4v*sqrt(3)/4) } line from rvec_(m4v*3/4,0) \ to T') - `$5'; resetdir_ ] with .T ifelse(`$1',,`at Here',`$1')') + `$5'; resetdir_ ] with .T ifelse(`$1',,`at Here',`$1') + move to last [].T') `switch( linespec,L|R,[O|C][D],L|B|D ) Wrapper for bswitch, lswitch, dswitch @@ -1540,7 +1583,7 @@ define(`integrator',`eleminit_(`$1') - label, + label, size, chars) drawn as a []: defined positions: - W, N, E, S, Out, E1, E1, In1, In2 + W, N, E, S, Out, E1, E2, In1, In2 chars: P: power connections V1,V2 R: labels at In1,In2 swapped @@ -1561,8 +1604,8 @@ define(`dna_',`$5')dnl `line to N then to E then to S then to W; move to E') if rp_len > m4h then { line to rvec_(rp_len-m4h,0) } Out: Here } - E1: vec_(m4h/2,m4v/4) - E2: vec_(m4h/2,-m4v/4) + NE: vec_(m4h/2,m4v/4); E1: NE + SE: vec_(m4h/2,-m4v/4); E2: SE In1: vec_(0,m4v/4) In2: vec_(0,-m4v/4) { move to In`'ifinstr(dna_,R,2,1) @@ -2255,10 +2298,11 @@ E: Bulk.c+vec_(2*m4_U,ifelse(`$2',R,-)3.5*m4_U) e_fet(linespec, R, P, E|S ) d_fet(linespec, R, P, E|S ) c_fet(linespec, R, P ) + g_fet(linespec, R, P, shade spec ) with terminals S, D, G. arg 2: G pin drawn to right of curr direction arg 3: P-channel, default N - arg 4: envelope' + arg 4: envelope or simplified' define(`j_fet',`mosfet(`$1',`$2',ifelse(`$3',P,u,d)GSDF,`$4',`$5')') `Enhancement-mode FET e_fet(linespec,R,P,S,E)' define(`e_fet',`mosfet(`$1',`$2', @@ -2268,20 +2312,31 @@ define(`e_fet',`mosfet(`$1',`$2', define(`d_fet',`mosfet(`$1',`$2', ifelse(`$4',S,`TFDR'ifelse(`$3',P,u,d)S,`LFDSQ'ifelse(`$3',P,d,u)B), `$4',`$5')') - `Simplified switching c_fet(linespec,R,P) + `Simplified switching c_fet(linespec,R,P) arg 3: negated G pin' define(`c_fet',`mosfet(`$1',`$2',`ZSDF'ifelse(`$3',P,d)T,,`$4')') + `Graphene FET g_fet(linespec,R,P,shadespec)' +define(`g_fet',`mosfet(`$1',`$2',ifinstr(`$3',P,d,u)SKTF,`$4',`$5') ') + + `Fe_fet(linespec,R,chars) FET with + superimposed ferroelectric symbol: + arg1, arg2, arg3 are as for mosfet' +define(`Fe_fet',`mosfet(`$1',`$2',ifelse(`$3',,SDFT,`$3'),, + variable(,NN,60,dimen_/3, + at (0.5 between S and D)+vec_(0,ifelse(`$2',R,-)4*m4_U)); `$4')') + ` The comprehensive mosfet(linespec,R,BDEFGLQRSTXZ,E) Every drawn component is controlled by a letter or letter pair in arg 3; adding or changing elements is easily done by adding a test for a letter - or letter sequence: + or letter sequence. The modifiers u and d are optional: udB: center bulk connection pin; u or d arrow D: D pin and lead E: dashed substrate F: solid-line substrate udG: G pin to substrate at source; u or d arrow udH: G pin to substrate at center; u or d arrow + K: graphene hexagon L: G pin to channel (kept for compatibility for now; the same as dM below) udM: G pin to channel center or @@ -2301,13 +2356,23 @@ define(`mosfet', `define(`m4R',`ifelse(`$2',R,-)')dnl right orientation flag define(`dna_',`ifelse(`$3',,DSEdMuBQ,`$3')')dnl define(`m4s',ifinstr(dna_,Z,2.5,3.5))dnl size parameter + define(`m4hs',2.5)define(`m4hhx',m4hs*sqrt(3))dnl hex side len + define(`m4K',ifinstr(dna_,K,K))dnl [ ifelse(`$1',, - `tr_xy_init(,m4_U,m4R); S: tr_xy(-2,0); D: tr_xy(2,0)', + `tr_xy_init(,m4_U,m4R); ifinstr(dna_,K, + `S: tr_xy(-m4hs,0); D: tr_xy(m4hs,0); W: S; E: D + tr_xy_init(tr_xy(0,m4hhx/2-m4s),m4_U,m4R)', + `S: tr_xy(-2,0); D: tr_xy(2,0)')', `eleminit_(`$1'); tr_xy_init(last line.c,m4_U,m4R) - S: last line.start; line from S to tr_xy(-2,0) \ - then to tr_xy(-2,0)+vec_(0,m4R`'linethick pt__) - D: S+vec_(rp_len,0); line from D to tr_xy(2,0) \ - then to tr_xy(2,0)+vec_(0,m4R`'linethick pt__)') + ifinstr(dna_,K, + `S: last line.start; D: last line.end; + W: tr_xy(-m4hs,0); line from S to W + E: tr_xy( m4hs,0); line from D to E + tr_xy_init(tr_xy(0,m4hhx/2-m4s),m4_U,m4R)', + `S: last line.start; line from S to tr_xy(-2,0) \ + then to tr_xy(-2,0)+vec_(0,m4R`'linethick pt__) + D: S+vec_(rp_len,0); line from D to tr_xy(2,0) \ + then to tr_xy(2,0)+vec_(0,m4R`'linethick pt__)')') sc_draw(`dna_',B, `B: tr_xy(0,0); Bl: line from B to tr_xy(0,m4s) ifelse(m4a,,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(m4a,d,<-) \ @@ -2349,6 +2414,13 @@ define(`mosfet', to G; arrow m4c_l ht m4_Aht wid m4_Awd \ from tr_xy(0,(m4s+3-m4_Aht/(m4_U))) \ to tr_xy(0,(m4s+3))')') + sc_draw(`dna_',K, + `NW: W+ta_xy( m4hs/2, m4hhx/2) + SW: W+ta_xy( m4hs/2,-m4hhx/2) + SE: E+ta_xy(-m4hs/2,-m4hhx/2) + NE: E+ta_xy(-m4hs/2, m4hhx/2) + Kl: line from NW \ + to W then to SW then to SE then to E then to NE then to NW `$4'') sc_draw(`dna_',L, `G: tr_xy(-2,(m4s+3.5)) Ll: line from tr_xy(2,(m4s+1)) \ @@ -2391,18 +2463,20 @@ define(`mosfet', `Rl: line thick 2*linethick from tr_xy(-2,m4s)\ -vec_(0,m4R`'linethick*3/2 pt__) \ to tr_xy(2,m4s)-vec_(0,m4R`'linethick*3/2 pt__) ') - sc_draw(`dna_',S, + sc_draw(`dna_',S,`ifelse(m4K,K, + `Sl: arrow m4c_l ht m4_Aht*2/3 wid m4_Awd \ + from ifelse(m4a,u,NW to W,W to NW)', `Sl: line from tr_xy(-2,0) \ to tr_xy(-2,m4s) ifelse(m4a,,,`arrow m4c_l ht m4_Aht wid m4_Awd ifelse(m4a,d,<-) \ from tr_xy(-2,m4s/2)-vec_(0,m4R`'m4_Aht/2) \ - to tr_xy(-2,m4s/2)+vec_(0,m4R`'m4_Aht/2) ')') + to tr_xy(-2,m4s/2)+vec_(0,m4R`'m4_Aht/2) ')')') sc_draw(`dna_',T, `Tl: line from tr_xy(-2,(m4s+1)) \ to tr_xy(2,(m4s+1)) ifelse(m4a,d,`Nt: circle rad m4_U*2/3 with .c at tr_xy(0,(m4s+1+2/3))') Gl: line from tr_xy(0,`(m4s+1'`ifelse(m4a,d,+4/3))') \ - to tr_xy(0,ifelse(`$4',E,(m4s+4),(m4s+4))); G: Here') + to tr_xy(0,(m4s+4)); G: Here') sc_draw(`dna_',X,dnl From Matteo Agostinelli `B: tr_xy(0,0); Xv: line from B to tr_xy(0,m4s-1) Xh: line from tr_xy(-1.5,m4s-1) \ @@ -2442,31 +2516,37 @@ define(`$1',substr($1,0,m4I_)`'substr($1,m4t))')')dnl sc_draw(dna string, chars, iftrue, iffalse)' define(`sc_draw',`m4_dna(`$1',`$2')ifelse(m4I_,-1,`$4',`$3')') - `Element labels to the left, right, centre of - the current direction. Labels are spaced and - treated as math, but copied literally if double - quoted or defined by sprintf' + `Element labels at the start, centre, and end + of the last [] block (or a named [] block) + in the current direction. Labels are + spaced and treated as math, but copied + literally if double quoted or defined + by sprintf. + Arg4 can be above, below, left, right + to supplement the default position. + Arg5 is the optional name of a [] block + and is last [] by default.' `The hash (pound sign) is used in svg text so we temporarily turn off comments for svg' define(`rlabel',`ifsvg(`changecom(,)')dnl -m4label(`$1',`$2',`$3',.s_,below_,`$4')`'ifsvg(`changecom(`#',)')') +m4label(`$1',`$2',`$3',.s_,below_,`$4',`$5')`'ifsvg(`changecom(`#',)')') define(`llabel',`ifsvg(`changecom(,)')dnl -m4label(`$1',`$2',`$3',.n_,above_,`$4')`'ifsvg(`changecom(`#',)')') +m4label(`$1',`$2',`$3',.n_,above_,`$4',`$5')`'ifsvg(`changecom(`#',)')') define(`clabel',`ifsvg(`changecom(,)')dnl -m4label(`$1',`$2',`$3',,,`$4')`'ifsvg(`changecom(`#',)')') +m4label(`$1',`$2',`$3',,,`$4',`$5')`'ifsvg(`changecom(`#',)')') labels at centre and both ends of an element `dimen_' long define(`m4label',`dnl ifelse(`$1',,, `{m4lstring(`$1',"sp_`'iflatex(`$ `$1'$',`$1')`'sp_") \ - at last [].w_ $5 rjust_ $6};')dnl + at ifelse(`$7',,last [],`$7').w_ $5 rjust_ $6};')dnl ifelse(`$2',,, `{m4lstring(`$2',"sp_`'iflatex(`$ `$2'$',`$2')`'sp_") \ - at last []$4 $5 $6};')dnl + at ifelse(`$7',,last [],`$7')$4 $5 $6};')dnl ifelse(`$3',,, `{m4lstring(`$3',"sp_`'iflatex(`$ `$3'$',`$3')`'sp_") \ - at last [].e_ $5 ljust_ $6};')dnl + at ifelse(`$7',,last [],`$7').e_ $5 ljust_ $6};')dnl ') `dlabel(long,lateral,label,label,label,chars) Labels for oblique or aligned elements @@ -2625,7 +2705,6 @@ define(`series_', popdef(`elen_')] with .Start at Here; move to last [].End ') - `reversed(`macro name in quotes', macro args) reverse polarity of two-terminal element' define(`reversed',`eleminit_(`$2') @@ -2638,33 +2717,43 @@ define(`reversed',`eleminit_(`$2') define(`resized',`define(`m4resiztmp',dimen_)define(`dimen_',(dimen_)*(`$1'))dnl $2(shift(shift($@))) define(`dimen_',m4resiztmp)') - `variable(`element', type, angle, length) + `variable(`element', type, [+|-]angle, + length, at position) overlaid arrow or line on two-terminal element to show variablility: type = [A|P|L|[u]N|[u]NN][C|S] - A=arrow, P=preset, L=linear, N=nonlinear, - NN=symmetric nonlinear, u changes direction, - C=continuous, S=setpwise' + A=arrow; P=preset; L=linear; N=nonlinear; + NN=symmetric nonlinear, u changes direction; + C=continuous; S=setpwise. + If arg3 begins with + or -, then the argument + (typically -45) is relative to the current + drawing angle. If arg5 is blank the symbol + is placed over the last []' define(`variable',`$1 - {[ define(`dna_',`ifelse($2,,A,$2)') ang = ifelse(`$3',,45,`$3') - M4_T: Here+(Rect_(ifelse(`$4',,`dimen_*0.8',`$4'),ang)) - sc_draw(`dna_',P,`Line: line to M4_T - [line to (Rect_(dimen_/6,ang-90))] at Line.end') - sc_draw(`dna_',L,`Line: line to M4_T') - sc_draw(`dna_',NN,`Line: ifelse(m4a,u, - `line from Here-(dimen_/6,0) to Here \ - then to M4_T then to M4_T+(dimen_/6,0)', - `line from Here-(0,dimen_/6) to Here \ - then to M4_T then to M4_T+(0,dimen_/6)') ') - sc_draw(`dna_',N,`Line: line to M4_T - ifelse(m4a,u,`line up dimen_/6 from Line.end', - `line left dimen_/6 from Line.start')') - sc_draw(`dna_',A,`Line: arrow to M4_T') - sc_draw(`dna_',C,`move to Line.end+(dimen_*0.10,-dimen_*0.06) - line to Here+(Rect_(dimen_/6,ang))') - sc_draw(`dna_',S,`move to Line.end+(dimen_*0.10,-dimen_*0.12) + {[ define(`dna_',ifelse($2,,A,$2))define(`m4sgn',regexp(`$3',^ *[+-]))dnl + ang = ifelse(m4sgn,-1,,rp_ang*rtod_) ifelse(`$3',,45,`$3') + define(`m4a2',`ifelse(m4sgn,0,rp_ang-pi_/2,0)') dnl + define(`m4a3',`ifelse(m4sgn,0,rp_ang,pi_/2)') dnl + define(`m4tip',`dimen_/8')dnl + T: (Rect_(ifelse(`$4',,`dimen_*0.8',`$4'),ang)) + sc_draw(`dna_',P,`Line: line to T; C: Line.c + [line to (Rect_(m4tip,ang-90))] at Line.end') + sc_draw(`dna_',L,`Line: line to T; C: Line.c') + sc_draw(`dna_',NN,`C: 1/2 between Here and T + ifelse(m4a,u,`Line: line from Here+(rect_(-m4tip,m4a3)) to Here \ + then to T then to T+(rect_( m4tip,m4a3))', + `Line: line from Here+(rect_(-m4tip,m4a2)) to Here \ + then to T then to T+(rect_( m4tip,m4a2))')') + sc_draw(`dna_',N,`C: 1/2 between Here and T + ifelse(m4a,u,`Line: line to T then to T+(rect_(m4tip,m4a3))', + `Line: line from T to Here \ + then to Here+(rect_(-m4tip,m4a2))')') + sc_draw(`dna_',A,`Line: arrow to T; C: Line.c') + sc_draw(`dna_',C,`move to T+(dimen_*0.10,-dimen_*0.06) + line to Here+(Rect_(m4tip,ang))') + sc_draw(`dna_',S,`move to T+(dimen_*0.10,-dimen_*0.12) line up dimen_*0.06 then right dimen_*0.12 then up dimen_*0.06') - `$5'] with .Line.c at last [].c } ') + `$6'] with .C ifelse(`$5',,at last [].c,`$5') } ') `Line hopping over named lines, diverting left or right: @@ -2852,8 +2941,9 @@ define(`contact',`[ dnl ') `$3'] ') + `relaycoil( chars, wid, ht, U|D|L|R|degrees ) - chars: + chars: (see IEC 60617 S00305 - S00319) X or default: external lines from A2 and B2 AX external lines at positions A1,A3 BX external lines at positions B1,B3 @@ -2862,10 +2952,11 @@ define(`contact',`[ dnl SOR slow operating and release SR slow release HS high speed - HS high speed NAC unaffected by AC current AC AC current ML mechanically latched + MR mechanically resonant + PC pulse counter PO polarized RM remanent RH remanent @@ -2902,11 +2993,11 @@ define(`relaycoil',`[ ifelse(`$4',,,`setdir_(`$4')') {line to rvec_(0,-m4ht/8)} {line from rvec_(m4wd,0) to rvec_(m4wd,-m4ht/8)}} }') sc_draw(`rcdna_',SO, - `{ move to rvec_(0,-(m4ht*5/8)); m4fshade(0,lbox(m4wd,m4ht/4)) }') - sc_draw(`rcdna_',SR, `{ move to rvec_(0,-(m4ht*5/8)); {lbox(m4wd,m4ht/4)} {line from rvec_(0,-m4ht/8) to rvec_(m4wd, m4ht/8)} {line from rvec_(0, m4ht/8) to rvec_(m4wd,-m4ht/8)} }') + sc_draw(`rcdna_',SR, + `{ move to rvec_(0,-(m4ht*5/8)); m4fshade(0,lbox(m4wd,m4ht/4)) }') sc_draw(`rcdna_',HS, `{ move to rvec_(0,-(m4ht*5/8)); lbox(m4wd,m4ht/4) } { move to rvec_(m4wd/2,-(m4ht/2)); line to rvec_(0,-m4ht/4)} ') @@ -2927,6 +3018,22 @@ define(`relaycoil',`[ ifelse(`$4',,,`setdir_(`$4')') `{ move to rvec_(0,-(m4ht*11/16)); { lbox(m4wd,m4ht*3/8) } line from rvec_(0,m4ht*3/16) to rvec_(m4wd/2,-m4ht*3/16) \ then to rvec_(m4wd,m4ht*3/16) } ') + sc_draw(`rcdna_',MR, + `{ move to rvec_(m4wd/2,m4ht/2) + { m4tmp = rp_ang; dashline(to rvec_(0,m4ht*3/4),,m4ht*3/16,m4ht*3/32) + point_(m4tmp)} + move to rvec_(0,m4ht*3/8) + ifgpic( + `arc rad m4wd/2 cw from rvec_(-m4wd/2,0) \ + to Here with .c at rvec_(-m4wd/4,-m4wd/4) + arc rad m4wd/2 ccw from Here to rvec_(m4wd/2,0) with .c \ + at rvec_(m4wd/4,m4wd/4)', + `sinusoid(m4wd/6,twopi_/(m4wd),pi_/2,-m4wd/2,m4wd/2) \ + with .Origin at Here ') } ') + sc_draw(`rcdna_',PC, + `{ move to rvec_(0,m4ht/2+m4wd/2) + { lbox(m4wd,m4wd) } + circle diam m4wd/2 at rvec_(m4wd/2,0) } ') sc_draw(`rcdna_',PO, `{ move to rvec_(0,-(m4ht*5/8)); { lbox(m4wd,m4ht/4) } m4fshade(0, line to rvec_(0,m4ht/8) \ @@ -3282,16 +3389,42 @@ define(`ACsymbol',`[ Origin: Here with .Origin at Origin } ') `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') + `Deltasymbol(at position, keys, U|D|L|R|degrees) + keys: size=expr; + Arg4: drawing direction (default: Up)' +define(`Deltasymbol',`[ sq3 = sqrt(3) + setkey_(`$2',size,dimen_/10)dnl + setdir_(`$3',U) + line from vec_(vscal_(m4size,-sq3,0)) to \ + vec_(vscal_(m4size,-sq3,1)) then to Here \ + then to vec_(vscal_(m4size,-sq3,-1)) \ + then to vec_(vscal_(m4size,-sq3,0)) + `$4'; resetdir_ ] ifelse(`$1',,`at Here',`$1')') + + `Ysymbol(at position, keys, U|D|L|R|degrees) + keys: size=expr; type=G (grounded); + Arg4: drawing direction (default: Up)' +define(`Ysymbol',`[ sq3 = sqrt(3) + setkeys_(`$2',`size:dimen_/10:; type::N')dnl + setdir_(`$3',U) + C: Here + line from vec_(vscal_(m4size,-2/sq3,0)) to C + { line from vec_(vscal_(m4size,1/sq3,1)) to C \ + then to vec_(vscal_(m4size,1/sq3,-1)) } + ifelse(m4type,,,`line right_ m4size*3/2; corner + pushdef(`dimen_',m4size*4) ground popdef(`dimen_') ') + `$4'; resetdir_ ] ifelse(`$1',,`at Here',`$1')') + `DCsymbol(at position, len, ht, U|D|L|R|degrees) Arg4: drawing direction (default: current direction)' define(`DCsymbol',`[ define(`m4wid',`ifelse(`$2',,(dimen_/3),`($2)')')dnl - define(`m4ht',`ifelse(`$3',,`m4wid/5',`($3)')') + define(`m4ht',`ifelse(`$3',,`(m4wid/5)',`($3)')') setdir_(ifelse(`$4',,`ifdef(`m4a_',rp_ang*rtod_,0)',`$4')) - Origin: rvec_(m4wid/2,-m4ht/2) + Origin: rvec_(m4wid/2, m4ht/2) {line to rvec_(m4wid,0)} - dashline(from rvec_(0,-m4ht) to rvec_(m4wid,-m4ht),,m4wid/4) - `$5'; resetdir_ ] with .c ifelse(`$1',,`at Here',`$1')') + dashline(from rvec_(0, m4ht) to rvec_(m4wid, m4ht),,m4wid/4,m4wid/8) + `$5'; resetdir_ ] with .Origin ifelse(`$1',,`at Here',`$1')') `n-terminal box nterm(box specs; other commands, @@ -3389,7 +3522,7 @@ define(`microphone',`ifinstr(`$1',A, for j=-1 to 1 do { { circle at Here+(3*j*cspace,(abs(j)-3)*cspace) } if j != 0 then {{ circle at Here+(j*3/2*cspace,0) }} } - move up 5*cspace } ]', + move up 5*cspace }; ]', `[setdir_($1,R) define(`m4h',`ifelse(`$2',,`dimen_/2',`($2)')')dnl {L1: line from rvec_(m4h,-m4h/2) \ -- cgit v1.2.3