void RunView::runFinished(const openstudio::path &t_sqlFile, const openstudio::path &t_radianceOutputPath) { if (m_canceling) { m_statusLabel->setText("Canceled"); } // DLM: should we attach the sql file to the model here? // DLM: if model is re-opened with results they will not be added here, better to do this on results tab //if (exists(t_sqlFile)){ // SqlFile sqlFile(t_sqlFile); // if (sqlFile.connectionOpen()){ // boost::shared_ptr<OSDocument> osdocument = OSAppBase::instance()->currentDocument(); // osdocument->model().setSqlFile(sqlFile); // } //} m_canceling = false; LOG(Debug, "Emitting results generated for sqlfile: " << openstudio::toString(t_sqlFile) << " and radiance file " << openstudio::toString(t_radianceOutputPath)); emit resultsGenerated(t_sqlFile, t_radianceOutputPath); // needed so save of osm file does not trigger out of date and start running again runManager().setPaused(true); m_playButton->setChecked(false); }
void Application::runApplication() { int choice = 0, empChoice = 0; //Load employees & managers loadManagers(); loadEmployees(); do { system("cls"); _flushall(); //Display main menu & get selection choice = mainMenu(); //Login as either employee or manager login(choice); if(currentEmployee != NULL || currentManager != NULL) { switch(choice) { case 1: //Logged in as manager do { empChoice = ManagerMenu(); runManager(empChoice); }while(empChoice != 11); break; case 2: //Logged in as employee do { empChoice = EmployeeMenu(); runEmployee(empChoice); }while(empChoice != 7); break; default: break; } currentEmployee = NULL; currentManager = NULL; } else if(choice != 3) { cout << "Invalid Login" << endl; } }while(choice != 3); store.saveInventory(); cout << "Now exiting program" << endl; }
void RunView::playButtonClicked(bool t_checked) { LOG(Debug, "playButtonClicked " << t_checked); boost::shared_ptr<OSDocument> osdocument = OSAppBase::instance()->currentDocument(); if(osdocument->modified()) { osdocument->save(); // save dialog was canceled if(osdocument->modified()) { return; } } updateToolsWarnings(); if (!t_checked) { m_playButton->setChecked(true); if (!m_canceling) { // we are pausing the simulations m_statusLabel->setText("Canceling"); m_canceling = true; openstudio::Application::instance().processEvents(); runmanager::RunManager rm = runManager(); pauseRunManager(rm); } else { LOG(Debug, "Already canceling, not doing it again"); } } else { runmanager::ConfigOptions co(true); co.findTools(true, true, false, true); co.saveQSettings(); updateToolsWarnings(); openstudio::runmanager::ToolVersion epver = getRequiredEnergyPlusVersion(); if (co.getTools().getAllByName("energyplus").getAllByVersion(epver).tools().size() == 0) { QMessageBox::information(this, "Missing EnergyPlus", openstudio::toQString("EnergyPlus " + epver.toString() + " could not be located, simulation aborted."), QMessageBox::Ok); m_playButton->setChecked(false); return; } if (co.getTools().getAllByName("ruby").tools().size() == 0) { QMessageBox::information(this, "Missing Ruby", "Ruby could not be located, simulation aborted.", QMessageBox::Ok); m_playButton->setChecked(false); return; } // TODO call Dan's ModelToRad translator to determine if there are problems if(m_radianceButton->isChecked() && (!m_radianceWarnings.empty() || !m_radianceErrors.empty())) { showRadianceWarningsAndErrors(m_radianceWarnings, m_radianceErrors); if(m_radianceErrors.size()){ return; } else{ // check messageBox return value to run with warnings } } m_canceling = false; m_outputWindow->clear(); bool requireCalibrationReports = (osdocument->model().getConcreteModelObjects<model::UtilityBill>().size() > 0); // reset the model's sqlFile osdocument->model().resetSqlFile(); // we are starting the simulations openstudio::runmanager::RunManager rm = runManager(); startRunManager(rm, m_modelPath, m_tempFolder, m_radianceButton->isChecked(), requireCalibrationReports, this); } }
void RunView::treeChanged(const openstudio::UUID &t_uuid) { std::string statusstr = "Ready"; try { openstudio::runmanager::Job j = runManager().getJob(t_uuid); while (j.parent()) { j = j.parent().get(); } openstudio::runmanager::TreeStatusEnum status = j.treeStatus(); LOG(Debug, "Tree finished, status is: " << status.valueName()); statusstr = status.valueDescription(); openstudio::path sqlpath; openstudio::path radianceOutPath; if (status == openstudio::runmanager::TreeStatusEnum::Finished || status == openstudio::runmanager::TreeStatusEnum::Failed || status == openstudio::runmanager::TreeStatusEnum::Canceled) { if (status == openstudio::runmanager::TreeStatusEnum::Failed && m_canceling) { statusstr = "Canceled"; } try { sqlpath = j.treeAllFiles().getLastByFilename("eplusout.sql").fullPath; } catch (const std::exception &e) { LOG(Debug, "Tree finished, error getting sql file: " << e.what()); } catch (...) { LOG(Debug, "Tree finished, error getting sql file"); // no sql file exists } try { radianceOutPath = j.treeOutputFiles().getLastByFilename("radout.sql").fullPath; } catch (const std::exception &e) { LOG(Debug, "Tree finished, error getting radout.sql file: " << e.what()); } catch (...) { LOG(Debug, "Tree finished, error getting radout.sql file"); // no sql file exists } runFinished(sqlpath, radianceOutPath); } else { m_canceling = false; } } catch (const std::exception &e) { LOG(Debug, "Tree finished, error getting status: " << e.what()); runFinished(openstudio::path(), openstudio::path()); } catch (...) { LOG(Debug, "Tree finished, error getting status"); runFinished(openstudio::path(), openstudio::path()); // no sql file exists } m_statusLabel->setText(openstudio::toQString(statusstr)); }
void RunView::runManagerStatsChanged() { updateRunManagerStats(runManager()); }