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

Can't read local、independent Scalar variables. #148

Open
wzj7531 opened this issue Aug 13, 2024 · 3 comments
Open

Can't read local、independent Scalar variables. #148

wzj7531 opened this issue Aug 13, 2024 · 3 comments

Comments

@wzj7531
Copy link

wzj7531 commented Aug 13, 2024

Using fmi4j read BouncingBall.fmu :
AbstractFmu fmu = AbstractFmu.from(fmuFile); ModelDescriptionProvider md = fmu.getModelDescription(); ModelVariables variables = md.getModelVariables(); List<TypedScalarVariable<?>> scalarVariables = variables.getVariables();
But it seems like scalarVarables dose not contains variables which causality attribute is independent and local. Is this intentional or a bug?

@markaren
Copy link
Member

I can't be sure without a deep dive into the code, but what use do you have for accessing the independent variable?

@wzj7531
Copy link
Author

wzj7531 commented Aug 14, 2024

I can't be sure without a deep dive into the code, but what use do you have for accessing the independent variable?

Using a for loop like:
AbstractFmu fmu = AbstractFmu.from(fmuFile); ModelDescriptionProvider md = fmu.getModelDescription(); ModelVariables variables = md.getModelVariables(); List<TypedScalarVariable<?>> scalarVariables = variables.getVariables(); for (TypedScalarVariable<?> var : scalarVariables){ Causality varCausality = var.getCausality(); if(varCausality == Causality.Local){ //no variable which causality is local } }
The BouncingBall.fmu has a local variable der(h) and der(v), but using code above can't read the two variables.

@markaren
Copy link
Member

markaren commented Aug 14, 2024

Not sure why the above does not work, but it should be easier to access the variable by name or valueReference. And it should also work.

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

No branches or pull requests

2 participants