Opened 10 years ago
Closed 6 years ago
#3160 closed defect (fixed)
C compilation error for array equations
Reported by: | Rüdiger Franke | Owned by: | Mahder Alemseged Gebremedhin |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | trunk |
Keywords: | Cc: | Mahder Alemseged Gebremedhin |
Description
The PIline models of the PowerSystems library use some non-trivial array equations. All models using them fail to translate (r24588). Three of them fail with the following C compilation error:
PowerSystems.Examples.Spot.AC3ph.Line_02nls.c:971:39: error: passing 'double' to parameter of incompatible type 'real_array_t' (aka 'struct base_array_s') array_alloc_real_array(&tmp1122, 3, 0.01848743818955456, 0.0, 0.0); ^~~~~~~~~~~~~~~~~~~ /usr/include/omc/c/util/real_array.h:144:74: note: passing argument to parameter 'first' here extern void array_alloc_real_array(real_array_t* dest,int n,real_array_t first,...); ^
To reproduce:
$ git clone https://github.com/modelica/PowerSystems.git
Simulate PowerSystems.Examples.Spot.AC3ph.Line
, PowerSystems.Examples.Spot.TransmissionAC3ph.FaultPIline
, or PowerSystems.Examples.Spot.TransmissionAC3ph.PIline
Change History (18)
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:3 by , 10 years ago
comment:4 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I think this was fixed by r24887 as a side-effect. works now.
comment:5 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Hmm... yesterday afternoon the tests reported for the three models an error about failed SerializeModelInfo.
Today's tests report again
PowerSystems.Examples.Spot.AC3ph.Line_02nls.c:191: error: aggregate value used where a float was expected
Today's OMEdit gives:
PowerSystems.Examples.Spot.AC3ph.Line_02nls.c:191:61: error: operand of type 'real_array' (aka 'struct base_array_s') where arithmetic or pointer type is required array_alloc_scalar_real_array(&tmp1100, 3, (modelica_real)tmp1101, (modelica_real)tmp1102, (modelica_real)tmp1103);
comment:7 by , 10 years ago
Just an update
I have fixed the handling for multi-dimensional array equations so we are back to the error messages
PowerSystems.Examples.Spot.AC3ph.Line_02nls.c:191: error: aggregate value used where a float was expected
I know what is causing them now. It is because some DAE.ARRAY(...) expressions are marked as scalar=true when they are actually like DAE.ARRAY(DAE.ARRAY(...)). These wrong types appear in residual equations for these models.
I am trying to locate where they are being introduced. It can be that the front-end marked them like that and passed it to back-end or they are created in the back-end. Not sure yet.
comment:8 by , 10 years ago
Okay found this. I really shot myself in the foot with this one. A while back i changed how diagonal was handled and reverted it back when things started failing. Only that I didn't revert properly and introduced exactly this problem :(. Took me two days to realize it wasn't the back-end creating the problem. Paid for it dearly.
Anyway should be fixed in r25060. I think three more tests should pass now.
comment:9 by , 10 years ago
The error message changed to:
a->ndims != b->ndims, 2 != 1 PowerSystems.Examples.Spot.AC3ph.Line: util/real_array.c:99: copy_real_array_data: Assertion `base_array_shape_eq(&source, dest)' failed. Aborted
Meaning that your changes have some effect ;-)
comment:10 by , 10 years ago
:) It's like these tests don't want to pass. I see they are failing at simulation now. Compilation passes. I will take a look now.
comment:11 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:16 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:17 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.
comment:18 by , 6 years ago
Component: | Backend → New Instantiation |
---|---|
Milestone: | Future → 2.0.0 |
Resolution: | → fixed |
Status: | reopened → closed |
The PowerSystems.Examples.AC3ph.Elementary.Line model now works fine with -d=newInst
The error message has changed to (r24630):