/out,g_c_res,out
*if,arg1,le,0,then
arg1=10
*endif
_coilamp=arg1
wire_gag
_wstk=stkthk
*get,_t_coil,parm,t_coil,type
*if,_t_coil,lt,0,then
_t_coil=20
*endif
esel,all
*get,_elmx,elem,,num,max
*set,c_heat
*dim,c_heat,,_n_slot,2
cmsel,,%cwnd_(1,1)%
*get,_elmx1,elem,,num,max
*get,_matn0,elem,_elmx1,attr,mat
_rsvx=0
*get,_rsvx,rsvx,_matn0,temp,0
*if,_rsvx,eq,0,then
copper,_matn0
*endif
*get,cwall,active,,time,wall
/nopr
/out,joule_h,mac
*msg,info
/nopr
*msg,info,cwall
*msg,info,_coilamp
*msg,info
esel,all
/out,g_c_res,out,,append
/gopr
*do,_i11,1,_n_slot
/gopr
*msg,info,_i11
cycle: %g
cmsel,,%cwnd_(_i11,1)%
*set,_mskv
*dim,_mskv,,_elmx
*set,_area
*dim,_area,,_elmx
*get,_elmx1,elem,,num,max
*get,_matn0,elem,_elmx1,attr,mat
*vget,_mskv(1),elem,,esel
*voper,_mskv(1),_mskv(1),ge,0
*vmask,_mskv(1)
*vget,_area(1),elem,1,geom
*vmask,_mskv(1)
*vscfun,_tare1,sum,_area(1)
nsle
csys,1
*get,rd1n,node,,mnloc,x
*get,rd1x,node,,mxloc,x
*get,th1n,node,,mnloc,y
*get,th1x,node,,mxloc,y
cmsel,,%cwnd_(_i11,2)%
*vget,_mskv(1),elem,,esel
*voper,_mskv(1),_mskv(1),ge,0
*vmask,_mskv(1)
*vget,_area(1),elem,1,geom
*vmask,_mskv(1)
*vscfun,_tare2,sum,_area(1)
nsle
csys,1
*get,rd2n,node,,mnloc,x
*get,rd2x,node,,mxloc,x
*get,th2n,node,,mnloc,y
*get,th2x,node,,mxloc,y
_c_turn=wnd_(_i11,3)
_anbt=abs(((th1x+th1n)-(th2x+th2n))/2)
*if,_anbt,ge,180,then
_anbt=360-_anbt
*endif
_wd1=.5*(rd1x+rd1n)*(3.1415/180)*(abs(_anbt))/2
_wd2=.5*(rd1x+rd1n)*(3.1415/180)*(abs(th1x-th1n))/2
_c_len=_wstk*ggeom+_wd1+_wd2
_c_wd=wnd_(_i1,7)
_w_a=awg(_c_wd,2)
*get,_rsvx,rsvx,_matn0,temp,_t_coil
_w_am=(w_geom*w_geom*_w_a)
_r_eff=4*_c_turn*_rsvx*_c_len/_w_am
c_heat(_i11,1)=_r_eff
_j_h=_r_eff*(_coilamp**2)/2
c_heat(_i11,2)=_j_h
_taret=_tare1 +_tare2
_bfe=_j_h/_taret
cmsel,a,%cwnd_(_i11,1)%
*vget,_mskv(1),elem,,esel
*voper,_mskv(1),_mskv(1),ge,0
/nopr
/out,joule_h,mac,,append
*set,_bfea
*dim,_bfea,,_elmx
*vfill,_bfea(1),ramp,_bfe
*vmask,_mskv(1)
*vwrit,sequ,_bfea(1)
('bfe,',f10.0,',hgen,1,',f15.3)
/out,g_c_res,out,,append
/gopr
*enddo
/nopr
/out,joule_h,mac,,append
*msg,info
/gopr
/out,g_c_res,out,,append
/gopr
*vscfun,totheat,sum,c_heat(1,2)
*msg,info,_coilamp
Peak amperage(A):________ %g
*msg,info
___Coil____Resistance(O)____RMS Heat(W)_______
*vwrit,sequ,c_heat(1,1),c_heat(1,2)
(f8.0,f12.4,f16.1)
*msg,info,nint(totheat*10)/10
Totat heat generation (W):________ %g
/out