Skip to content

Bump modelica-json version #482

@AntoineGautier

Description

@AntoineGautier

This ticket is to update the commit hash of modelica-json to the latest available in the master branch of https://github.com/lbl-srg/modelica-json.

This is needed to include the fixes from lbl-srg/modelica-json#281, namely

  • correct and recursive parsing of logical expressions
  • handling of package.order

TODO:

  • Regression in expression parsing modelica-json#294

  • Guard against expanding literal strings #483

  • Add support not operator in expression evaluation #462:

    • Parser updated
    • Check if interpreter works correctly with { operator: "!", operand: [...] }: switch clause added, test updated
  • Solve rdflib (peer dep from modelica-json) not compiling with tsc: now excluded with skipLibCheck

  • Refactor for updated schema modelica-json#245: class_definition is now stored_class_definitions

  • Refactor for change in arithmetic_expressions schema
    ⚠️ What is called here arithmetic_expressions differs from the grammar: arithmetic-expression : [ add-operator ] term { add-operator term }. Instead modelica-json seems to use simple_expression as an equivalent for the grammar arithmetic-expression... but not always: see next bullet point.

    Old schema

    {
      "arithmetic_expressions": [
        {
          "name": "fanSupDra.typ"
        },
        {
          "name": "Buildings.Templates.Components.Types.Fan.None"
        }
      ],
      "relation_operator": "<>"
    }

    New schema

    {
      "arithmetic_expressions": [
        "fanSupDra.typ",
        "Buildings.Templates.Components.Types.Fan.None"
      ],
      "relation_operator": "<>"
    }
  • Expansion of simple_expression
    ❌ Conflict with Ag/478 remove check #479

    Old schema

    "simple_expression": "(0.787 +0.764*Modelica.Math.log(-TDewPoiK/Modelica.Constants.T_zero))*(1 +0.0224*nOpa10 -0.0035*(nOpa10^2) +0.00028*(nOpa10^3))"

    New schema

    // Below simple_expression is equivalent to the grammar arithmetic-expression: [ add-operator ] term { add-operator term }
    // with optional "addOps"
    "simple_expression": {
      "terms": [
        {
          "operators": [
            "*"
          ],
          "factors": [
            {
              "primary1": [
                { // Below simple_expression is not expanded: why?
                  "simple_expression": "0.787 +0.764*Modelica.Math.log(-TDewPoiK/Modelica.Constants.T_zero)"
                }
              ]
            },
            {
              "primary1": [
                { // Below we need to compare the size of "addOps" and "terms" to assess whether the optional leading add-operator is included or not.
                  "simple_expression": {
                    "addOps": [
                      "+",
                      "-",
                      "+"
                    ],
                    "terms": [
                      "1",
                      "0.0224*nOpa10",
                      {
                        "operators": [
                          "*"
                        ],
                        "factors": [
                          "0.0035",
                          {
                            "primary1": [
                              {
                                "simple_expression": "nOpa10^2"
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "operators": [
                          "*"
                        ],
                        "factors": [
                          "0.00028",
                          {
                            "primary1": [
                              {
                                "simple_expression": "nOpa10^3"
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
      ]
    }

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions