diff --git a/OMEdit/OMEditLIB/MainWindow.cpp b/OMEdit/OMEditLIB/MainWindow.cpp index 0a3d210a188..04b01d8cb9a 100644 --- a/OMEdit/OMEditLIB/MainWindow.cpp +++ b/OMEdit/OMEditLIB/MainWindow.cpp @@ -4464,6 +4464,7 @@ AboutOMEditDialog::AboutOMEditDialog(MainWindow *pMainWindow) "
  • Dietmar Winkler
  • " "
  • Anatoly Severin
  • " "
  • Adrian Pop - adrian.pop@liu.se
  • " + "
  • John Tinnerholm - john.tinnerholm@liu.se
  • " "") .arg(Helper::applicationName, Helper::applicationIntroText, diff --git a/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp b/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp index 41cdbd2fa39..a8185e5e923 100644 --- a/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp +++ b/OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp @@ -6201,33 +6201,46 @@ void ModelWidget::associateBusWithConnectors(QString busName) /*! * \brief ModelWidget::toOMSensJson * Creates a list of QVariant containing the model information needed by OMSens. + * Currently only works for REAL types (OMSens currently have similar limitations) * \return */ QList ModelWidget::toOMSensData() { + QList omSensData; + if (!mpDiagramGraphicsView) { + return omSensData; + } QStringList inputVariables; QStringList outputVariables; QStringList parameters; QStringList auxVariables; - - if (mpDiagramGraphicsView) { - foreach (Component *pComponent, mpDiagramGraphicsView->getComponentsList()) { - ComponentInfo *pComponentInfo = pComponent->getComponentInfo(); - if ((pComponentInfo->getCausality().compare("input") == 0) && ((pComponentInfo->getClassName().compare("Real") == 0) - || (pComponentInfo->getClassName().compare("Modelica.Blocks.Interfaces.RealInput") == 0))) { - inputVariables.append(pComponentInfo->getName()); - } else if ((pComponentInfo->getCausality().compare("output") == 0) && ((pComponentInfo->getClassName().compare("Real") == 0) - || (pComponentInfo->getClassName().compare("Modelica.Blocks.Interfaces.RealOutput") == 0))) { - outputVariables.append(pComponentInfo->getName()); - } else if ((pComponentInfo->getVariablity().compare("parameter") == 0) && (pComponentInfo->getClassName().compare("Real") == 0)) { + const QString modelicaBlocksInterfacesRealInput = "Modelica.Blocks.Interfaces.RealInput"; + const QString modelicaBlocksInterfacesRealOutput = "Modelica.Blocks.Interfaces.RealOutput"; + QList pInheritedAndComposedComponents; + QList pTopMostComponents = mpDiagramGraphicsView->getComponentsList() + mpDiagramGraphicsView->getInheritedComponentsList(); + for (Component *pComponent : pTopMostComponents) { + pInheritedAndComposedComponents = pComponent->getComponentsList() + pComponent->getInheritedComponentsList(); + pInheritedAndComposedComponents.append(pComponent); + for (auto component : pInheritedAndComposedComponents) { + ComponentInfo *pComponentInfo = component->getComponentInfo(); + auto causality = pComponentInfo->getCausality(); + auto variability = pComponentInfo->getVariablity(); + const bool classNameIsReal = pComponentInfo->getClassName().compare(QStringLiteral("Real")) == 0; + if (causality.compare(QStringLiteral("input")) == 0) { + if (classNameIsReal || pComponentInfo->getClassName().compare(modelicaBlocksInterfacesRealInput) == 0) { + inputVariables.append(pComponentInfo->getName()); + } + } else if (causality.compare(QStringLiteral("output")) == 0) { + if (classNameIsReal || pComponentInfo->getClassName().compare(modelicaBlocksInterfacesRealOutput) == 0) { + outputVariables.append(pComponentInfo->getName()); + } + } else if(classNameIsReal && variability.compare(QStringLiteral("parameter")) == 0) { parameters.append(pComponentInfo->getName()); - } else if (pComponentInfo->getClassName().compare("Real") == 0) { + } /* Otherwise we are dealing with an auxiliarly variable */else if (classNameIsReal) { auxVariables.append(pComponentInfo->getName()); } } } - - QList omSensData; omSensData << inputVariables << outputVariables << auxVariables << parameters << mpLibraryTreeItem->getFileName() << mpLibraryTreeItem->getNameStructure(); return omSensData; }