6 parameter(nconp=ngapp+npfc0+1)
9 common /com_contr/ key_cont
10 common /com_cam/ camtok
11 common /com_cpdiv/ divgap(ngapp,ntimp),divpfc(npfc0,ntimp),
12 & vpfc(npfc0,ntimp),xtim(ntimp),velz(ntimp),
13 & placurr(ntimp),rm_t(ntimp),zm_t(ntimp),
15 common /com_conpar/ r_ref,z_ref,tok_ref,dgap_ref,currpf_ref
17 dimension currpf(npfc0),currpf_ref(npfc0)
18 dimension pf_turns(npfc0)
19 dimension dgap(ngapp),dgap_ref(ngapp)
20 dimension rcp(ngapp),zcp(ngapp)
23 real*8 r_ax,z_ax,r_cc,z_cc
39 elseif(kgrid.eq.1)
then
50 call
gap(ut,rt,zt,rg,zg)
52 elseif(kgrid.eq.1)
then
53 call
f_gap(ut,rt,zt,rg,zg)
55 gap_sign=dsign(1.d0,psi_xp-ut)
56 dgap(i)=dsqrt((rg-rt)**2+(zg-zt)**2)*gap_sign
64 call
get_shape(r_cc,z_cc,r_ax,z_ax,platok)
67 vz_ax=(z_ax-z_ax_old)/dt
68 vz_cc=(z_cc-z_cc_old)/dt
83 currpf_ref(i)=currpf(i)
110 call
congap_m( ngap,dgap,dgap_ref,dt,time,
111 & n_pf,currpf,currpf_ref,
112 & platok,tok_ref,r_ax,z_ax,r_ref,z_ref,vz_cc,
117 call
convert_m( dt,time,n_pf,vz_cc,voltpf )
122 if(i_en.le.ntimp)
then
125 divgap(i,i_en)=dgap(i)-dgap_ref(i)
129 divpfc(i,i_en)=currpf(i)-currpf_ref(i)
133 vpfc(i,i_en)=voltpf(i)
139 placurr(i_en)=platok-tok_ref
146 if(i_en/5*5.eq.i_en)
then
147 call
wrd_cp(i_en,ngap,n_pf)
154 subroutine congap( ngap,Dgap,Dgap_ref,dt,time,
155 & n_pf,currpf,currpf_ref,
156 & platok,tok_ref,r_ax,z_ax,r_ref,z_ref,vz_cc,
163 dimension currpf(*),currpf_ref(*)
164 dimension dgap(*),dgap_ref(*)
166 dimension ac(nconp,nconp),bc(nconp,nconp)
167 dimension cc(nconp,nconp),dc(nconp,nconp)
168 dimension x(nconp),y(nconp),u(nconp),usat(nconp)
183 write(fname,
'(a,a)') path(1:kname),
'ABCD.wr'
186 read(1,*) ((ac(i,j),i=1,n),j=1,m)
188 read(1,*) ((bc(i,j),i=1,n),j=1,m)
190 read(1,*) ((cc(i,j),i=1,n),j=1,m)
192 read(1,*) ((dc(i,j),i=1,n),j=1,m)
203 y(iy)=dgap(i)-dgap_ref(i)
209 y(iy)=currpf(i)-currpf_ref(i)
221 xp(i)=x(i)+dt*(ax+by)
249 & n_pf,currpf,currpf_ref,
250 & platok,tok_ref,r_ax,z_ax,r_ref,z_ref,vz_cc,
257 dimension currpf(*),currpf_ref(*)
258 dimension dgap(*),dgap_ref(*)
260 dimension ac(nconp,nconp),bc(nconp,nconp)
261 dimension cc(nconp,nconp),dc(nconp,nconp)
262 dimension x(nconp),y(nconp),u(nconp),usat(nconp)
273 real*8 t_delay,k_delay
282 write(fname,
'(a,a)') path(1:kname),
'ahatmat'
287 read(1,*) ((ac(i,j),j=1,m),i=1,n)
290 write(fname,
'(a,a)') path(1:kname),
'bhatmat'
295 read(1,*) ((bc(i,j),j=1,m),i=1,n)
298 write(fname,
'(a,a)') path(1:kname),
'chatmat'
303 read(1,*) ((cc(i,j),j=1,m),i=1,n)
306 write(fname,
'(a,a)') path(1:kname),
'dhatmat'
311 read(1,*) ((dc(i,j),j=1,m),i=1,n)
328 y(iy)=currpf(i)-currpf_ref(i)
340 xp(i)=x(i)+dt*(ax+by)
359 if((i_en-1)/k_delay*k_delay.eq.i_en-1)
then
369 & n_pf,currpf,currpf_ref,
370 & platok,tok_ref,r_ax,z_ax,r_ref,z_ref,vz_cc,
377 dimension currpf(*),currpf_ref(*)
378 dimension dgap(*),dgap_ref(*)
380 dimension ac(nconp,nconp),bc(nconp,nconp)
381 dimension cc(nconp,nconp),dc(nconp,nconp)
382 dimension x(nconp),y(nconp),u(nconp),uk(nconp),usat(nconp)
398 write(fname,
'(a,a)') path(1:kname),
'ABCD_m.wr'
403 read(1,*) ((ac(i,j),i=1,n),j=1,m)
410 read(1,*) ((bc(i,j),i=1,n),j=1,m)
416 read(1,*) ((cc(i,j),i=1,n),j=1,m)
422 read(1,*) ((dc(i,j),i=1,n),j=1,m)
435 y(iy)=dgap(i)-dgap_ref(i)
442 y(iy)=currpf(i+5)-currpf_ref(i+5)
446 y(iy)=currpf(5)-currpf_ref(5)
448 y(iy)=currpf(3)-currpf_ref(3)
450 y(iy)=currpf(1)-currpf_ref(1)
452 y(iy)=currpf(2)-currpf_ref(2)
454 y(iy)=currpf(4)-currpf_ref(4)
465 xp(i)=x(i)+tau*(ax+by)
500 subroutine convert( dt,time,n_pf,Vz_cc,voltpf )
507 dimension acc(nconp,nconp),bcc(nconp,nconp)
508 dimension ccc(nconp,nconp),dcc(nconp,nconp)
509 dimension x(nconp),y(nconp),u(nconp),usat(nconp)
516 real*8 acc,bcc,ccc,dcc
524 write(fname,
'(a,a)') path(1:kname),
'ABCDz.wr'
527 read(1,*) ((acc(i,j),i=1,n),j=1,m)
529 read(1,*) ((bcc(i,j),i=1,n),j=1,m)
531 read(1,*) ((ccc(i,j),i=1,n),j=1,m)
533 read(1,*) ((dcc(i,j),i=1,n),j=1,m)
555 xp(i)=x(i)+dt*(ax+by)
574 voltpf(7)=voltpf(7)-u(1) /106.d0
575 voltpf(8)=voltpf(8)-u(1) /185.d0
576 voltpf(9)=voltpf(9)+u(1) /169.d0
577 voltpf(10)=voltpf(10)+u(1) /217.d0
589 dimension pf_turns(40)
591 dimension acc(nconp,nconp),bcc(nconp,nconp)
592 dimension ccc(nconp,nconp),dcc(nconp,nconp)
593 dimension x(nconp),y(nconp),u(nconp),usat(nconp)
600 real*8 acc,bcc,ccc,dcc
610 write(fname,
'(a,a)') path(1:kname),
'ABCDz_m.wr'
613 read(1,*) ((acc(i,j),i=1,n),j=1,m)
615 read(1,*) ((bcc(i,j),i=1,n),j=1,m)
617 read(1,*) ((ccc(i,j),i=1,n),j=1,m)
619 read(1,*) ((dcc(i,j),i=1,n),j=1,m)
651 xp(i)=x(i)+tau*(ax+by)
671 voltpf(i+5)=voltpf(i+5)+u(i)
673 voltpf(5)=voltpf(5)+u(7)
674 voltpf(3)=voltpf(3)+u(8)
675 voltpf(1)=voltpf(1)+u(9)
676 voltpf(2)=voltpf(2)+u(10)
677 voltpf(4)=voltpf(4)+u(11)
853 dimension rcp(*),zcp(*)
878 dimension rcp(*),zcp(*)
916 rmax=dmax1(rmax,r(iplas,j))
917 zmax=dmax1(zmax,z(iplas,j))
918 rmin=dmin1(rmin,r(iplas,j))
919 zmin=dmin1(zmin,z(iplas,j))
922 r_cc=0.5d0*(rmax+rmin)
923 z_cc=0.5d0*(zmax+zmin)
933 common/comst1/ pjk(njlim),pjkp1(njlim),pjkp(njlim),pjkd(njlim)
950 dimension voltpf(npfc0)
951 dimension usat(npfc0)
966 if(dabs(voltpf(i)).gt.usat(i))
then
967 voltpf(i)=dsign(usat(i),voltpf(i))
990 parameter(ntimp=1000)
992 common /com_cam/ camtok
993 common /com_cpdiv/ divgap(ngapp,ntimp),divpfc(npfc0,ntimp),
994 & vpfc(npfc0,ntimp),xtim(ntimp),velz(ntimp),
995 & placurr(ntimp),rm_t(ntimp),zm_t(ntimp),
998 open(1,file=
'contim.wr')
999 write(1,*) i_en,ngap,npf
1000 write(1,*) ((divgap(i,j),i=1,ngap),j=1,i_en)
1001 write(1,*) ((divpfc(i,j),i=1,npf),j=1,i_en)
1002 write(1,*) ((vpfc(i,j),i=1,npf),j=1,i_en)
1003 write(1,*) (xtim(j),j=1,i_en)
1004 write(1,*) (velz(j),j=1,i_en)
1005 write(1,*) (placurr(j),j=1,i_en)
1006 write(1,*) (rm_t(j),j=1,i_en)
1007 write(1,*) (zm_t(j),j=1,i_en)
1008 write(1,*) (cam_tok(j),j=1,i_en)
1014 subroutine get_conp(R_ref,Z_ref,tok_ref,Dgap_ref,currpf_ref)
1015 include
'double.inc'
1016 include
'parevo.inc'
1018 common /com_conpar/ rc_ref,zc_ref,cur_ref,gap_ref,pf_ref
1019 dimension pf_ref(npfc0),currpf_ref(*)
1020 dimension dgap_ref(*),gap_ref(ngapp)
1027 currpf_ref(i)=pf_ref(i)
1031 dgap_ref(i)=gap_ref(i)
1037 subroutine put_conp(R_ref,Z_ref,tok_ref,Dgap_ref,currpf_ref)
1038 include
'double.inc'
1039 include
'parevo.inc'
1041 common /com_conpar/ rc_ref,zc_ref,cur_ref,gap_ref,pf_ref
1042 dimension pf_ref(npfc0),currpf_ref(*)
1043 dimension dgap_ref(*),gap_ref(ngapp)
1050 pf_ref(i)=currpf_ref(i)
1054 gap_ref(i)=dgap_ref(i)
1062 include
'iopath.inc'
1063 common /com_contr/ key_cont
subroutine get_psix(r_xp, z_xp, psi_xp)
Module converts to/from CPOs to ETS types.
subroutine cntrlr_iter(kon_ini, kgrid, voltpf)
subroutine get_tim(dt, time)
subroutine congap(ngap, Dgap, Dgap_ref, dt, time,
subroutine congap_m(ngap, Dgap, Dgap_ref, dt, time,
subroutine get_conp(R_ref, Z_ref, tok_ref, Dgap_ref, currpf_ref)
subroutine gap(ut, rt, zt, rg, zg)
subroutine f_gap(ut, rt, zt, rg, zg)
subroutine wrd_cp(i_en, ngap, npf)
subroutine get_fpsix(r_xp, z_xp, psi_xp)
subroutine put_key_con(k)
subroutine get_rzcp(Rcp, Zcp, ngap)
subroutine volt_lim(voltpf, npf)
subroutine congap_k(ngap, Dgap, Dgap_ref, dt, time,
subroutine get_pfc(currpf, npf)
subroutine put_conp(R_ref, Z_ref, tok_ref, Dgap_ref, currpf_ref)
subroutine convert_m(dt, time, n_pf, Vz_cc, voltpf)
subroutine get_shape(R_cc, Z_cc, R_ax, Z_ax, platok)
subroutine get_rzcp_k(Rcp, Zcp, ngap)