clear all
jjj=0
i=0;
c2=50e-12;
l2=0.0375;
k=.35;
%c1=1.4e-4; % drsstc - but unhook it for sstc
c1=1.3889e-004 %offline
foffline=0;
%f=1/sqrt(l2*c2);
%f=730300;
for f = 350000:5000:800000

l1=1.5e-6;
l2e=l2*(1-k^2);
l1e=l2*k^2;
n2=l2*k^2/l1;
c1e=c1/n2;
n=sqrt(n2);
%for k=0.1:.01:.28
   i=i+1;
   %r=.000875*n; %OLTC
   r=.007*n2; % DRSSTC
   drv=400*n; %DRSSTC
   %drv=0; %oltc
   vd=4*n; %drsstc
   %vd=2*n; %oltc
   jjj=jjj+1;
   sim 'tc'
   outenergy=(v2.*v2*c2*.5);
   outl=(l2e*current2.*current2/2);
   inl=(l1*current.*current/2);
    pe=v1.*v1*c1e/2;
    tote=(outenergy+outl+inl+pe);
    temp=0;
    eff=(ie-loss)./ie;
    eff2=(outenergy./ie);
    se=size(eff);
    imax(jjj)=max(icurrent);
    vmax(jjj)=max(v2)
    keep(jjj)=min(eff(100:se));
    keep2(jjj)=max(eff2(100:se));
    fv(jjj)=f;
   
end
%end