Changeset a1b67a1 in OpenModelica


Ignore:
Timestamp:
2021-11-24T10:16:45+01:00 (2 years ago)
Author:
GitHub <noreply@…>
Branches:
maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
15cb3945, cb10fe1, cd360922
Parents:
7bb55ae
git-author:
Adeel Asghar <adeel.asghar@…> (11/24/21 10:16:45)
git-committer:
GitHub <noreply@…> (11/24/21 10:16:45)
Message:

Convert the parameters to base unit when exporting to csv (#8212)

Fixes #8206

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMEdit/OMEditLIB/Plotting/PlotWindowContainer.cpp

    r74ea5aef ra1b67a1  
    582582    data << QString::number(timeVector.at(i));
    583583    foreach (PlotCurve *pPlotCurve, pPlotWindow->getPlot()->getPlotCurvesList()) {
     584      double value;
    584585      if (pPlotCurve && pPlotCurve->mYAxisVector.size() > i) { // parameters have just start and stop points in the dataset
    585         OMCInterface::convertUnits_res convertUnit = MainWindow::instance()->getOMCProxy()->convertUnits(pPlotCurve->getYDisplayUnit(), pPlotCurve->getYUnit());
    586         if (convertUnit.unitsCompatible) {
    587           data << StringHandler::number(Utilities::convertUnit(pPlotCurve->mYAxisVector.at(i), convertUnit.offset, convertUnit.scaleFactor));
    588         } else {
    589           data << StringHandler::number(pPlotCurve->mYAxisVector.at(i));
    590         }
     586        value = pPlotCurve->mYAxisVector.at(i);
    591587      } else if (pPlotCurve && pPlotCurve->mYAxisVector.size() > 0) { // Set last value to have constant values for parameters
    592         data << StringHandler::number(pPlotCurve->mYAxisVector.last());
    593       } else { // otherwise set value to 0. But perhaps we should never reach there.
    594         data << StringHandler::number(0);
     588        value = pPlotCurve->mYAxisVector.last();
     589      } else { // otherwise set value to 0.0 but perhaps we should never reach there.
     590        value = 0.0;
     591      }
     592      OMCInterface::convertUnits_res convertUnit = MainWindow::instance()->getOMCProxy()->convertUnits(pPlotCurve->getYDisplayUnit(), pPlotCurve->getYUnit());
     593      if (convertUnit.unitsCompatible) {
     594        data << StringHandler::number(Utilities::convertUnit(value, convertUnit.offset, convertUnit.scaleFactor));
     595      } else {
     596        data << StringHandler::number(value);
    595597      }
    596598    }
Note: See TracChangeset for help on using the changeset viewer.