Skip to content

Commit

Permalink
Allow setting the logging interval via oms3_setLoggingInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Nov 22, 2018
1 parent 287d131 commit b0ea5fe
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
8 changes: 7 additions & 1 deletion OMEdit/OMEditGUI/OMS/InstantiateDialog.cpp
Expand Up @@ -76,6 +76,9 @@ InstantiateDialog::InstantiateDialog(LibraryTreeItem *pLibraryTreeItem, QWidget
mpResultFileBufferSizeSpinBox = new QSpinBox;
mpResultFileBufferSizeSpinBox->setRange(1, INT_MAX);
mpResultFileBufferSizeSpinBox->setValue(mpLibraryTreeItem->mOMSSimulationOptions.getResultFileBufferSize());
// logging interval
mpLoggingIntervalLabel = new Label(tr("Logging Interval:"));
mpLoggingIntervalTextBox = new QLineEdit("0");
// Add the validators
QDoubleValidator *pDoubleValidator = new QDoubleValidator(this);
mpStartTimeTextBox->setValidator(pDoubleValidator);
Expand Down Expand Up @@ -104,7 +107,9 @@ InstantiateDialog::InstantiateDialog(LibraryTreeItem *pLibraryTreeItem, QWidget
pMainLayout->addWidget(mpResultFileTextBox, 4, 1);
pMainLayout->addWidget(mpResultFileBufferSizeLabel, 5, 0);
pMainLayout->addWidget(mpResultFileBufferSizeSpinBox, 5, 1);
pMainLayout->addWidget(mpButtonBox, 6, 0, 1, 2);
pMainLayout->addWidget(mpLoggingIntervalLabel, 6, 0);
pMainLayout->addWidget(mpLoggingIntervalTextBox, 6, 1);
pMainLayout->addWidget(mpButtonBox, 7, 0, 1, 2);
setLayout(pMainLayout);
}

Expand All @@ -131,6 +136,7 @@ void InstantiateDialog::instantiate()
mpResultFileBufferSizeSpinBox->value());
mpLibraryTreeItem->mOMSSimulationOptions.setResultFileName(mpResultFileTextBox->text());
mpLibraryTreeItem->mOMSSimulationOptions.setResultFileBufferSize(mpResultFileBufferSizeSpinBox->value());
OMSProxy::instance()->setLoggingInterval(mpLibraryTreeItem->getNameStructure(), mpLoggingIntervalTextBox->text().toDouble());

if (mpLibraryTreeItem->getModelWidget()) {
mpLibraryTreeItem->getModelWidget()->updateModelText();
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/OMS/InstantiateDialog.h
Expand Up @@ -60,6 +60,8 @@ class InstantiateDialog : public QDialog
QLineEdit *mpResultFileTextBox;
Label *mpResultFileBufferSizeLabel;
QSpinBox *mpResultFileBufferSizeSpinBox;
Label *mpLoggingIntervalLabel;
QLineEdit *mpLoggingIntervalTextBox;
QPushButton *mpOkButton;
QPushButton *mpCancelButton;
QDialogButtonBox *mpButtonBox;
Expand Down
18 changes: 18 additions & 0 deletions OMEdit/OMEditGUI/OMS/OMSProxy.cpp
Expand Up @@ -1461,6 +1461,24 @@ bool OMSProxy::setResultFile(QString cref, QString filename, int bufferSize)
return statusToBool(status);
}

/*!
* \brief OMSProxy::setLoggingInterval
* Sets the logging interval.
* \param cref
* \param loggingInterval
* \return
*/
bool OMSProxy::setLoggingInterval(QString cref, double loggingInterval)
{
QString command = "oms3_setLoggingInterval";
QStringList args;
args << cref << QString::number(loggingInterval);
LOG_COMMAND(command, args);
oms_status_enu_t status = oms3_setLoggingInterval(cref.toStdString().c_str(), loggingInterval);
logResponse(command, status, &commandTime);
return statusToBool(status);
}

/*!
* \brief OMSProxy::setMasterAlgorithm
* Set master algorithm variant that shall be used (default: "standard").
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/OMS/OMSProxy.h
Expand Up @@ -137,6 +137,7 @@ class OMSProxy : public QObject
bool setStopTime(QString cref, double stopTime);
bool setFixedStepSize(QString cref, double stepSize);
bool setResultFile(QString cref, QString filename, int bufferSize);
bool setLoggingInterval(QString cref, double loggingInterval);
bool setMasterAlgorithm(QString cref, QString masterAlgorithm);
bool exists(QString cref);
};
Expand Down

0 comments on commit b0ea5fe

Please sign in to comment.