예제 #1
0
파일: program.cpp 프로젝트: diybio/NinjaPCR
Step* CommandParser::ParseStep(char* pBuffer) {
  //parse temp
  char* pTemp = strchr(pBuffer, '|');
  *pTemp++ = '\0';
  
  //parse name
  char* pName = strchr(pTemp, '|');
  *pName++ = '\0';
  
  //parse ramp duration if exists
  char* pEnd;
  char* pRampDuration = strchr(pName, '|');
  if (pRampDuration) {
    *pRampDuration++ = '\0';
    pEnd = strchr(pRampDuration, ']');
  } else {
    pEnd = strchr(pName, '|');
  }
  *pEnd = '\0';
	
  unsigned long stepDuration = atol(pBuffer);
  unsigned long rampDuration = pRampDuration == NULL ? 0 : atol(pRampDuration);
  float temp = atof(pTemp);

  Step* pStep = gpThermocycler->GetStepPool().AllocateComponent();
  
  pStep->SetName(pName);
  pStep->SetStepDurationS(stepDuration);
  pStep->SetRampDurationS(rampDuration);
  pStep->SetTemp(temp);
  return pStep;
}
예제 #2
0
//PreprocessProgram initializes ETA parameters and validates/modifies ramp conditions
void Thermocycler::PreprocessProgram() {
  Step* pCurrentStep;
  Step* pPreviousStep = NULL;

  iProgramHoldDurationS = 0;
  iEstimatedTimeRemainingS = 0;
  iHasCooled = false;

  iProgramControlledRampDurationS = 0;
  iProgramFastRampDegrees = 0;
  iElapsedFastRampDegrees = 0;
  iTotalElapsedFastRampDurationMs = 0;

  ipProgram->BeginIteration();
  while ((pCurrentStep = ipProgram->GetNextStep()) && !pCurrentStep->IsFinal()) {
    //validate ramp
    if (pPreviousStep != NULL && pCurrentStep->GetRampDurationS() * 1000 < absf(pCurrentStep->GetTemp() - pPreviousStep->GetTemp()) * PLATE_FAST_RAMP_THRESHOLD_MS) {
      //cannot ramp that fast, ignored set ramp
      pCurrentStep->SetRampDurationS(0);
    }

    //update eta hold
    iProgramHoldDurationS += pCurrentStep->GetStepDurationS();

    //update eta ramp
    if (pCurrentStep->GetRampDurationS() > 0) {
      //controlled ramp
      iProgramControlledRampDurationS += pCurrentStep->GetRampDurationS();
    }
    else {
      //fast ramp
      double previousTemp = pPreviousStep ? pPreviousStep->GetTemp() : GetPlateTemp();
      iProgramFastRampDegrees += absf(previousTemp - pCurrentStep->GetTemp()) - CYCLE_START_TOLERANCE;
    }

    pPreviousStep = pCurrentStep;
  }
}
예제 #3
0
//PreprocessProgram initializes ETA parameters and validates/modifies ramp conditions
void Thermocycler::PreprocessProgram() {
  Step* pCurrentStep;
  Step* pPreviousStep = NULL;
  
  m_program_hold_duration_sec = 0;
  m_estimated_time_remaining_sec = 0;
  m_has_cooled = false;
  
  m_program_controlled_ramp_duration_sec = 0;
  m_program_fast_ramp_degrees = 0;
  m_elapsed_fast_ramp_degrees = 0;
  m_total_elapsed_fast_ramp_duration_ms = 0;
  
  m_program->BeginIteration();
  while ((pCurrentStep = m_program->GetNextStep()) && !pCurrentStep->IsFinal()) {
    //validate ramp
    if (pPreviousStep != NULL && pCurrentStep->GetRampDurationS() * 1000 < fabs(pCurrentStep->GetTemp() - pPreviousStep->GetTemp()) * PLATE_FAST_RAMP_THRESHOLD_MS) {
      //cannot ramp that fast, ignored set ramp
      pCurrentStep->SetRampDurationS(0);
    }
    
    //update eta hold
    m_program_hold_duration_sec += pCurrentStep->GetStepDurationS();
 
    //update eta ramp
    if (pCurrentStep->GetRampDurationS() > 0) {
      //controlled ramp
      m_program_controlled_ramp_duration_sec += pCurrentStep->GetRampDurationS();
    } else {
      //fast ramp
      double previousTemp = pPreviousStep ? pPreviousStep->GetTemp() : GetPlateTemp();
      m_program_fast_ramp_degrees += fabs(previousTemp - pCurrentStep->GetTemp()) - CYCLE_START_TOLERANCE;
    }
    
    pPreviousStep = pCurrentStep;
  }
}