/out,plt_form,out
arg3=1
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
ph_shft=360/_mx_ph
*get,_tcurf,parm,currform,type
_setcurr=0
*afun,deg
*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,Sine Current Input
*elseif,currform,eq,'flat',then
*set,_amp_a
*dim,_amp_a,table,2
_amp_a(1,0)=-1e4,1e4
_amp_a(1,1)=1,1
/title, Flat Current Input
*endif
_setcurr=1
*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,7*_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
/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%
:end
/out