void ProgressData::receiveEnd()
{
    /**
     * often receiveEnd is the last operation of each step by default.
     * If more send/receive, then we need expand proportion of current
     * step and re-calc them
     */
    updateProg(m_syncUnits[(int)m_step]);
}
Пример #2
0
    /**
     *
     * @return a program computed for the Scene
     * with the last number of light
     */
    const utils::Program & Scene::getProgram() const
    {
	if(!_isProgramUpdated)
	{
	    updateProg();
	    _isProgramUpdated=true;
	}

	return _prog;
    }
void ProgressData::itemPrepare()
{
    checkInternalMode();
    /**
     * only the first PEV_ITEMPREPARE event takes some time
     * due to data access, other events don't according to
     * profiling data
     */
    if(m_source.empty()) {
        m_source = "source"; ///< use this to check whether itemPrepare occurs
        updateProg(DATA_PREPARE_RATIO);
    }
}
void ProgressData::sendStart()
{
    checkInternalMode();
    m_sendCounts++;

    /* self adapts. If a new send and not default, we need re-calculate proportions */
    if(m_sendCounts > MSG_SEND_RECEIVE_TIMES) {
        m_syncUnits[(int)m_step] += 1;
        recalc();
    }
    /**
     * If in the send operation of PRO_SYNC_UNINIT, it often takes extra time
     * to send message due to items handling
     */
    if(m_step == PRO_SYNC_UNINIT && m_syncUnits[(int)m_step] != MSG_SEND_RECEIVE_TIMES) {
        updateProg(DATA_PREPARE_RATIO);
    }
}
void EITMeasurementThread::run() {
    //qDebug() << "Inside MesurementThread::run()";
    canceled = false;
    initAcquisitionCard();
    initSwitchMatrix();
    for (int ci = 0; ci < g->getEITExpCycles(); ci++)
    {
            bool response;
            for (int si = 0; si < exp->N_ELECTRODES_ACTIVE; si++)
            {
                emit updateProg();
                response = measureStep(ci, si);
                ml->incFinishedSteps(stepTime);
                if (canceled || response == false) break;
            }
            if (canceled || response == false) break;
    }
    emit finishProg();
}
void MeasurementThread::run() {
    //qDebug() << "Inside MesurementThread::run()";
    canceled = false;
    initAcquisitionCard();
    initFreqGen();
    for (int ns = 0; ns < numSweep; ns++)
    {
            bool response;
            for (int fi = 0; fi < fList.size(); fi++)
            {
                emit updateProg();
                response = measureStep(ns, fi);
                ml->incFinishedSteps(cyclesPerIm/fList[fi]);
                if (canceled || response == false) break;
            }
            if (canceled || response == false) break;
    }
    emit finishProg();
}
void ProgressData::itemReceive(const std::string &source, int count, int total)
{
    /**
     * source is used to check whether a new source is received
     * If the first source, we compare its total number and default number
     * then re-calc sync units
     */
    if(m_source.empty()) {
        m_source = source;
        if(total != 0) {
            m_syncUnits[PRO_SYNC_UNINIT] += ONEITEM_RECEIVE_RATIO * (total - DEFAULT_ITEMS);
            recalc();
        }
    /** if another new source, add them into sync units */
    } else if(m_source != source){
        m_source = source;
        if(total != 0) {
            m_syncUnits[PRO_SYNC_UNINIT] += ONEITEM_RECEIVE_RATIO * total;
            recalc();
        }
    }
    updateProg(ONEITEM_RECEIVE_RATIO);
}