Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression parsing fails #241

Open
AntoineGautier opened this issue Aug 13, 2024 · 2 comments
Open

Expression parsing fails #241

AntoineGautier opened this issue Aug 13, 2024 · 2 comments
Assignees

Comments

@AntoineGautier
Copy link
Contributor

AntoineGautier commented Aug 13, 2024

When translating Modelica to JSON using commit 648b390, some expressions are not properly parsed and the original expressions are lost.
For example, translating Buildings/Controls/OBC/ASHRAE/G36/AHUs/SingleZone/VAV/Controller.mo, we get:

                "component_clause": {
                  "type_specifier": "Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput",
                  "component_list": [
                    {
                      "declaration": {
                        "identifier": "y1RetFan"
                      },
                      "condition_attribute": {
                        "expression": {
                          "simple_expression": "([object Object])"
                        }
                      },

whereas the original declaration is:

  Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1RetFan if (buiPreCon
     == Buildings.Controls.OBC.ASHRAE.G36.Types.PressureControl.ReturnFanMeasuredAir
     or buiPreCon == Buildings.Controls.OBC.ASHRAE.G36.Types.PressureControl.ReturnFanDp)

Another example: with Buildings/Controls/OBC/ASHRAE/G36/AHUs/SingleZone/VAV/Controller.mo, we get:

              {
                "component_clause": {
                  "type_specifier": "Buildings.Controls.OBC.ASHRAE.G36.AHUs.MultiZone.VAV.Economizers.Subsequences.Modulations.ReturnFan",
                  "component_list": [
                    {
                      "declaration": {
                        "identifier": "modRet",
                      },
                      "condition_attribute": {
                        "expression": {
                          "simple_expression": "([object Object])"
                        }
                      },

whereas the original declaration is:

  Buildings.Controls.OBC.ASHRAE.G36.AHUs.MultiZone.VAV.Economizers.Subsequences.Modulations.ReturnFan
    modRet if (buiPreCon == Buildings.Controls.OBC.ASHRAE.G36.Types.PressureControl.ReturnFanMeasuredAir
     or buiPreCon == Buildings.Controls.OBC.ASHRAE.G36.Types.PressureControl.ReturnFanDp)
@AntoineGautier
Copy link
Contributor Author

@JayHuLBL Can you look into that?

@JayHuLBL JayHuLBL self-assigned this Aug 14, 2024
@AntoineGautier
Copy link
Contributor Author

This issue is probably related to the parentheses that are used around logical expressions (not, or, and, etc.).
See the attached expression.json that results from parsing the following declarations.

  parameter Integer notexp = if not a < b then 1 else 2;
  parameter Integer andnotexp = if a < b and not a < b then 1 else 2;
  parameter Integer notexppar = if not (a < b) then 1 else 2;
  parameter Integer andnotexppar = if (a < b) and not (a < b) then 1 else 2;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants