/out,b_wndsc,out
*msg,info
b_wndsc.mac 7/15/98
fini
/uis,msgpop,3
/nerr,0,1e5
/prep7
/gopr
_arg_1=arg1
*get,_dimn,active,,solu,dimn
*if,_n_prom,eq,0,then
*if,ar12,eq,1,then
*ask,_arg_1,Winding file in quotes,0
*if,_dimn,eq,3,then
*ask,_arg_2,Iron region element component,0
*ask,_arg_3,winding axial clearance,0
*ask,_arg_4,width of a single coil,0
*ask,_arg_5,height of single coil,0
*ask,_arg_6,angular location of first slot(CCW),0
*ask,_arg_7,maximum outer radius of slot,0
arg2=_arg_2
arg3=_arg_3
*if,arg3,le,0,then
arg3=ax_clear
*endif
arg4=_arg_4
*if,arg4,le,0,then
arg4=coil_w
*endif
arg5=_arg_5
*if,arg5,le,0,then
arg5=coil_h
*endif
arg6=_arg_6
*if,arg6,le,0,then
arg6=180/nsp
*endif
arg7=_arg_7
*if,arg7,le,0,then
arg7=maxslotr
*endif
*endif
*endif
*endif
arg1=_arg_1
_err=0
_arg1=arg1
*get,_t_parm,parm,_arg1,type
*if,_t_parm,lt,3,then
/nerr
*msg,error
An invalid Winding File name was input. The name of the file&
must be enclosed in single quotes ( 'bdc_1' )
_err=1
*endif
_moverot=0
*get,_twind,parm,windloc,type
*if,_twind,eq,3,then
*if,windloc,eq,'rotor',then
arg2='r_coil'
arg8=nrp
*endif
*if,mrk_nod,eq,0,then
/nerr,0,1e5
/out
*msg,err
The Marker node (MRK_NOD) is zero which means that the marker node number&
does not exist. The model must be rebuilt or MRK_NOD must be set to a node&
number which is on the rotor and is on the +X axis
/out,b_wndsc,out,,append
_err=1
*else
csys,1
*get,_zang,node,mrk_nod,loc,y
*if,_zang,ne,0,then
_moverot=1
*endif
*endif
*endif
*if,_moverot,ne,0,then
mvrotor,-_zang,1
/out,b_wndsc,out,,append
*endif
_arg2=arg2
*get,_t_parm,parm,_arg2,type
*if,_t_parm,lt,3,then
*if,_dimn,eq,3,then
*get,_t_siron,parm,s_iron_c,type
*if,_t_siron,ne,3,then
/nerr
*msg,error
An invalid element component name was input and the component defined by the&
macro to generate the 2D/3D model is not defined. The name of the Component&
must be character data and it must be enclosed in single quotes 's_iron'
_err=1
*else
_arg2=s_iron_c
arg2=_arg2
*endif
*endif
*if,_dimn,ne,3,then
_arg2='s_coil'
*endif
*else
*get,_t_parm,comp,_arg2,type
/nerr
*if,_t_parm,ne,2,then
*msg,error
The component for the coil or iron elements must be an Element&
component
_err=1
*else
esel,none
cmsel,,%_arg2%
*get,_ecnt,elem,,count
*if,_ecnt,eq,0,then
/nerr
*msg,error
The Element component specified for the coil or iron elements&
does not have any elements in it.
_err=1
*endif
*endif
*endif
*if,arg8,le,0,then
*get,_t_nsp,parm,nsp,type
*if,_t_nsp,ne,0,then
/nerr
/out
*msg,error
The number of stator teeth was not input&
and the parameter "NSP" does not exist.
/out,b_wndsc,out,,append
_nteeth=1
arg8=1
_err=1
*else
_nteeth=nsp
arg8=nsp
*endif
*else
_nteeth=arg8
*endif
*if,arg6,le,0,then
arg6=180/_nteeth
*endif
*if,_dimn,eq,3,then
*if,arg3,le,0,then
/nerr
/out
*msg,error
The Clearance between the stack and the winding was not input.
/out,b_wndsc,out,,append
_err=1
*endif
*if,arg4,le,0,then
/nerr
/out
*msg,error
The width of an individual coil was not input.
/out,b_wndsc,out,,append
_err=1
*endif
*if,arg5,le,0,then
/nerr
/out
*msg,error
The height of an individual coil was not input.
/out,b_wndsc,out,,append
_err=1
*endif
*if,arg7,le,0,then
/nerr
/out
*msg,error
The maximum radius of the slot was not input.
/out,b_wndsc,out,,append
_err=1
*endif
*endif
/nerr,0,1e5
*if,_err,eq,1,:exi
dparm3d
*get,_dimn,active,,solu,dimn
*if,_dimn,ne,3,then
coilreg=_arg2
_plt_cur=1
*endif
*if,_dimn,eq,3,then
s_iron_c=arg2
_plt_cur=0
*endif
esel,none
cm,winding,elem
esel,all
*get,_elmg,elem,,num,max
*set,_arg3
*dim,_arg3,,1
n_wnd_f=_arg1
_n_slot=0
*vread,_arg3(1),%_arg1%,wnd
(40x,f10.0)
_n_slot=_arg3(1)
*set,_arg3
*set,wnd_
*dim,wnd_,,_n_slot,7
*if,_n_slot,le,0,then
/nerr
/out
*msg,error,_arg1
The winding file( %c .wnd) is missing the number of lines&
in the file.
/out,b_wndsc,out,,append
_err=1
*endif
/nerr,0,1e5
*if,_err,eq,1,:end
*vread,wnd_(1,1),%_arg1%,wnd
(f10.0)
*vread,wnd_(1,2),%_arg1%,wnd
(10x,f10.0)
*vread,wnd_(1,3),%_arg1%,wnd
(20x,f10.0)
*vread,wnd_(1,4),%_arg1%,wnd
(30x,f10.0)
*vread,wnd_(1,7),%_arg1%,wnd
(50x,f10.0)
_val=1
*do,_iw1,1,_n_slot
_val=wnd_(_iw1,1)*wnd_(_iw1,2)*wnd_(_iw1,3)*wnd_(_iw1,4)
*if,_val,le,0,exit
*enddo
*if,_val,le,0,then
/nerr
/out
*msg,error,_arg1
The winding file( %c .wnd) is inconsistent with the number&
of lines specified. When reading the file, a blank line&
or a read error was encountered.
/out,b_wndsc,out,,append
_err=1
*endif
/nerr,0,1e5
*if,_err,eq,1,:end
*if,wnd_(1,7),gt,0,then
_c_gag=wnd_(1,7)
*do,_i1,1,_n_slot
*if,wnd_(_i1,7),le,0,then
wnd_(_i1,7)=_c_gag
*else
_c_gag=wnd_(_i1,7)
*endif
*enddo
*endif
*if,_dimn,eq,3,then
*if,arg9,eq,0,then
esel,,ename,,36
nsle
edel,all
ndel,all
nsel,all
esel,all
*get,_ncnt,node,,count
*if,_ncnt,gt,0,then
numc,elem
numc,node
*endif
*endif
*endif
*vscfun,_mx_ph,max,wnd_(1,4)
*set,_ph_n
*dim,_ph_n,char,21
_ph_n(1)='ph_a','ph_b','ph_c','ph_d','ph_e','ph_f','ph_g'
_ph_n(8)='ph_h','ph_i','ph_j','ph_k','ph_l','ph_m','ph_n'
_ph_n(15)='ph_o','ph_p','ph_q','ph_r','ph_s','ph_t','ph_u'
esel,none
*do,_iw2,1,_mx_ph
cm,%_ph_n(_iw2)%,elem
*enddo
*set,_sl_c
*dim,_sl_c,,_nteeth
*if,_dimn,eq,3,then
*get,_etyp,etyp,,num,max
_etyp=_etyp+1
_s_tol=.05*arg5
_flat=ar11
*do,_iw1,1,_n_slot
/gopr
*msg,info,_iw1
cycle: %i
_1=wnd_(_iw1,1)
_2=wnd_(_iw1,2)
_3=wnd_(_iw1,3)
_sl_c(_1)=_sl_c(_1)+1
_sl_c(_2)=_sl_c(_2)+1
_inr=(arg7-arg5/2-(_sl_c(_1)-1)*arg5)-_s_tol
_our=(arg7-arg5/2-(_sl_c(_2)-1)*arg5)-_s_tol
esel,none
g_3dcoil,_1,_2,_3,arg3,arg8,_inr,_our,arg4,arg5,arg6,_etyp, 1,_flat
/out,b_wndsc,out,,append
*if,_no_arc,eq,1,then
wnd_(_iw1,5)=_rl_mx
wnd_(_iw1,6)=0
*else
wnd_(_iw1,5)=_rl_mx-1
wnd_(_iw1,6)=_rl_mx
*endif
esel,r,ename,,36
elis
_cn=_ph_n(wnd_(_iw1,4))
cmsel,a,%_cn%
cm,%_cn%,elem
cmsel,a,winding
cm,winding,elem
*list,g_3dcoil,out
*msg,info
***************************************************
*enddo
*if,ar10,eq,1,then
cmsel,,winding
nsle
cmsel,a,n_rotor
cm,n_rotor,node
cmsel,a,e_rotor
cm,e_rotor,elem
*endif
*endif
*if,_dimn,ne,3,then
*do,_iw0,1,_n_slot
_1=wnd_(_iw0,1)
_2=wnd_(_iw0,2)
_sl_c(_1)=_sl_c(_1)+1
_sl_c(_2)=_sl_c(_2)+1
*enddo
*vscfun,_mxcps,max,_sl_c(1)
*set,cwnd_
*dim,cwnd_,char,_n_slot*_mxcps*2,2
*set,_sec_n
*dim,_sec_n,char,_n_slot*_mxcps*2
*set,_exist
*dim,_exist,,_n_slot*_mxcps*2
*vfill,_exist(1),ramp,1000,1
/nopr
/out,data
*vwrit,_exist(1)
(2x,'c',f5.0)
/out,b_wndsc,out,,append
/gopr
*vread,_sec_n(1),data
(2x,a5)
*stat,_sec_n,1,10
*set,_exist
*dim,_exist,,_n_slot*_mxcps*2
_delth=360/_nteeth
_iname=0
*do,_iw1,1,_n_slot
/gopr
*msg,info,_iw1
cycle in _IW1: %i
_1=wnd_(_iw1,1)
_2=wnd_(_iw1,2)
_3=wnd_(_iw1,3)
_4=wnd_(_iw1,4)
_cn=_ph_n(wnd_(_iw1,4))
_sang=(_1-1)*_delth
_eang=_sang+_delth
csys,1
cmsel,,coilreg
nsle
nsel,r,loc,y,_sang,_eang
esln,,1
cm,c_slot,elem
*if,_sl_c(_1),eq,1,then
g_area
/out,b_wndsc,out,,append
_iname=_iname+1
cwnd_(_iw1,1)=_sec_n(_iname)
cm,%_sec_n(_iname)%,elem
wnd_(_iw1,5)=t_area
*else
*if,_exist(_1),gt,0,then
_exslot=_sec_n(_exist(_1))
cmsel,u,%_exslot%
esel,u,mat,,1
_iname=_iname+1
cwnd_(_iw1,1)=_sec_n(_iname)
cm,%_sec_n(_iname)%,elem
g_area
/out,b_wndsc,out,,append
wnd_(_iw1,5)=t_area
*else
g_area
/out,b_wndsc,out,,append
nsle
csys,1
*get,_rdmx1,node,,mxloc,x
*get,_c_cthx,node,,mxloc,y
*get,_c_cthn,node,,mxloc,y
*if,_c_cthx*_c_cthn,lt,0,then
*if,_c_cthx-_c_cthn,gt,90,then
_c_cthn=_c_cthn+180
*endif
*endif
_c_ave=.5*(_c_cthx+_c_cthn)
_nd_out=node(_rdmx1,_c_ave,0)
esln
cmsel,r,coilreg
*get,_elmx1,elem,,num,max
*get,_c_rlx,elem,_elmx1,attr,real
cmsel,,c_slot
esel,r,real,,_c_rlx
_iname=_iname+1
cwnd_(_iw1,1)=_sec_n(_iname)
cm,%_sec_n(_iname)%,elem
g_area
/out,b_wndsc,out,,append
wnd_(_iw1,5)=t_area
_exist(_1)=_iname
*endif
*endif
_sang=(_2-1)*_delth
_eang=_sang+_delth
csys,1
cmsel,,coilreg
nsle
nsel,r,loc,y,_sang,_eang
esln,,1
cm,c_slot,elem
*if,_sl_c(_2),eq,1,then
g_area
/out,b_wndsc,out,,append
_iname=_iname+1
cwnd_(_iw1,2)=_sec_n(_iname)
cm,%_sec_n(_iname)%,elem
wnd_(_iw1,6)=t_area
*else
*if,_exist(_2),gt,0,then
_exslot=_sec_n(_exist(_2))
cmsel,u,%_exslot%
esel,u,mat,,1
_iname=_iname+1
cwnd_(_iw1,2)=_sec_n(_iname)
g_area
/out,b_wndsc,out,,append
cm,%_sec_n(_iname)%,elem
wnd_(_iw1,6)=t_area
*else
g_area
/out,b_wndsc,out,,append
nsle
csys,1
*get,_rdmx1,node,,mxloc,x
*get,_c_cthx,node,,mxloc,y
*get,_c_cthn,node,,mxloc,y
*if,_c_cthx*_c_cthn,lt,0,then
*if,_c_cthx-_c_cthn,gt,90,then
_c_cthn=_c_cthn+180
*endif
*endif
_c_ave=.5*(_c_cthx+_c_cthn)
_nd_out=node(_rdmx1,_c_ave,0)
esln
cmsel,r,coilreg
*get,_elmx1,elem,,num,max
*get,_c_rlx,elem,_elmx1,attr,real
cmsel,,c_slot
esel,r,real,,_c_rlx
_iname=_iname+1
cwnd_(_iw1,2)=_sec_n(_iname)
g_area
/out,b_wndsc,out,,append
cm,%_sec_n(_iname)%,elem
wnd_(_iw1,6)=t_area
_exist(_2)=_iname
*endif
*endif
*enddo
*do,_iw2,1,_mx_ph
esel,none
*do,_iw3,1,_n_slot
/gopr
*msg,info,_iw3
_IW3: %i
*if,wnd_(_iw3,4),eq,_iw2,then
_cn=cwnd_(_iw3,1)
cmsel,a,%_cn%
_cn=cwnd_(_iw3,2)
cmsel,a,%_cn%
*endif
*enddo
cm,%_ph_n(_iw2)%,elem
*enddo
esel,none
*do,_iw2,1,_mx_ph
_cn=_ph_n(_iw2)
cmsel,a,%_cn%
*enddo
cm,winding,elem
*endif
/nopr
/out,%_arg1%,sum
*msg,info
___________SUMMARY OF THE WINDING GENERATION___________
*msg,info
*msg,info,_arg1
Name of winding file:______________ %c .wnd
*if,_twind,ne,3,then
*msg,info
Location of winding:_______________ Stator
*else
*msg,info
Location of winding:_______________ Rotor
*endif
*msg,info,_arg2
Name of coil element component:____ %c
*msg,info,_mx_ph
Number of Phases:__________________ %i
*msg,info,_n_slot
Number of coils:___________________ %i
*if,_dimn,eq,3,then
*if,ar10,eq,1,then
*msg,info
The COIL elements are a part of the rotor component&
and will be rotated with the rest of the rotor elements
*endif
*endif
*msg,info
*msg,info
*msg,info
Explanations for the Winding:
*msg,info
The coils associated with each phase are contained in a separate&
element component. Phase 1 coils are contained in the component ph_a&
and Phase 2 in ph_b, etc. All elements to apply Amp-turns are&
contained in the element component "winding"
*msg,info
*msg,info
In the generation of the winding, certain data was also stored for use&
during the solution phase to allow the currents to be applied to the&
winding
/out
*if,_nomsg,eq,0,then
*uili,%_arg1%,sum
*endif
/gopr
/out,b_wndsc,out,,append
*if,_idbug,eq,0,then
_arg1= $ _arg2= $ _t_parm=
*endif
:exi
cmsel,,%arg2%
cmsel,a,winding
nsle
/eshap,1
eplo
_err=
_arg1=
_arg2=
_t_parm=
:end
/out