diff --git a/OMEdit/OMEditGUI/Modeling/Commands.cpp b/OMEdit/OMEditGUI/Modeling/Commands.cpp index d0dec608ea0..45906d8a529 100644 --- a/OMEdit/OMEditGUI/Modeling/Commands.cpp +++ b/OMEdit/OMEditGUI/Modeling/Commands.cpp @@ -2875,7 +2875,8 @@ void SystemSimulationInformationCommand::redoInternal() setFailed(true); return; } - if (!OMSProxy::instance()->setTolerance(mpLibraryTreeItem->getNameStructure(), mpWCSystemSimulationInformation->mTolerance)) { + if (!OMSProxy::instance()->setTolerance(mpLibraryTreeItem->getNameStructure(), mpWCSystemSimulationInformation->mAbsoluteTolerance, + mpWCSystemSimulationInformation->mRelativeTolerance)) { setFailed(true); return; } @@ -2884,7 +2885,8 @@ void SystemSimulationInformationCommand::redoInternal() setFailed(true); return; } - if (!OMSProxy::instance()->setTolerance(mpLibraryTreeItem->getNameStructure(), mpSCSystemSimulationInformation->mTolerance)) { + if (!OMSProxy::instance()->setTolerance(mpLibraryTreeItem->getNameStructure(), mpSCSystemSimulationInformation->mAbsoluteTolerance, + mpSCSystemSimulationInformation->mRelativeTolerance)) { setFailed(true); return; } diff --git a/OMEdit/OMEditGUI/OMS/OMSProxy.cpp b/OMEdit/OMEditGUI/OMS/OMSProxy.cpp index 002baa60303..c63d1ee6928 100644 --- a/OMEdit/OMEditGUI/OMS/OMSProxy.cpp +++ b/OMEdit/OMEditGUI/OMS/OMSProxy.cpp @@ -1367,13 +1367,13 @@ bool OMSProxy::setTLMSocketData(QString cref, QString address, int managerPort, * \param tolerance * \return */ -bool OMSProxy::setTolerance(QString cref, double tolerance) +bool OMSProxy::setTolerance(QString cref, double absoluteTolerance, double relativeTolerance) { QString command = "oms_setTolerance"; QStringList args; - args << "\"" + cref + "\"" << QString::number(tolerance); + args << "\"" + cref + "\"" << QString::number(absoluteTolerance) << QString::number(relativeTolerance); LOG_COMMAND(command, args); - oms_status_enu_t status = oms_setTolerance(cref.toStdString().c_str(), tolerance, tolerance); + oms_status_enu_t status = oms_setTolerance(cref.toStdString().c_str(), absoluteTolerance, relativeTolerance); logResponse(command, status, &commandTime); return statusToBool(status); } diff --git a/OMEdit/OMEditGUI/OMS/OMSProxy.h b/OMEdit/OMEditGUI/OMS/OMSProxy.h index 2257f7bdae5..d2e0ec13722 100644 --- a/OMEdit/OMEditGUI/OMS/OMSProxy.h +++ b/OMEdit/OMEditGUI/OMS/OMSProxy.h @@ -130,7 +130,7 @@ class OMSProxy : public QObject bool setTLMBusGeometry(QString cref, const ssd_connector_geometry_t* pGeometry); bool setTLMConnectionParameters(QString crefA, QString crefB, const oms_tlm_connection_parameters_t *pParameters); bool setTLMSocketData(QString cref, QString address, int managerPort, int monitorPort); - bool setTolerance(QString cref, double tolerance); + bool setTolerance(QString cref, double absoluteTolerance, double relativeTolerance); void setWorkingDirectory(QString path); bool simulate_asynchronous(QString cref); bool terminate(QString cref); diff --git a/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.cpp b/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.cpp index f6cbddd0b02..54fdfdaa2fa 100644 --- a/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.cpp +++ b/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.cpp @@ -48,13 +48,15 @@ TLMSystemSimulationInformation::TLMSystemSimulationInformation() WCSystemSimulationInformation::WCSystemSimulationInformation() { mFixedStepSize = 0.0; - mTolerance = 0.0; + mAbsoluteTolerance = 0.0; + mRelativeTolerance = 0.0; } SCSystemSimulationInformation::SCSystemSimulationInformation() { mFixedStepSize = 0.0; - mTolerance = 0.0; + mAbsoluteTolerance = 0.0; + mRelativeTolerance = 0.0; mDescription = ""; mAbsoluteTolerance = 0.0; @@ -105,19 +107,27 @@ SystemSimulationInformationDialog::SystemSimulationInformationDialog(GraphicsVie mpFixedStepSizeLabel = new Label(tr("Fixed Step Size:")); mpFixedStepSizeTextBox = new QLineEdit; mpFixedStepSizeTextBox->setValidator(pDoubleValidator); - // tolerance - mpToleranceLabel = new Label("Tolerance:"); - mpToleranceTextBox = new QLineEdit; - mpToleranceTextBox->setValidator(pDoubleValidator); + // absolute tolerance + mpAbsoluteToleranceLabel = new Label("Absolute Tolerance:"); + mpAbsoluteToleranceTextBox = new QLineEdit; + mpAbsoluteToleranceTextBox->setValidator(pDoubleValidator); + // relative tolerance + mpRelativeToleranceLabel = new Label("Relative Tolerance:"); + mpRelativeToleranceTextBox = new QLineEdit; + mpRelativeToleranceTextBox->setValidator(pDoubleValidator); } else { // oms_system_sc // fixed step size mpFixedStepSizeLabel = new Label(tr("Fixed Step Size:")); mpFixedStepSizeTextBox = new QLineEdit; mpFixedStepSizeTextBox->setValidator(pDoubleValidator); - // tolerance - mpToleranceLabel = new Label("Tolerance:"); - mpToleranceTextBox = new QLineEdit; - mpToleranceTextBox->setValidator(pDoubleValidator); + // absolute tolerance + mpAbsoluteToleranceLabel = new Label("Absolute Tolerance:"); + mpAbsoluteToleranceTextBox = new QLineEdit; + mpAbsoluteToleranceTextBox->setValidator(pDoubleValidator); + // relative tolerance + mpRelativeToleranceLabel = new Label("Relative Tolerance:"); + mpRelativeToleranceTextBox = new QLineEdit; + mpRelativeToleranceTextBox->setValidator(pDoubleValidator); } // buttons mpOkButton = new QPushButton(Helper::ok); @@ -146,13 +156,17 @@ SystemSimulationInformationDialog::SystemSimulationInformationDialog(GraphicsVie } else if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->isWCSystem()) { pMainLayout->addWidget(mpFixedStepSizeLabel, row, 0); pMainLayout->addWidget(mpFixedStepSizeTextBox, row++, 1); - pMainLayout->addWidget(mpToleranceLabel, row, 0); - pMainLayout->addWidget(mpToleranceTextBox, row++, 1); + pMainLayout->addWidget(mpAbsoluteToleranceLabel, row, 0); + pMainLayout->addWidget(mpAbsoluteToleranceTextBox, row++, 1); + pMainLayout->addWidget(mpRelativeToleranceLabel, row, 0); + pMainLayout->addWidget(mpRelativeToleranceTextBox, row++, 1); } else { // oms_system_sc pMainLayout->addWidget(mpFixedStepSizeLabel, row, 0); pMainLayout->addWidget(mpFixedStepSizeTextBox, row++, 1); - pMainLayout->addWidget(mpToleranceLabel, row, 0); - pMainLayout->addWidget(mpToleranceTextBox, row++, 1); + pMainLayout->addWidget(mpAbsoluteToleranceLabel, row, 0); + pMainLayout->addWidget(mpAbsoluteToleranceTextBox, row++, 1); + pMainLayout->addWidget(mpRelativeToleranceLabel, row, 0); + pMainLayout->addWidget(mpRelativeToleranceTextBox, row++, 1); } pMainLayout->addWidget(mpButtonBox, row++, 0, 1, 2, Qt::AlignRight); setLayout(pMainLayout); @@ -204,10 +218,12 @@ void SystemSimulationInformationDialog::setSystemSimulationInformation() tlmSystemSimulationInformation.mMonitorPort = mpMonitorPortTextBox->text().toInt(); } else if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->isWCSystem()) { wcSystemSimulationInformation.mFixedStepSize = mpFixedStepSizeTextBox->text().toDouble(); - wcSystemSimulationInformation.mTolerance = mpToleranceTextBox->text().toDouble(); + wcSystemSimulationInformation.mAbsoluteTolerance = mpAbsoluteToleranceTextBox->text().toDouble(); + wcSystemSimulationInformation.mRelativeTolerance = mpRelativeToleranceTextBox->text().toDouble(); } else { // oms_system_sc scSystemSimulationInformation.mFixedStepSize = mpFixedStepSizeTextBox->text().toDouble(); - scSystemSimulationInformation.mTolerance = mpToleranceTextBox->text().toDouble(); + wcSystemSimulationInformation.mAbsoluteTolerance = mpAbsoluteToleranceTextBox->text().toDouble(); + wcSystemSimulationInformation.mRelativeTolerance = mpRelativeToleranceTextBox->text().toDouble(); } // system simulation information command SystemSimulationInformationCommand *pSystemSimulationInformationCommand; diff --git a/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.h b/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.h index affe6f6263f..4ce036906d6 100644 --- a/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.h +++ b/OMEdit/OMEditGUI/OMS/SystemSimulationInformationDialog.h @@ -57,7 +57,8 @@ class WCSystemSimulationInformation WCSystemSimulationInformation(); double mFixedStepSize; - double mTolerance; + double mAbsoluteTolerance; + double mRelativeTolerance; }; class SCSystemSimulationInformation @@ -66,7 +67,6 @@ class SCSystemSimulationInformation SCSystemSimulationInformation(); double mFixedStepSize; - double mTolerance; QString mDescription; double mAbsoluteTolerance; @@ -95,8 +95,10 @@ class SystemSimulationInformationDialog : public QDialog // WC system simulation information Label *mpFixedStepSizeLabel; QLineEdit *mpFixedStepSizeTextBox; - Label *mpToleranceLabel; - QLineEdit *mpToleranceTextBox; + Label *mpAbsoluteToleranceLabel; + QLineEdit *mpAbsoluteToleranceTextBox; + Label *mpRelativeToleranceLabel; + QLineEdit *mpRelativeToleranceTextBox; QPushButton *mpOkButton; QPushButton *mpCancelButton; QDialogButtonBox *mpButtonBox;