Opened 15 years ago

Last modified 14 years ago

#1108 closed defect (fixed)

cannot simulate, due to error in initial_residual() during compilation

Reported by: Schubert TUD Owned by: Schubert TUD
Priority: high Milestone:
Component: Version:
Keywords: Cc: Schubert TUD,

Description

Hi,

I've got another problem, I'd like to report.

Consider the following model:

model genExpFailed

Real[2] u;
parameter Real a = 1;
Real x[2];

equation

u = {0,0};
x = u - a*{0,1};

end genExpFailed;

If you simulate genExpFailed, the OMC returns "Simulation Failed.". Looking into the problem a little bit further shows that the C++ Code generated by the OMC is wrong. More precisely the lines within the function initial_residual():

real_array_create(&tmp0, &$x$lB2$rB, 1, 2);
localData->initialResiduals[i++] = (tmp0 + $a);

cause the gcc to throw an error: "genExpFailed.cpp: In function `int initial_residual()': genExpFailed.cpp:498: error: no match for 'operator+' in 'tmp0 + *localData->sim_DATA::parameters'"
The error is ok, since it should simply read:

localData->initialResiduals[i++] = ($x$lB2$rB + $a);

Regards,

Christian

Change History (1)

comment:1 Changed 14 years ago by perost

I may have accidently fixed this bug while working on other array-related bugs earlier. This model seems to compile and simulate without problems now at least.

Note: See TracTickets for help on using tickets.