Changeset 4ed1a225 in OpenModelica


Ignore:
Timestamp:
2020-10-16T14:10:30+02:00 (4 years ago)
Author:
arun3688 <rain100falls@…>
Children:
5960d7d
Parents:
1ab1803
git-author:
arun3688 <rain100falls@…> (10/15/20 17:01:45)
git-committer:
arun3688 <rain100falls@…> (10/16/20 14:10:30)
Message:

allow causality=parameter and delete start values

Location:
OMEdit/OMEditLIB/OMS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OMEdit/OMEditLIB/OMS/ElementPropertiesDialog.cpp

    r1ab1803 r4ed1a225  
    352352        QString parameterValue = mParameterLineEdits.at(parametersIndex)->text();
    353353        parametersIndex++;
    354         if (pInterfaces[i]->type == oms_signal_type_real) {
    355           OMSProxy::instance()->setReal(nameStructure, parameterValue.toDouble());
    356         } else if (pInterfaces[i]->type == oms_signal_type_integer) {
    357           OMSProxy::instance()->setInteger(nameStructure, parameterValue.toInt());
    358         } else if (pInterfaces[i]->type == oms_signal_type_boolean) {
    359           OMSProxy::instance()->setBoolean(nameStructure, parameterValue.toInt());
    360         } else if (pInterfaces[i]->type == oms_signal_type_string) {
    361           qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet.";
    362         } else if (pInterfaces[i]->type == oms_signal_type_enum) {
    363           qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet.";
    364         } else if (pInterfaces[i]->type == oms_signal_type_bus) {
    365           qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet.";
    366         } else {
    367           qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t.";
     354        if (parameterValue.isEmpty()) {
     355          // delete start values only
     356          OMSProxy::instance()->omsDelete(nameStructure + ":start");
     357        }
     358        else {
     359          if (pInterfaces[i]->type == oms_signal_type_real) {
     360            OMSProxy::instance()->setReal(nameStructure, parameterValue.toDouble());
     361          } else if (pInterfaces[i]->type == oms_signal_type_integer) {
     362            OMSProxy::instance()->setInteger(nameStructure, parameterValue.toInt());
     363          } else if (pInterfaces[i]->type == oms_signal_type_boolean) {
     364            OMSProxy::instance()->setBoolean(nameStructure, parameterValue.toInt());
     365          } else if (pInterfaces[i]->type == oms_signal_type_string) {
     366            qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet.";
     367          } else if (pInterfaces[i]->type == oms_signal_type_enum) {
     368            qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet.";
     369          } else if (pInterfaces[i]->type == oms_signal_type_bus) {
     370            qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet.";
     371          } else {
     372            qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t.";
     373          }
    368374        }
    369375      } else if (pInterfaces[i]->causality == oms_causality_input) {
    370376        QString inputValue = mInputLineEdits.at(inputsIndex)->text();
    371377        inputsIndex++;
    372         if (pInterfaces[i]->type == oms_signal_type_real) {
    373           OMSProxy::instance()->setReal(nameStructure, inputValue.toDouble());
    374         } else if (pInterfaces[i]->type == oms_signal_type_integer) {
    375           OMSProxy::instance()->setInteger(nameStructure, inputValue.toInt());
    376         } else if (pInterfaces[i]->type == oms_signal_type_boolean) {
    377           OMSProxy::instance()->setBoolean(nameStructure, inputValue.toInt());
    378         } else if (pInterfaces[i]->type == oms_signal_type_string) {
    379           qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet.";
    380         } else if (pInterfaces[i]->type == oms_signal_type_enum) {
    381           qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet.";
    382         } else if (pInterfaces[i]->type == oms_signal_type_bus) {
    383           qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet.";
    384         } else {
    385           qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t.";
     378        if (inputValue.isEmpty()){
     379          // delete start values only
     380          OMSProxy::instance()->omsDelete(nameStructure + ":start");
     381        }
     382        else{
     383          if (pInterfaces[i]->type == oms_signal_type_real) {
     384            OMSProxy::instance()->setReal(nameStructure, inputValue.toDouble());
     385          } else if (pInterfaces[i]->type == oms_signal_type_integer) {
     386            OMSProxy::instance()->setInteger(nameStructure, inputValue.toInt());
     387          } else if (pInterfaces[i]->type == oms_signal_type_boolean) {
     388            OMSProxy::instance()->setBoolean(nameStructure, inputValue.toInt());
     389          } else if (pInterfaces[i]->type == oms_signal_type_string) {
     390            qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet.";
     391          } else if (pInterfaces[i]->type == oms_signal_type_enum) {
     392            qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet.";
     393          } else if (pInterfaces[i]->type == oms_signal_type_bus) {
     394            qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet.";
     395          } else {
     396            qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t.";
     397          }
    386398        }
    387399      }
  • OMEdit/OMEditLIB/OMS/ModelDialog.cpp

    r1a785313 r4ed1a225  
    534534  mpCausalityComboBox->addItem("Input", oms_causality_input);
    535535  mpCausalityComboBox->addItem("Output", oms_causality_output);
     536  mpCausalityComboBox->addItem("Parameter", oms_causality_parameter);
     537
    536538  // type
    537539  mpTypeLabel = new Label(Helper::type);
Note: See TracChangeset for help on using the changeset viewer.