/out,rotsol2,out
/nerr,0,1e4
/uis,msgpop,3
tormeth=3
_mg1=1
_tor_loc=1
_fg_tor=4e-6
_full=0
cmsel,,stator
csys,1
*get,_thmn,node,,mnloc,y
*get,_thmx,node,,mxloc,y
*if,_thmx-_thmn,gt,180.0,then
_full=1
*endif
_half=.5*(_thmn+_thmx)
*if,arg8,eq,-1,then
*ask,_arg_1,Starting Mechanical Angle,0
*ask,_arg_2,Ending Mechanical Angle,_half
*ask,_arg_3,Incremental Mechanical Angle,0
*ask,_arg_4,starting electrical angle,0
*ask,_arg_5,peak current (A),1
*ask,go_now,1 to continue OR 0 to Stop,0
arg1=_arg_1
arg2=_arg_2
arg3=_arg_3
arg4=_arg_4
arg5=_arg_5
arg6=1
arg8=0
*else
go_now=1
*endif
*if,go_now,eq,0,:end
esel,none
cmsel,,stator
*get,_elems,elem,,count
esel,none
cmsel,,rotor
*get,_elemr,elem,,count
_err=0
*if,_elems*_elemr,le,0,then
_err=1
/nerr
/out
*msg,error
Part of the model is missing-no action
*endif
*if,npole,le,0,then
/nerr
/out
*msg,error
The parameter NPOLE (number of poles) is not defined. No action
/out,rotsol2,out,,append
_err=1
*endif
/nerr,0,1e5
*if,_err,gt,0,:end
g_mark
/out,rotsol2,out,,append
_pk_amp=arg5
cmsel,,rotor
esel,u,mat,,1,4,3
cm,r_iron,elem
cycle=0
*get,_wall,active,,time,wall
/out,cog,sum
*msg,info
__RUNNING SUMMARY OF SOLUTIONS ____
*msg,info
*msg,info,_wall
Starting Wall clock time:____________ %g
*msg,info
/out,rotsol2,out,,append
d_parm
csys,1
esel,,mat,,5
nsle
esln
esel,r,mat,,1
nsle
esln,,1
esel,r,mat,,1
nsle
csys,1
*get,_rmax,node,,mxloc,x
cm,ce,elem
nsel,r,loc,x,_rmax-.000001,_rmax+1
esln,r
nsle
cm,ce1,elem
cmsel,,ce
cmsel,u,ce1
cm,tor_sta,elem
nsle
esel,,mat,,2,3
nsle
esln
esel,r,mat,,1
nsle
esln,,1
esel,r,mat,,1
nsle
cm,tor_rot,elem
fini
/solu
fmagbc,'r_iron'
/out,rotsol2,out,,append
alls
dsys
cmsel,,stator
csys,1
*get,_staang,node,,mnloc,y
*get,_endang,node,,mxloc,y
_delang=abs(_staang-_endang)
*if,_delang,gt,180.000001,then
sym_fac=1
*else
sym_fac=360/_delang
*endif
/gopr
*if,arg9,eq,0,then
arg9=0
*else
arg9=1
*endif
_plt_cur=0
*get,_rcpu1,active,,time,cpu
_nomsg=1
*if,arg2,eq,0,then
arg2=arg1
*endif
*if,arg2,gt,360,then
arg2=360
*endif
*if,arg3,eq,0,then
arg3=0
*endif
_me_elo=0
/sho,xxx
alls
_amax=abs(arg1)
*if,abs(arg2),gt,_amax,then
_amax=abs(arg2)
*endif
/pnum,mat,1
/num,1
/auto
/pbf,js,1
*if,_full,eq,0,then
mvrotor,_amax
/out,rotsol2,out,,append
eplo
/user
mvrotor,-_amax
/out,rotsol2,out,,append
*else
eplo
/user
*endif
/pbf,js
/out,rotsol2,out,,append
fini
/prep7
alls
/uis,msgpop,3
/out,rotsol2,out,,append
/sho,%mname%,f33
*set,_offon
*dim,_offon,,8
*set,_plt_int
*dim,_plt_int,,4
_plt_int(1)=arg6,arg7,arg8,arg9
*set,_plt_opt
*dim,_plt_opt,,7
*do,_i_1,1,3
*do,_i_2,1,7
*if,_plt_int(_i_1),eq,_i_2,then
_plt_opt(_i_2)=1
*endif
*enddo
*enddo
*if,abs(arg3),lt,.0001,then
_numcp=1
_delth=0
arg2=arg1
_delnai=0
*else
_numcp=nint((arg2-arg1)/abs(arg3))+1
_delth=(arg2-arg1)/(_numcp-1)
_delnai=_delth
*endif
_strnai=arg1
*set,_rphst
*dim,_rphst,,_numcp
*do,_i1n,1,_numcp
_rphst(_i1n)=_strnai+(_i1n-1)*_delnai
*enddo
*stat,_rphst
*set,_anl_mx
*dim,_anl_mx,,5
*set,_rotm
*dim,_rotm,table,_numcp
*set,_rot_m
*dim,_rot_m,table,_numcp,3
_rot_m(0,0)=1e-7
_rot_m(0,1)=1
_rot_m(0,2)=2
_rot_m(0,3)=3
fini
/solu
alls
_mg1=1
/nopr
/gopr
/out,rotsol2,out,,append
*if,_nosolve,eq,0,then
*if,_full,eq,1,then
csys,1
*get,_cth0,node,mrk_nod,loc,y
csys
_cmv_0=arg1-_cth0-_delth
*if,_cmv_0,ne,0,then
mvrotor,_cmv_0,1
/out,rotsol2,out,,append
*endif
*endif
_c_elc=arg4-npole/2*_delth
*do,_i_1,1,_numcp
/gopr
_mg1=1
cycle=cycle+1
*msg,info,cycle
Solution No:_____ %i
fini
/prep7
*if,cw_mot,ne,0,then
_meang=_me_elo-_rphst(_i_1)
*else
_meang=_me_elo+_rphst(_i_1)
*endif
*if,_full,eq,1,then
mvrotor,_delth,1
/out,rotsol2,out,,append
*else
mvrotor,_meang,1
*endif
/out,rotsol2,out,,append
csys,1
_c_theta=ny(mrk_nod)
esel,,esys,,50
nsle
csys,1
*get,_magang,node,,mnloc,y
*msg,info,_i_1,_magang
cycle: %i magnetangle %g
_c_elc=_c_elc+npole/2*_delth
ld_coil,_c_elc,_pk_amp
/out,rotsol2,out,,append
/uis,msgpop,3
/nerr,0,1e6,-1
mvpsol
/out,rotsol2,out,,append
fini
/post1
_mg1=1
*if,_tor_loc,eq,0,then
cmsel,,rotor
esel,u,mat,,1
nsle
csys,1
*get,_rdmx,node,,mxloc,x
_rtorq=_rdmx+_fg_tor
*msg,info,_fg_tor,_rdmx,_rtorq
_fg_tor , _rdmx , _rtorq: %g : %g : %g
*else
cmsel,,stator
esel,r,mat,,5
nsle
csys,1
*get,_rdmn,node,,mnloc,x
_rtorq=_rdmn-_fg_tor
*endif
esel,,mat,,5
cm,statiron,elem
esel,all
fini
/post1
_mg1=1
torqsum,'r_iron'
/out,rotsol2,out,,append
ckslot
/out,rotsol2,out,,append
*list,ckslot,sum
/gopr
alls
c_eng=0
s_eng=0
g_force,,,_meang,cycle,_numcp
/out,rotsol2,out,,append
*if,stkthk,le,0,then
_stk=ggeom
*else
_stk=stkthk*ggeom
*endif
*msg,info,_i_1,torqmx,torqvw,torque
I: %i (MX): %g (VW): %g (mx-li): %g
*if,tormeth,le,1,then
_torcal=torque*sym_fac
*elseif,tormeth,eq,2,then
_torcal=torqmx*sym_fac*_stk
*else
_torcal=torqvw*sym_fac*_stk
*endif
t_sene=t_sene*_stk*ggeom*sym_fac
t_sene=1
*get,_wall,active,,time,wall
/out,cog,sum,,append
*msg,info,cycle
Cycle Number__________________________ %i
*msg,info,_wall
Current Wall Clock Time:______________ %g
*msg,info,_meang
Current mechanical angle of rotor:____ %g
*msg,info,_torcal*141.8
Current torque by MXWF (oz-in):__________ %g
*msg,info
* * * * * * * * * * * * * * * * * * * * * *
/out,rotsol2,out,,append
/gopr
_angrot=_meang
_rotm(_i_1,0)=_angrot
_rotm(_i_1,1)=_torcal*141.8
_rot_m(_i_1,0)=_angrot
_rot_m(_i_1,1)=t_sene
alls
/out,rotsol2,out,,append
/nopr
/out,_data
*set,_ti_ang
*dim,_ti_ang,,1
*vlen,1
*vwrite,_rphst(_i_1)
(f10.1)
/out,rotsol2,out,,append
*vread,_ti_ang(1),_data
(f10.1)
/title,Design: %mname% / Mechanical Angle: %_ti_ang(1)%
/gopr
*if,_plt_opt(1),ne,0,then
*if,b_mx,eq,0,then
b_mx=2.8
*endif
/cont,1,9,0,,b_mx
*if,_plt_cur,eq,1,then
cmsel,u,s_coil
*endif
_valmxx=b_mx
_plvmxn=1
esel,u,mat,,1,6,5
nsle
/num
plns,b,sum
esel,all
nsel,all
/uis,msgpop,3
/out,rotsol2,out,,append
esel,u,mat,,1,6,5
nsle
/graph,full
nsort,b,sum,,,1
*get,valmx_x,sort,,max
*msg,info,cycle,valmx_x
Cycle Number: %i Maximum B magnitude: %g
*if,valmx_x,gt,_anl_mx(1),then
_anl_mx(1)=valmx_x
*endif
*endif
*if,_plt_opt(2),ne,0,then
*if,h_mx,eq,0,then
h_mx=850000
*endif
/cont,1,9,0,,h_mx
*if,_plt_cur,eq,1,then
cmsel,u,s_coil
*endif
_valmxx=h_mx
_plvmxn=1
plns,h,sum
/uis,msgpop,3
/out,rotsol2,out,,append
*msg,info,cycle,valmx_x
Cycle Number: %i Maximum H magnitude: %g
*if,valmx_x,gt,_anl_mx(2),then
_anl_mx(2)=valmx_x
*endif
*endif
*if,_plt_opt(3),ne,0,then
etab,mu,nmisc,1
*get,_unit,active,,solu,emunit
_muz=1.2566e-6
*if,_unit,eq,2,then
_muz=1
*endif
sadd,mu,mu,,1/_muz
*if,mu_mx,eq,0,then
mu_mx=14500
*endif
/cont,1,9,0,,mu_mx
esort,etab,mu,,,1
*get,valmxx,sort,,max
*msg,info,cycle,valmxx
Cycle Number: %i Maximum MU: %g
*if,valmxx,gt,_anl_mx(3),then
_anl_mx(3)=valmxx
*endif
esel,u,mat,,1,6,5
*if,_plt_cur,eq,1,then
cmsel,u,s_coil
*endif
_valmxx=mu_mx
_plvmxn=1
pleln,'mu'
/uis,msgpop,3
/out,rotsol2,out,,append
*endif
*if,_plt_opt(4),ne,0,then
*if,se_mx,eq,0,then
se_mx=1
*endif
senergy,s_ce
alls
valmxx=s_eng
*if,valmxx,gt,_anl_mx(4),then
_anl_mx(4)=valmxx
*endif
/cont,1,9,0,,se_mx
*if,_plt_cur,eq,1,then
cmsel,u,s_coil
*endif
_valmxx=se_mx
_plvmxn=1
pleln,'mg_eng'
/uis,msgpop,3
/out,rotsol2,out,,append
*endif
*if,_plt_opt(5),ne,0,then
emagerr
esort,etab,bn_err,,,1
*get,valmxx,sort,,max
*if,valmxx,gt,_anl_mx(5),then
_anl_mx(5)=valmxx
*endif
*if,ber_mx,eq,0,then
ber_mx=1
*endif
/cont,1,9,0,,ber_mx
*if,_plt_cur,eq,1,then
cmsel,u,s_coil
*endif
_valmxx=ber_mx
_plvmxn=1
pleln,'bn_err'
/uis,msgpop,3
/out,rotsol2,out,,append
*endif
*if,_plt_opt(6),ne,0,then
alls
plf2_d,27
/uis,msgpop,3
/out,rotsol2,out,,append
*endif
*if,_plt_opt(7),ne,0,then
alls
/view
/auto
/yrang,-1.2,1.2
/axlab,y,B-radial (T) in Air Gap
/axlab,x,Arclength in Air Gap (m) from +X Axis
/grid,1
/xrange
/num,2
plpa,br
/dist,,_g_dis
/focus,1,_pfx,_pfy
/user
/uis,msgpop,3
/yrange
*endif
*msg,info,_i_1
Before the last enddo: cycle: %i
*enddo
b_mx=_anl_mx(1)
h_mx=_anl_mx(2)
mu_mx=_anl_mx(3)
se_mx=_anl_mx(4)
berr_mx=_anl_mx(5)
*get,_rcpu2,active,,time,cpu
_del1=_rcpu2-_rcpu1
/auto
/view
/axlab,x,Mechanical Angle (D)
/axlab,y,Torque (N-M)
/grid,1
/num,2
_max_d=arg2
_min_a=arg1
_del_a=_max_d-_min_a
/title, Design: %mname% / Torque (MXWF) vs. Angle
*vscfun,zz,max,_rotm(1,1)
*vscfun,zz1,min,_rotm(1,1)
/yran,zz1,zz*1.05
/yran
zz= $ zz1=
/gopr
_inumpt=_numcp
*set,_sene
*dim,_sene,,_numcp,2
*vfun,_sene(1,1),copy,_rotm(1,0)
*vfun,_sene(1,2),copy,_rotm(1,1)
*stat,_sene
fini
/prep7
csys
cm,_c_k,kp
ksel,all
lsel,none
*get,_kpmx,kp,,num,max
_kpmx=_kpmx+1
k,_kpmx,_sene(1,1),_sene(1,2)
k,_kpmx+1,_sene(_inumpt,1),_sene(_inumpt,2)
flst,2,2,3
fitem,2,_kpmx
fitem,2,_kpmx+1
flst,3,_inumpt-2,8
*do,_i1,2,_inumpt-1
fitem,3,_sene(_i1,1),_sene(_i1,2),0
*enddo
bsplin,P51X,P51X
*get,bh_spl,line,,num,max
_arg2=bh_spl
*get,_mxh,line,_arg2,leng
_c_fract=-1/(_inumpt-1)
_inumpt=51
*set,_sene1
*dim,_sene1,table,_inumpt,2
_sene1(0,0)=1e-7
_sene1(0,1)=1
_sene1(0,2)=2
*get,_mxh,line,_arg2,leng
*do,_i2,1,_inumpt
_c_fract=_c_fract+1/(_inumpt-1)
_sene11=lx(_arg2,_c_fract)
_sene10=ly(_arg2,_c_fract)
_sene1(_i2,0)=_sene11
_sene1(_i2,1)=_sene10
*enddo
/auto
/axlab,y,Torque (oz-in)
/axlab,x,Mech. Deg.
_arg3=arg3
/title,%mname%
/grid,1
*vplo,_sene1(1,0),_sene1(1,1)
*vscfun,_cogtmn,min,_rotm(1,1)
*vscfun,_cogtmx,max,_rotm(1,1)
*vscf,_max_a,max,_rotm(1,0)
*vscf,_min_a,min,_rotm(1,0)
_del_a=_max_a-_min_a
*vfun,_rot_m(1,1),copy,_rotm(1,1)
*voper,_rot_m(1,2),_rot_m(1,1),int1,_rot_m(1,0)
rms_tor=nint(_rot_m(_max_a,2)/_del_a)
/title, Design: %mname%
/sho,xxx
/sho,term
/axlab,y,Torque (oz-in)
/axlab,x,Mech. Deg.
/grid,1
/xran,arg1,arg2
*vplo,_sene1(1,0),_sene1(1,1)
/xran
/nopr
/out,torqmach,sum
*msg,info
>____SUMMARY OF MAXIMUMS/RMS FOR THE SOLUTIONS__<
*msg,info,arg1
Starting Mech. Angle (D):_______________________ %g
*msg,info,arg2
Ending Mech. Angle (D):_________________________ %g
*msg,info,arg3
Increment Mech. Angle (D):______________________ %g
*msg,info,arg4
Starting Electrical Angle (D):__________________ %g
*msg,info,_me_elo
Location of Zero Elec. Ang.(+CCW,+X axis):______ %g
*msg,info,_pk_amp
Peak current (A):_______________________________ %g
*if,cw_mot,eq,0,then
*msg,info
Rotation of the Rotor:__________________________ CCW
*else
*msg,info
Rotation of the Rotor:__________________________ CW
*endif
*msg,info,_cogtmn
MIN torque (oz-in):_____________________________ %g
*msg,info,_cogtmx
MAX torque (oz-in):_____________________________ %g
*msg,info,abs(_cogtmn-_cogtmx)
Peak - Peak torque (oz-in):____________________ %g
*msg,info,rms_tor
Average torque (oz-in):_________________________ %g
*msg,info,_i_1
Number of solutions:____________________________ %g
*if,_plt_opt(1),eq,1,then
*msg,info,_anl_mx(1)
Maximum B magnitude:____________________________ %g
*endif
*if,_plt_opt(2),eq,1,then
*msg,info,_anl_mx(2)
Maximum H magnitude:____________________________ %g
*endif
*if,_plt_opt(3),eq,1,then
*msg,info,_anl_mx(3)
Maximum Permeability:___________________________ %g
*endif
*if,_plt_opt(4),eq,1,then
*msg,info,_anl_mx(4)
Maximum Stored Energy:__________________________ %g
*endif
*if,_plt_opt(5),eq,1,then
*msg,info,_anl_mx(5)
Maximum Normal B Error:_________________________ %g
*endif
*if,tormeth,le,1,then
*msg,info
Method to compute torque:_____ Maxwells-line integral
*elseif,tormeth,eq,2,then
*msg,info
Method to compute torque:_____ Maxwells-torqsum
*else
*msg,info
Method to compute torque:_____ Virtual Work
*endif
*msg,info,_del1
Time for all solutions (CPU):___________________ %g
*msg,info
*msg,info
__________SUMMARY OF ANGLES/Torque__________________
*msg,info
___________I___________Mechanical_____Torque________
*msg,info
________________________ANGLE (D)_____(Oz-in)_______
*vlen,_inumpt
*vwrite,sequ,_rotm(1,0),_rotm(1,1)
(f15.0,f18.2,f12.1)
*msg,info
____________________________________________________
/out
*get,_mnu,active,,menu
*if,_nosum,eq,0,then
*uili,torqmach,sum
*else
*list,torqmach,sum
*endif
*endif
:end
parsav,all,temp,par
/nopr
_nomsg=0
_mg1=0
/cont
_plvmxn=0
*set,_ti_ang
/uis,msgpop,2
_off_on=0
/gopr
/sho,term
_mg1=0