YZZ3Y

% Metadata for the PDF output
\hypersetup{
        pdftitle={A Y-connected three-phase supply, with a three wire cable, and a y-connected load},
        pdfauthor={Peter Jan Randewijk (peter@randewijk.dk)},
        pdfsubject={Balanced three-phase circuit theory},
        pdfkeywords={Balanced three-phase systems; three wire system, yn-connected loads}
        }

.PS

include(pstricks.m4)

scale=1.       # Scale set to inches

cct_init

# See Circuit Macros manual version 11.1.3, Section 13 "Writing macros", Example 4, Figure 82
define(`phsource',`source($1,
        #`Set angle to 0, draw sinusoid, restore angle'
        m4smp_ang = rp_ang; rp_ang = 0
        sinusoid(m4h/2,twopi_/(m4h),
        ifelse(`$2',,,`($2)/360*twopi_+')pi_/2,-m4h/2,m4h/2) with .Origin at Here
        rp_ang = m4smp_ang,
        $3,$4,$5)')

vsp=0.7
hsp=0.7
rsp=0.7

vsp=0.7
hsp=0.7
rsp=0.7

pi=3.1415927
deg=pi/180

define(`termrad_',`sourcerad_/4')
define(`terminal',`circle rad termrad_')

VN: dot(at (0,0))
VA: rect_(rsp,  90*deg)
VB: rect_(rsp, -30*deg)
VC: rect_(rsp,-150*deg)

NN: (VB.x+rsp/4+hsp,VN.y)
NA: (VB.x+rsp/4+hsp,VA.y+rsp/4)
NB: (VB.x+rsp/4+hsp,VB.y-rsp/4)
NC: (VB.x+rsp/4+hsp,VC.y-3*rsp/4)

Nn: (NN.x+hsp,NN.y)
Na: (NA.x+hsp,NA.y)
Nb: (NB.x+hsp,NB.y)
Nc: (NC.x+hsp,NC.y)

Vb: (Nb.x+rsp/4,Nb.y+rsp/4)
Vn: dot(at (Vb+(rect_(rsp,30*deg))))
Va: Vn+(rect_(rsp, 90*deg))
Vc: Vn+(rect_(rsp,-30*deg))

line invis right hsp/4 from Vc
line invis left  hsp/4 from VC

phsource(from VN to VA, 0);dlabel(0,-0.25,,\mathbf{E}_{A},)
phsource(from VN to VB, 240);dlabel(0,-0.25,,\mathbf{E}_{B},)
phsource(from VN to VC, 120);dlabel(0,-0.25,,\mathbf{E}_{C},)

ground(at VN)

#line from VN to NN chop 0 chop termrad_

line from VA to (VA,NA) then to (VB,NA)
ebox(to NA chop 0 chop termrad_);dlabel(0,0.15,,\mathbf{Z}_{A},)
line from VB to (VB,NB) 
ebox(to NB chop 0 chop termrad_);dlabel(0,0.15,,\mathbf{Z}_{B},)
line from VC to (VC,NC) then to (VB,NC)
ebox(to NC chop 0 chop termrad_);dlabel(0,0.15,,\mathbf{Z}_{C},)

#terminal with .c at NN
terminal with .c at NA
terminal with .c at NB
terminal with .c at NC

#"$N$" at (NN.x,NN.y+termrad_) above
"$A$" at (NA.x,NA.y+termrad_) above
"$B$" at (NB.x,NB.y+termrad_) above
"$C$" at (NC.x,NC.y+termrad_) above

#line from NN to Nn chop termrad_ chop termrad_
ebox(from NA to Na chop termrad_ chop termrad_);dlabel(0,0.15,,\mathbf{Z}_{Aa},)
ebox(from NB to Nb chop termrad_ chop termrad_);dlabel(0,0.15,,\mathbf{Z}_{Bb},)
ebox(from NC to Nc chop termrad_ chop termrad_);dlabel(0,0.15,,\mathbf{Z}_{Cc},)

#terminal with .c at Nn
terminal with .c at Na
terminal with .c at Nb
terminal with .c at Nc

#"$n$" at (Nn.x,Nn.y+termrad_) above
"$a$" at (Na.x,Na.y+termrad_) above
"$b$" at (Nb.x,Nb.y+termrad_) above
"$c$" at (Nc.x,Nc.y+termrad_) above

#line from Nn to Vn chop termrad_ chop 0
line from Na to (Va,Na) chop termrad_ chop 0 then to Va
line from Nb to (Vb,Nb) chop termrad_ chop 0 then to Vb
line from Nc to (Vc,Nc) chop termrad_ chop 0 then to Vc

ebox(from Va to Vn);dlabel(0,-0.15,,\mathbf{Z}_{a},)
ebox(from Vb to Vn);dlabel(0,-0.15,,\mathbf{Z}_{b},)
ebox(from Vc to Vn);dlabel(0,-0.15,,\mathbf{Z}_{c},)

linethick_(0.75)
\psset{linecolor=darkgray}
line dashed from (NB.x-rsp/8,NA.y+rsp/4) to (NB.x-rsp/8,NC.y-rsp/4)
line dashed from ((1/2 between Nb and Vb).x,Na.y+rsp/4) to ((1/2 between Nb and Vb).x,Nc.y-rsp/4)

dimension_(from (VC.x,NA.y+rsp/4)       to (NB.x-rsp/8,NA.y+rsp/4),hsp/4,"\textbf{Supply}",50bp__,termrad_,<->)
dimension_(from (NB.x-rsp/8,NA.y+rsp/4) to (Nc.x+rsp/8,NA.y+rsp/4),hsp/4,"\textbf{Line}"  ,30bp__,termrad_,<->)
dimension_(from (Nc.x+rsp/8,NA.y+rsp/4) to (Vc.x,NA.y+rsp/4)      ,hsp/4,"\textbf{Load}"  ,35bp__,termrad_,<->)

.PE