Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Using functions in decalaration of constants...

Using functions in decalaration of constants...

Hello!

From OMShell (1.5 RC3):

Code:

>> class defect 

  constant Real i[2,2] = transpose({{1.1,2.2},{3.3,4.4}});
  Real r;
  equation
    r = i[2,2];
end defect;


class working
  constant Real i[2,2] = {{1.1,2.2},{3.3,4.4}};
  Real r;
  equation
    r = i[2,2];
end working;
{defect,working}

>> simulate(working)
record SimulationResult
    resultFile = "working_res.plt"
end SimulationResult;

>> simulate(defect)
record SimulationResult
    resultFile = "Simulation failed.
Error: Error building simulator. Buildlog: g++ -I"C:\OpenModelica1.5.0\/include" -msse2 -mfpmath=sse  -I. -o defect.exe defect.cpp  -lsim -L"C:\OpenModelica1.5.0\/lib" -lc_runtime -lf2c -lsendData -lQtNetwork-mingw -lQtCore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32
defect.cpp: In function `int functionDAE_output()':
defect.cpp:357: error: `$i$lB2$c2$rB' was not declared in this scope
defect.cpp: In function `int functionDAE_output2()':
defect.cpp:366: error: `$i$lB2$c2$rB' was not declared in this scope
defect.cpp: In function `int initial_residual()':
defect.cpp:515: error: `$i$lB2$c2$rB' was not declared in this scope
mingw32-make: *** [defect] Error 1

Error: Error building simulator. Buildlog: command g++ not found. Check $OPENMODELICAHOME
Error: Error building simulator. Buildlog: command "C:\OpenModelica1.5.0\/bin/Compile" not found. Check $OPENMODELICAHOME
"
end SimulationResult;

>>

Shouldn't it work?

Cheers
Hannes

Edited by: edes - Apr-26-10 00:11:21

Re: Using functions in decalaration of constants...

Yes, it should work. I added a bug report for this: https://openmodelica.org:8443/cb/issue/ … ation=true

Re: Using functions in decalaration of constants...

This bug has now been fixed in revision 5419 of trunk.

There are 0 guests and 0 other users also viewing this topic
You are here: