Logo Search packages:      
Sourcecode: qantenna version File versions  Download package

void NECInput::SetFrequency ( int  type,
int  nSteps,
double  newFrequency,
double  stepInc 
) [slot]

Setfrequency sets new frequency parameters (or change them) and rewrite the NECInput file. If FR card doesn't exist, it inserts one after GE card with the new parameters. The frequency parameters are the following: Type indicates if increment is linear (0) or multiplicative (1) nSteps is the number of frequency steps. newFrequency is the simulation frequency stepInc the frequency step increment.

Please note that at the time of writing QAntenna 0.2, we can only render the radiation pattern of just one frequency, so we will force nSteps = 1 and stepInc = 0. If this changes at sometime, remember to check frcard.cpp for a change of the same type.

Definition at line 81 of file necinput.cpp.

References cardsList, createNECInputFile(), FRCard::setFrequency(), FRCard::setFrequencyIncrement(), FRCard::setNumberOfFrequencySteps(), and FRCard::setTypeOfStepping().

{
      /**
            Please note that at the time of writing QAntenna 0.2, we can only render
            the radiation pattern of just one frequency, so we will force nSteps = 1
            and stepInc = 0.
            If this changes at sometime, remember to check frcard.cpp for a change of
            the same type.
      */

      FRCard * frcard = 0;

      /*
            We must check the list for a FR card.
            * If the card exists, we must change it's values
            * If the card does not exists, we must add one in a the correct place
      */

      // Let's check is the FR card exists
      int i = 0;
      while(i<cardsList.size() and cardsList.at(i)->getCardType() != "FR")
            i++;

      // We check wheter the card has been found or not
      if(i<cardsList.size())
      {
            // We found the card, so we change the parameters
            frcard = (FRCard*)cardsList.at(i);
            frcard->setTypeOfStepping(type);
            frcard->setNumberOfFrequencySteps(1);
            frcard->setFrequency(newFrequency);
            frcard->setFrequencyIncrement(1);
            frcard = 0;
      }
      else
      {
            // There is no FR card, we create one
            frcard = new FRCard(type, 1, newFrequency, 0);
            // And we search for the first GE card
            i = 0;
            while(i<cardsList.size() and cardsList.at(i)->getCardType() != "GE")
                  i++;
            if(i<cardsList.size())
            {
                  // We found the GE card
                  cardsList.insert(i+1,frcard);
                  frcard = 0;
            }
            else
            {
                  /*
                        We could not find a GE card. Do we have any more options instead
                        of quiting?
                  */
                  qDebug() << "NECInput::SetFrequency";
                  qDebug() << QWidget::tr("While trying to insert a FR card, I could not "
                                          "find a GE card in order to put the first card "
                                          "in a right place");
                  return;
            }
      }
      // Now we must re-create input.necin
      createNECInputFile();
}


Generated by  Doxygen 1.6.0   Back to index