/out,ld_coil,out
_mx_ph=0
_err=0
*vscfun,_mx_ph,max,wnd_(1,4)
*if,_mx_ph,eq,0,then
/nerr
*msg,error
The winding data does not exist, or it contains an error&
In particular, there are no phases specfied.
_err=1
*endif
/nerr,0,1e5
*if,_err,eq,1,:end
*if,_mx_ph,eq,2,then
ph_shft=90
*else
ph_shft=360/_mx_ph
*endif
*afun,deg
*get,_tcurf,parm,currform,type
_setcurr=0
*if,_tcurf,eq,3,then
*if,currform,eq,'sine',then
_amp_th=.5
*set,_amp_a
*dim,_amp_a,table,2*720*_mx_ph/_amp_th
*vfill,_amp_a(1,0),ramp,-720*_mx_ph,_amp_th
*vfunc,_amp_a(1,1),sin,_amp_a(1,0)
/title,Sine Current Input
*elseif,currform,eq,'cos',then
_amp_th=.5
*set,_amp_a
*dim,_amp_a,table,2*720*_mx_ph/_amp_th
*vfill,_amp_a(1,0),ramp,-720*_mx_ph,_amp_th
*vfunc,_amp_a(1,1),cos,_amp_a(1,0)
/title,COSine Current Input
*elseif,currform,eq,'flat',then
*set,_amp_a
*dim,_amp_a,table,2
_amp_a(1,0)=0,1e4
_amp_a(1,1)=1,1
/title, Flat Current Input
*endif
_setcurr=1
*if,arg3,eq,1,then
/grid,1
/axlab,x,Electrical Angle (D)
/axlab,y,Amp (A)
/num,-1
/xran
/yran
*vplo,_amp_a(1,0),_amp_a(1,1)
/num,1
/title, %mname%
*endif
*endif
*if,_setcurr,eq,0,then
*get,_tampa,parm,amp_a,type
*if,_tampa,ne,2,then
/nerr
/out
*msg,error
The arrays for the current form have not been defined&
the currform parameter has not been specified or was not&
a valid currform
/out,ld_coil,out,,append
_err=1
*else
*get,_damp_a,parm,amp_a,dim,x
*set,_amp_a
*dim,_amp_a,table,6*_damp_a
*vlen,_damp_a
*vfunc,_amp_a(1,0),copy,amp_a(1,0)
_phoff=-3*360
*voper,_amp_a(1,0),_amp_a(1,0),add,_phoff
*vlen,_damp_a
*vfunc,_amp_a(1,1),copy,amp_a(1,1)
*do,_ildc1,1,6
_nstloc=_ildc1*_damp_a+1
_ph_shft=360*(_ildc1-3)
*vlen,_damp_a
*vfunc,_amp_a(_nstloc,0),copy,amp_a(1,0)
*vlen,_damp_a
*voper,_amp_a(_nstloc,0),amp_a(1,0),add,_ph_shft
*vlen,_damp_a
*vfunc,_amp_a(_nstloc,1),copy,amp_a(1,1)
*enddo
*endif
*endif
/nerr,0,1e5
*if,_err,eq,1,:end
_arg1=0
_arg2=0
_arg3=0
*if,arg9,eq,1,then
*ask,_arg1,Electrical angle,0
*ask,_arg2,Enter Peak Current,1
*if,two_3ph,eq,1,then
*ask,_arg3,Enter Angle offset,0
*endif
arg1=_arg1
arg2=_arg2
arg3=_arg3
*endif
_cpkamp=arg2
/solu
*set,_char
*dim,_char,char,21
_char(1)='a','b','c','d','e','f','g','h','i','j'
_char(11)='k','l','m','n','o','p','q','r','s','t'
_char(21)='u'
*set,_cphc
*dim,_cphc,,_mx_ph
*set,_indx
*dim,_indx,,_mx_ph
*vfill,_indx(1),ramp,1,1
_arg1=arg1
*set,_indx1
*dim,_indx1,,_mx_ph
*if,arg2,ne,0,then
*if,_mx_ph,eq,1,then
_indx1(1)=arg1
*elseif,_mx_ph,eq,2,then
_indx1(1)=arg1
_indx1(2)=arg1+90
*elseif,_mx_ph,eq,3,then
_indx1(1)=arg1
_indx1(2)=arg1-120
_indx1(3)=arg1+120
*elseif,two_3ph,eq,1,then
*if,arg3,eq,0,then
arg3=0
*endif
_indx1(1)=arg1
_indx1(2)=arg1-60
_indx1(3)=arg1-120
_indx1(4)=arg1+arg3
_indx1(5)=arg1-60+arg3
_indx1(6)=arg1-120+arg3
*else
*vfill,_indx1(1),ramp,arg1,ph_shft
*endif
*stat,_indx1
/nopr
/out,ldt,mac
*vlen,_mx_ph
*vwrit,_indx(1),_indx1(1)
('_cphc(',f4.0,')=_amp_a(',f10.2,')')
/out,ld_coil,out,,append
/gopr
ldt
*else
_cpkamp=1
*do,_ilo1,1,_mx_ph
_cphc(_ilo1)=1
*enddo
*endif
*stat,_cphc
rlis
*get,_dimn,active,,solu,dimn
*if,_dimn,ne,3,then
*do,_il1,1,_n_slot
/gopr
*msg,info,_il1
line number in winding file: %i
_g_slot=cwnd_(_il1,1)
*msg,info,_g_slot,wnd_(_il1,4),wnd_(_il1,3)
out slot data: %c wnd(4) %i wnd(3) %i
cmsel,,%_g_slot%
_j_out=_cphc(wnd_(_il1,4))*wnd_(_il1,3)*_cpkamp
_j_out=_j_out/wnd_(_il1,5)
bfe,all,js,3,_j_out
_g_slot=cwnd_(_il1,2)
*msg,info,_g_slot,wnd_(_il1,4),wnd_(_il1,3)
IN slot data: %c wnd(4) %i wnd(3) %i
cmsel,,%_g_slot%
_j_in=-_cphc(wnd_(_il1,4))*wnd_(_il1,3)*_cpkamp
_j_in=_j_in/wnd_(_il1,6)
bfe,all,js,3,_j_in
*enddo
_g_c_res=0
*if,wnd_(1,7),gt,0,then
*if,_dimn,eq,2,then
g_c_res
_g_c_res=1
/out.ld_coil,out,,append
*endif
*endif
*else
*do,_il1,1,_n_slot
_camp1=_cphc(wnd_(_il1,4))*wnd_(_il1,3)*_cpkamp
rmod,wnd_(_il1,5),2,_camp1
rmod,wnd_(_il1,6),2,_camp1
*enddo
rlis
*endif
*get,_tcurr,parm,currform,type
/nopr
*if,_rotsol2,eq,1,then
/out,ld_coil,sum,,append
*msg,info, _meang
Current mechanical angle: %g
*else
/out,ld_coil,sum
*endif
*msg,info
_____CURRENTS APPLIED TO THE COIL______
*msg,info
*msg,info,n_wnd_f
Name of winding file:______ %c
*if,_tcurr,eq,3,then
*msg,info,currform
Current form:_____________ %c
*else
*msg,info
Current form:_____________ Defined in table AMP_A
*endif
*msg,info,arg1
Electrical angle:__________ %g
*if,two_3ph,eq,1,then
*msg,info,_mx_ph
Number of phases modeled:_ %i
*msg,info
Note: The additional three phases were modeled as a three phase winding&
which was offset from the first set of three phases
*msg,info,arg3
Angular offset of the second set of 3 phases&
from the first set:________ %g
*endif
*msg,info,_cpkamp
Peak Current (A):__________ %g
*msg,info
*msg,info
____Phase__ Phase_Factor__
*msg,info
*vwrite,sequ,_cphc(1)
(f10.0,f14.4)
*msg,info
*if,_g_c_res,eq,1,then
*msg,info
The following coil resistances and RMS heat loads have&
been generated. The RMS heat loads are stored in joule_h.mac&
and can be used after the model have been converted to&
a thermal model.
*msg,info,cwall
Wall time: %g at time of heat generation input
*msg,info
*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
Total heat generation (W):________ %g
*endif
*msg,info
__________________________
/out
/gopr
*if,_mg1,eq,0,then
*uili,ld_coil,sum
*endif
:end
/out