Opened 11 years ago
Last modified 7 years ago
#2685 assigned defect
Connector with record fails with code generation issues
Reported by: | Adrian Pop | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
Priority: | critical | Milestone: | Future |
Component: | Code Generation | Version: | trunk |
Keywords: | Cc: | Willi Braun, Lennart Ochel, Volker Waurich, Mahder Alemseged Gebremedhin |
Description
Hello everyone,
working on some controller model omc fails to reduce the variables using pantelides.
The error log is:
Error: Too many equations - overconstrained system. The model has 8 equations and 4 variables.
Error: Transformation Module PFPlusExt index Reduction Method Pantelides failed!
Find attached an examplemodel.
Unfortunately it is a bit complex therefore here is a short description.
A Record (with integer for value and enumeration for datatype)is used as connector (input and output).
within a block the value of the input changes to the output using an algorithm (simplification is done here!).
If you need further information with the model, let me know.
Attachments (1)
Change History (25)
by , 11 years ago
Attachment: | example.mo added |
---|
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Component: | Backend → Frontend |
---|---|
Owner: | changed from | to
Status: | new → accepted |
Seems to be some issues with flattening, outputConnector[i].signal turns into outputConnector.signal[i] in the flattened code. Not sure if this is the only issue, but I'll try to fix it.
comment:3 by , 11 years ago
Cc: | added |
---|---|
Component: | Frontend → Backend |
Ok, I've found the issue with flattening but haven't figured out how to fix it without breaking other things yet. Fixing the flattening issue does not affect the model balance though. The issue seems to be that the algorithm in WriteSomeOutput is counted as 8 equations when it should be 4. So it seems like the main issue is in the Backend.
comment:4 by , 11 years ago
#2688 needs to be fixed before the flattening issues can be fixed. I'm not sure if the flattening issues are an issue in this case though.
comment:5 by , 11 years ago
Cc: | added |
---|
comment:6 by , 10 years ago
Hi everyone,
are there any updates about this ticket (or ticket #2688).
We (Bosch Rexroth) need a model (based on this issue) running with omc for our controller development.
Can anyone give me an update how long this might take?
Best regards,
Andreas
comment:7 by , 10 years ago
Cc: | added |
---|
follow-up: 10 comment:8 by , 10 years ago
Hi,
commit [21524] fixed the backend-issue with the wrong number of solved variables for the algorithm. Now, the frontend issue has to be fixed since I get
"[CodegenC.tpl:7806:28-7806:28:writable] Error: Template error: Indexing non-array writeSomeOutput.outputConnector.signal[i]
and instead there should be: writeSomeOutput.outputConnector[i].signal
Per, Could you please have a look on it? If there is backend stuff breaking, you could commit it as a comment and i will have a look.
comment:9 by , 10 years ago
Component: | Backend → Frontend |
---|
comment:10 by , 10 years ago
Replying to vwaurich:
Per, Could you please have a look on it? If there is backend stuff breaking, you could commit it as a comment and i will have a look.
The issue is still #2688, the backend breaks if we stop converting crefs into ASUBs. Just comment out the call to replaceLoopDependentCrefs in InstSection.instForStatement.
comment:11 by , 10 years ago
Component: | Frontend → Backend |
---|---|
Owner: | changed from | to
Status: | accepted → assigned |
This seems to have been fixed for the front-end I guess via some commit by mahge930.
"Check of example.testmodel completed successfully. Class example.testmodel has 12 equation(s) and 12 variable(s). 8 of these are trivial equation(s). "
However simulation doesn't work as it has issues with the code generation.
comment:12 by , 10 years ago
Status: | assigned → accepted |
---|
It seems that for some reasons in simVar the entry for Option<DAE.ComponentRef> arrayCref; is missing.
comment:13 by , 10 years ago
Component: | Backend → Code Generation |
---|---|
Owner: | changed from | to
Status: | accepted → assigned |
No, the underlying problem is fix the code generation to handle arrays of records.
follow-up: 15 comment:14 by , 10 years ago
These errors should really be fixed by someone in the back-end team. There are already tickets for these things as far as I know...
$PwriteSomeOutput$PoutputConnector$lB(modelica_integer)$Pi$rB$Psignal = (modelica_integer)$Pi
comment:15 by , 10 years ago
Replying to sjoelund.se:
These errors should really be fixed by someone in the back-end team.
This is me actually.
The problem with this issue was that it was a combination of multiple issues:
- Front-end: missing dimension info in qualified names (wrong types created)
- Back-end: variables were sorted in not so appropriate way, needed better sorting for indexing/offsetting to work
- CodeGen: We didn't really have support for these cases. We can't do this with macros anymore.
I have fixed the front-end and back-end issues so far and codegen is ready partially. And I think I can actually simulate these models. I have to check again. The problem is missing array elements due to alias elimination and state var selection complicate things. They won't prevent simulation per se but will give you wrong results because you are accessing the wrong array elements.
Anyway I will try to finish up the codegen modifications I have now and commit it. Then we worry about the other stuff later.
I will create a ticket with the issues in more detail.
comment:16 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:17 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:21 by , 9 years ago
Summary: | Index Reduction (Pantelides) fails → Connector with record fails with code generation issues |
---|
Error message update:
example.testmodel.c:128:3: warning: implicit declaration of function 'example_OutputConnector_array_create' is invalid in C99 [-Wimplicit-function-declaration] example_OutputConnector_array_create(&tmp21, ((modelica_example_OutputConnector*)&($PwriteSomeOutput$PoutputConnector_index(((modelica_integer) 1)))), 1, 2); ^ example.testmodel.c:128:50: error: use of undeclared identifier 'modelica_example_OutputConnector'; did you mean 'omc_example_OutputConnector'? example_OutputConnector_array_create(&tmp21, ((modelica_example_OutputConnector*)&($PwriteSomeOutput$PoutputConnector_index(((modelica_integer) 1)))), 1, 2); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ omc_example_OutputConnector ./example.testmodel_functions.h:26:25: note: 'omc_example_OutputConnector' declared here example_OutputConnector omc_example_OutputConnector(threadData_t *threadData, modelica_integer omc_signal, modelica_integer omc_signalType); /* record head */ ^ example.testmodel.c:128:83: error: expected expression example_OutputConnector_array_create(&tmp21, ((modelica_example_OutputConnector*)&($PwriteSomeOutput$PoutputConnector_index(((modelica_integer) 1)))), 1, 2); ^ example.testmodel.c:128:86: warning: implicit declaration of function '$PwriteSomeOutput$PoutputConnector_index' is invalid in C99 [-Wimplicit-function-declaration] example_OutputConnector_array_create(&tmp21, ((modelica_example_OutputConnector*)&($PwriteSomeOutput$PoutputConnector_index(((modelica_integer) 1)))), 1, 2); ^ example.testmodel.c:129:3: warning: implicit declaration of function 'copy_example_OutputConnector_array_data' is invalid in C99 [-Wimplicit-function-declaration] copy_example_OutputConnector_array_data(tmp20, &tmp21); ^ 3 warnings and 2 errors generated. make: *** [example.testmodel.o] Error 1 make: *** Waiting for unfinished jobs.... Compilation process failed. Exited with code 2.
comment:23 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:24 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
sorry,
i forgot to mention the model not working is testmodel