示例#1
0
void ReactorController::init() {
    int err = 0;
    state = INIT;
    
    instrumentEvtCh = chaos::ui::LLRpcApi::getInstance()->getNewInstrumentEventChannel();
    
    CUStateKey::ControlUnitState deviceState;
    chaosReactorController = chaos::ui::HLDataApi::getInstance()->getControllerForDeviceID(reactorID);
    CHAOS_ASSERT(chaosReactorController)
    
    //start the reactor
    err = chaosReactorController->getState(deviceState);
    if(deviceState != CUStateKey::START) {
        if(deviceState == CUStateKey::DEINIT) {
            err = chaosReactorController->initDevice();
            err = chaosReactorController->startDevice();
        } else if(deviceState == CUStateKey::STOP) {
            err = chaosReactorController->startDevice();
        }
    }
    
    chaosReactorController->setScheduleDelay(simulationSpeed);
    //start the controller
    chaosThread->start();
    cycleCount = 0;
    lastSampledTimestamp = 0;
    lastExecutionTime = steady_clock::now();

}
void EditableSubtypeListTableModel::removeAtIndex(unsigned int idx) {
    CHAOS_ASSERT(subtype_list_ptr)
            beginResetModel();
    subtype_list_ptr->erase(subtype_list_ptr->begin() + idx);
    endResetModel();
}
void EditableSubtypeListTableModel::addNew() {
    CHAOS_ASSERT(subtype_list_ptr)
            beginResetModel();
    subtype_list_ptr->push_back(chaos::DataType::SUB_TYPE_BOOLEAN);
    endResetModel();
}