Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/extras/SPM.m4

raw
1 .PS
2 # `SPM.m4 Salient-pole machine'
3 gen_init
4
5 outerrad = 1
6 medrad = 11/16
7 windings = 6
8 polewid = 3/8
9 twid = (outerrad-medrad)/3
10 srad = twid/4
11 halfline = ifgpic(0,linethick/2 pt__)
12
13 C: circle rad outerrad at 0,0
14 line from Rect_(outerrad,180+60) to (C.w,C.s) then down polewid/2 \
15 then right 2*outerrad then up polewid/2 then to Rect_(outerrad,-60)
16
17 line from C+(medrad,-twid/2) right twid then up twid then left twid \
18 chop -halfline
19 E: Here+(halfline,0)
20 for i = 1 to windings*2 do {
21 Point_(i*360/(windings*2))
22 arc ccw from E to C+vec_(medrad,-twid/2) with .c at C
23 E: rvec_(0,twid)
24 line to rvec_(twid,0) then to rvec_(twid,twid) then to E chop -halfline
25 }
26 move to C
27 for i = 0 to 3 do {{
28 Point_(i*90)
29 for_(-1,1,2,
30 `{ line from rvec_(polewid/2,m4x*polewid/2) \
31 to rvec_(medrad*2/3,m4x*polewid/2) \
32 then to rvec_(medrad*2/3,m4x*(polewid/2+polewid/5)) \
33 chop -halfline chop 0
34 { move to rvec_(0,-(m4x*polewid/5))
35 line from rvec_(-twid/2,m4x*twid/4) to rvec_(-twid/4,m4x*twid/4) \
36 then to rvec_(-twid/4,m4x*twid*3/4) \
37 then to rvec_(-twid*7/4,m4x*twid*3/4) \
38 then to rvec_(-twid*7/4,m4x*twid/4) \
39 then to rvec_(-twid/2,m4x*twid/4) }
40 T: rvec_(srad,0)
41 arc ifelse(m4x,-1,c)cw to (1+srad/distance(T,C))<C,T> with .c at T
42 }')
43 arc cw from last arc.end to 2nd last arc.end with .c at C
44 }}
45
46 t = distance(C,last arc.s)
47 "\sf N" at C+(0, t) below
48 "\sf N" at C+(0,-t) above
49 "\sf S" at C+(-t,0) ljust
50 "\sf S" at C+( t,0) rjust
51
52 for i = 0 to windings/2-1 do {
53 for j = 1 to 2 do { sprintf("$\char%g_%g$",97+i,j) \
54 at Rect_(outerrad-twid,180*(2-j)-i*360/windings) }
55 for j = 1 to 2 do { sprintf("$\char%g_%g'$",97+i,j) \
56 at Rect_(outerrad-twid,180*(2-j)-90-i*360/windings) }
57 }
58
59 .PE