Example #1
0
void calc_grad_duty(double time)
   {
   double  gradenergy[3],gradduty[3];
   double  mult=1.0;
   double  currentlimit,RMScurrentlimit;
   double  sglduty,dutylimit;
   int     checksilent,r,nrcvrs,arraydim,error=0;
   char    rcvrs[MAXSTR];

   currentlimit = getval("currentlimit");
   RMScurrentlimit = getval("RMScurrentlimit");
   getRealSetDefault(GLOBAL, "sglduty", &sglduty,0.0);
   dutylimit = RMScurrentlimit/currentlimit;
   checksilent = option_check("checksilent");

   /* Adjust array dimenstion for multiple receivers */
   nrcvrs = 0;
   getstr("rcvrs",rcvrs);
   arraydim = getvalnwarn("arraydim");
   for (r = 0; r < strlen(rcvrs); r++) {
     if (rcvrs[r] == 'y') nrcvrs++;
   }
   arraydim /= nrcvrs;

   if (seqcon[2] == 'c')
     mult *= nv;
   if (seqcon[3] == 'c')
     mult *= nv2;

   if (!checkflag)
     mult *= arraydim;

   getgradpowerintegral(gradenergy);
   gradduty[0] = sqrt(gradenergy[0]/(mult*time));
   gradduty[1] = sqrt(gradenergy[1]/(mult*time));
   gradduty[2] = sqrt(gradenergy[2]/(mult*time));

   if (sglduty && ((checkflag && !checksilent) || (!checksilent && ix == arraydim))) {
     text_message("Grad energy X: %.3g    Grad energy Y: %.3g    Grad energy Z: %.3g",gradenergy[0],gradenergy[1],gradenergy[2]);
     text_message("Grad duty X: %.3g%%    Grad duty Y: %.3g%%    Grad duty Z: %.3g%%",100*gradduty[0],100*gradduty[1],100*gradduty[2]);
   }

   if ((gradduty[0] > dutylimit) && ((checkflag && !checksilent) || (!checksilent && ix == arraydim))) {
     text_message("%s: X gradient duty cycle %5.1f%% exceeds allowed limit of %5.1f%%",seqfil,100*gradduty[0],100*dutylimit);
     error = 1;
   }
   if ((gradduty[1] > dutylimit) && ((checkflag && !checksilent) || (!checksilent && ix == arraydim))) {
     text_message("%s: Y gradient duty cycle %5.1f%% exceeds allowed limit of %5.1f%%",seqfil,100*gradduty[1],100*dutylimit);
     error = 1;
   }
   if ((gradduty[2] > dutylimit) && ((checkflag && !checksilent) || (!checksilent && ix == arraydim))) {
     text_message("%s: Z gradient duty cycle %5.1f%% exceeds allowed limit of %5.1f%%",seqfil,100*gradduty[2],100*dutylimit);
     error = 1;
   }
   if (error) {
     if (sglduty)
       warn_message("%s: Duty cycle exceeds allowed limit",seqfil);
     else
       abort_message("%s: Duty cycle exceeds allowed limit",seqfil);
   }
   }
Example #2
0
pulsesequence()
{
   double freq,fstart,fend;
   double attn,attnd,attnd2,attnd3,attnd4,tattn;/* 5 channels supported */
   double tunesw,tuneswd,tuneswd2,tuneswd3,tuneswd4,tsw;
   double gain,gaind,gaind2,gaind3,gaind4,tgain;
   int chan;
   double offset_sec;
   int np2;
   int nfv,index;

   nfv = (int) getval("nf");
   np2 = np / 2;
   status(A);
   /* getRealSetDefault reduces logic - not in Inova */
   getRealSetDefault(CURRENT,"tunesw",&tunesw,10000000.0);
   getRealSetDefault(CURRENT,"tuneswd",&tuneswd,tunesw);
   getRealSetDefault(CURRENT,"tuneswd2",&tuneswd2,tunesw);
   getRealSetDefault(CURRENT,"tuneswd3",&tuneswd3,tunesw);
   getRealSetDefault(CURRENT,"tuneswd4",&tuneswd4,tunesw);

   getRealSetDefault(CURRENT,"tupwr",&attn,10.0);
   getRealSetDefault(CURRENT,"tupwrd",&attnd,10.0);
   getRealSetDefault(CURRENT,"tupwrd2",&attnd2,10.0);
   getRealSetDefault(CURRENT,"tupwrd3",&attnd3,10.0);
   getRealSetDefault(CURRENT,"tupwrd4",&attnd4,10.0);
   getRealSetDefault(CURRENT,"gain",&gain,10.0);
   getRealSetDefault(CURRENT,"gaind",&gaind,gain);
   getRealSetDefault(CURRENT,"gaind2",&gaind2,gain);
   getRealSetDefault(CURRENT,"gaind3",&gaind3,gain);
   getRealSetDefault(CURRENT,"gaind4",&gaind4,gain);
   offset_sec = (0.5 / sw);
   setacqmode(WACQ|NZ); 
   for (index = 0; index < nf; index++)
   {
     switch(index) {
      case 0:  chan = OBSch; freq = sfrq; tattn = attn; 
                    tgain = gain; tsw = tunesw; break;
      case 1:  chan = DECch; freq = dfrq; tattn = attnd; 
                    tgain = gaind; tsw = tuneswd; break;
      case 2:  chan = DEC2ch; freq = dfrq2; tattn = attnd2; 
                    tgain = gaind2; tsw = tuneswd2; break;
      case 3:  chan = DEC3ch; freq = dfrq3; tattn = attnd3; 
                    tgain = gaind3; tsw = tuneswd3; break;
      case 4:  chan = DEC4ch; freq = dfrq4; tattn = attnd4; 
                    tgain = gaind4; tsw = tuneswd4; break;
      default:  exit(-1);
     }
     fstart = freq - (tsw/2) * 1e-6;
     fend = freq + (tsw/2) * 1.0e-6;
     //printf("channel = %d  frequency = %f\n",chan,freq);
     //printf("channel = %d  frequency span = %f\n",chan, tsw);
     //printf("start=%f  stop = %f\n",fstart,fend);
     //printf("gain = %f power = %f\n",tgain,tattn);
     hsdelay(d1);
     set4Tune(chan,tgain); 
     assign(zero,oph);
     genPower(tattn,chan);
     delay(0.001);
     startacq(alfa);
     SweepNOffsetAcquire(fstart, fend, np2, chan, offset_sec); 
     endacq();
     delay(0.001);
   }
}