Skip to content

Units cannot be parsed #3

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

Open
MilanCornelis opened this issue Mar 18, 2025 · 0 comments
Open

Units cannot be parsed #3

MilanCornelis opened this issue Mar 18, 2025 · 0 comments

Comments

@MilanCornelis
Copy link

When testing a bit with this package, it seems like units cannot be parsed.
I used the SysML model below

package 'My-Vehicle' {

	private import SI::*;
	private import ISQ::*;
	
	part vehicle1 {
		part engine {
			part cylinder;
		}
		
		part frontAxleAssembly {
			part frontAxle;
			
			part frontWheelAssembly {
				part wheel;
				
				part tire : Tire {
					attribute pressure = 270000.0 [Pa];
				}
			}
		}
		
		part rearAxleAssembly {
			part rearAxle;
			
			part rearWheelAssembly {
				part wheel;
				
				part tire : Tire {
					attribute pressure = 320000.0 [Pa];
				}
			}
			
			part differential : Differential;
		}
	}
}


and parsed it with this Python code

from pysysml2.modeling.model import Model

model = Model()
model.from_sysml2_file('./demo.sysml')
print(model)

Giving the output below. Besides the errors, the tree is also not correctly represented anymore. The part rearAxleAssembly@11_None should have vehicle1@3_None as a parent and thus be rearAxleAssembly@11_3 (like frontAxleAssembly). For the moment, this can be solved by making the attribute type a String (e.g. "32000.0 [Pa]".

line 3:1 mismatched input 'private' expecting {'}', 'actor', 'attribute', 'comment', 'connect', 'doc', 'item', 'package', 'part', 'port', 'ref', 'use', 'in', 'out', COMMENT_LONG}
line 4:1 extraneous input 'private' expecting {<EOF>, 'actor', 'attribute', 'comment', 'connect', 'doc', 'import', 'item', 'package', 'part', 'port', 'ref', 'use', 'in', 'out', COMMENT_LONG}
line 18:35 token recognition error at: '[P'
line 18:38 token recognition error at: ']'
line 30:35 token recognition error at: '[P'
line 30:38 token recognition error at: ']'
line 18:37 no viable alternative at input 'parttire:Tire{attributepressure=270000.0a'
line 30:37 no viable alternative at input 'parttire:Tire{attributepressure=320000.0a'
line 35:2 extraneous input '}' expecting {<EOF>, 'actor', 'attribute', 'comment', 'connect', 'doc', 'import', 'item', 'package', 'part', 'port', 'ref', 'use', 'in', 'out', COMMENT_LONG}
[root]: 
├── [0]: My-Vehicle@0_None
├── [1]: SI@1_None
├── [2]: ISQ@2_None
├── [3]: vehicle1@3_None
│   ├── [4]: engine@4_3
│   │   └── [5]: cylinder@5_4
│   └── [6]: frontAxleAssembly@6_3
│       ├── [7]: frontAxle@7_6
│       └── [8]: frontWheelAssembly@8_6
│           └── [9]: wheel@9_8
├── [10]: rearAxleAssembly@10_None
│   ├── [11]: rearAxle@11_10
│   └── [12]: rearWheelAssembly@12_10
│       └── [13]: wheel@13_12
└── [14]: differential@14_None
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

1 participant