示例#1
0
TouchScreen::TouchScreen(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::TouchScreen)
{
    mainSystem = new LaserSystem(this);

    ui->setupUi(this);

    //Setup slots for widgets
    connect(mainSystem, SIGNAL(EDFAEmission(bool)), this, SLOT(EDFAEmissionLight(bool)));
    connect(mainSystem, SIGNAL(laserEmission(bool)), this, SLOT(laserEmissionLight(bool)));
    connect(mainSystem, SIGNAL(systemEmission(bool)), this, SLOT(mainButtonState(bool)));

    connect(ui->EDFAOn, SIGNAL(pressed()), this, SLOT(EDFAOnOff()));
    connect(ui->EDFAOff, SIGNAL(pressed()), this, SLOT(EDFAOnOff()));


    connect(ui->TurnOnBtn, SIGNAL(pressed()), this, SLOT(mainButton()));
    connect(ui->TurnOffBtn, SIGNAL(pressed()), this, SLOT(mainButton()));

    connect(ui->LaserQuestOff, SIGNAL(pressed()), this, SLOT(laserOnOff()));
    connect(ui->LaserQuestOn, SIGNAL(pressed()), this, SLOT(laserOnOff()));

    //Connects a system wavelength update to a slot which updates the text in the UI.
    connect(mainSystem, SIGNAL(laserWavelengthUpdate(float)), this, SLOT(updateWavelength(float)));

    //Updates all of the variables in the system.
    mainSystem -> updateSystemState();

    ui->wavelengthSb->setValue(mainSystem->getWavelength(false)); //This probably isnt needed as wavelength should be automatically updated.
    connect(ui->wavelengthSb, SIGNAL(editingFinished()), this, SLOT(setNewWavelength()));

    //Not yet implimented
    ui->StableOff->show();
    ui->StableOn->hide();

    //Change these timers so that all of the system variables are checked at intervals
    QTimer *wavelengthTimer = new QTimer(this);
    connect(wavelengthTimer, SIGNAL(timeout()),this, SLOT(wavelength = ui->hsWavelength->value()));

    //Setup similar system to origional interface where the button type is automatically updated uing signals.

    //Update timer. Every second, system variables will be checked to update the UI to the current settings.
    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()),mainSystem,SLOT(updateSystemState()));
    timer->start(1000);
}
C_FLOAT64 CStochNextReactionMethod::doSingleStep(C_FLOAT64 C_UNUSED(time), C_FLOAT64 endTime)
{
  C_FLOAT64 steptime = mPQ.topKey();

  if (steptime >= endTime)
    {
      return endTime;
    }
  else
    {
      C_INT32 reaction_index = mPQ.topIndex();
      updateSystemState(reaction_index);
      updatePriorityQueue(reaction_index, steptime);
      //printDebugInfo();
      return steptime;
    }
}