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
  • Index
  • » Users
  • » romar_ro
  • » Profile

Posts

Posts

May-01-12 14:43:42
I have received an error division by zero in util/division.c

I am using the version 1.8.1 released version, I have to simulate a model, the compilation is doing fine but when it comes to simulate I receive the following error:

OMEdit error:

Process crashed throw |[line] 44|[file] util/division.c |division by zero

Is my model to blame for this error?
If you need the model I will send to you

Vlad

Hi I have the following function that I want to evaluate :

Code:


function getValue
  import Modelica.Utilities.*;
  input String line;
  input Integer indexToken=1;
  output Real tokenValue=0;
  output Integer nextToken;
protected
  Types.TokenValue token;
algorithm
  (token,nextToken):=Strings.scanToken(line,indexToken);
  if token.tokenType==Types.TokenType.DelimiterToken then
    (token,nextToken):=Strings.scanToken(line,nextToken);
    end if;
  if token.tokenType==Types.TokenType.RealToken then
      tokenValue:=token.real;
    end if;
    if token.tokenType==Types.TokenType.IntegerToken then
      tokenValue:=token.integer;
  end if;
end getValue; 

and I am evaliating with OMNotebook like this:

Code:


getValue("235.15,1.013e5,4.18");
getValue("235.15,1.013e5,4.18",7)

And at the evaluation of the function I get an omc error which is a linker warning. Why this is happening?
(235.15,7)
(101300.0,15)
OMC-ERROR:
"Error: Error building simulator. Buildlog: OPENMODELICAHOME = C:\OpenModelica1.8.0
MINGW = C:\OpenModelica1.8.0\MinGW
gcc -I"C:/OpenModelica1.8.0/include/omc"  -O0 -falign-functions -msse2 -mfpmath=sse  -c -o Modelica_Utilities_Strings_length.o Modelica_Utilities_Strings_length.c
gcc -I"C:/OpenModelica1.8.0/include/omc"  -O0 -falign-functions -msse2 -mfpmath=sse  -c -o Modelica_Utilities_Strings_length_records.o Modelica_Utilities_Strings_length_records.c
g++ -shared -export-dynamic -o Modelica_Utilities_Strings_length.dll Modelica_Utilities_Strings_length.o Modelica_Utilities_Strings_length_records.o -lModelicaExternalC -I"C:/OpenModelica1.8.0/include/omc"  -O0 -falign-functions -msse2 -mfpmath=sse  -L"C:/OpenModelica1.8.0/lib/omc" -lSimulationRuntimeC -lregex -lexpat -static-libgcc -lsendData -lQtNetwork-mingw -lQtCore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32 -lm
c:/openmodelica1.8.0/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?

Is there a possibility to make OMEdit to compile the files in an other folder than default?

Hi Adrian,

I have made it work, with a little bit of guessing and luck. here is the compile.bath changed:

Code:


@echo off
REM Clear all environment variables that may interfere during compile and link phases.
set GCC_EXEC_PREFIX=
set CPLUS_INCLUDE_PATH=
set C_INCLUDE_PATH=
set LIBRARY_PATH=
set OLD_PATH=%PATH%
set OPENMODELICAHOME=C:\OpenModelica1.8.0
set MINGW=%OPENMODELICAHOME%\MinGW
REM If OMDEV is set, use MinGW from there instead of OPENMODELICAHOME
REM It is not certain that release OMC is installed
if not %OMDEV%a==a set MINGW=%OMDEV%\tools\MinGW
echo OPENMODELICAHOME = %OPENMODELICAHOME% >> c:\%1.log 2>&1
echo MINGW = %MINGW% >>c:\%1.log 2>&1
set CURRENT_DIR="%CD%" >>c:\%1.log 2>&1
cd /D "%MINGW%\bin" >>c:\%1.log 2>&1
set PATH=%CD%;%CD%\..\libexec\gcc\mingw32\4.4.0\; >>c:\%1.log 2>&1
cd /D "%CURRENT_DIR%" >>c:\%1.log 2>&1
REM echo PATH = %PATH% >>%1.log 2>&1
REM echo CD = %CD% >>%1.log 2>&1
%MinGW%\bin\mingw32-make -f %1.makefile >>c:\%1.log 2>&1
set RESULT=%ERRORLEVEL%
set PATH=%OLD_PATH%
set OLD_PATH=
exit %RESULT%

Sorry that I had to hardcode the values needed for me. But it seems that the problem in this compile file was that the instruction MINGW didn't set the path correctly my default OPENMODELICAHOME variable was "C:\openmodelica1.8.0\ and the original code for MINGW=%OPENMODELICA%\MinGW which didn't translate to a valid path. the results was something like C:\openmodelica1.8.0\ \MinGW.

Hope this will help in the future.

Thanks for showing me where to look to solve this issue.

Vlad.

I have tried what you said but now I get the following error:

record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 4.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'HelloWorld', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",
    messages = "Simulation failed for model: HelloWorld
Error: Error building simulator. Buildlog: The system cannot find the path specified.
gcc  -O3 -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.8.0//include/omc\" -I.    -c -o HelloWorld.o helloworld.c
'gcc' is not recognized as an internal or external command,
operable program or batch file.
\\MinGW\\bin\\mingw32-make: *** [HelloWorld.o] Error 1

",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;

Hi I have installed OpenModelica 1.8.0 two days ago, I didn't have time to see if it is working I assumed it did, now when I try a simple example I get the following error:

record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'hw', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",
    messages = "Simulation failed for model: hw
Error: Error building simulator. Buildlog: gcc  -O3 -falign-functions -msse2 -mfpmath=sse   -I\"C:/OpenModelica1.8.0//include/omc\" -I.    -c -o hw.o hw.c
'gcc' is not recognized as an internal or external command,
operable program or batch file.
\\MinGW\\bin\\mingw32-make: *** [hw.o] Error 1

",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;

it seems that gcc it is not recognised. I have set the path to direct to MinGW\bin where this command is. It is still doesn't work even if in the comand window this command is recognised. I have looked at the enviroment variables and they seem to be ok, below you can see them:

DRMODELICAHOME="C:\OpenModelica1.8.0\share/omnotebook/drmodelica"
OPENMODELICAHOME=C:\OpenModelica1.8.0\
OPENMODELICALIBRARY=C:\OpenModelica1.8.0\lib/omlibrary
OS=Windows_NT
Path=C:\OpenModelica1.8.0\MinGW\bin;C:\Program Files\NVIDIA Corporation\PhysX\Co
mmon;C:\WINDOWS\system32;C:\WINDOWS;.......

where the error can be?

Hi,

I have an example of an external function from a previous version of openmodelica (it worked on 1.6.0). Now when I want to modify this example in 1.8.0 OMEdit I get an error that the sintax isn't correct, and after that if I want to save once more the file the OMEdit throws an error and exits:

Below is the file:

Code:

  

function ExampleFunc1
  annotation(LibraryDirectory = "//Resources/Library");
  annotation(IncludeDirectory = "//Resources/Include");
  input Real x;
  output Real y;

  external "C" y = ExternalFunc2(x)   annotation(Library = "ExternalLibrary", Include = "#include \"ExternalFunc2.h\"");
end ExampleFunc1;

when I want to save it gives me the following error:

Error occurred building AST
[<interactive>7:122-7:122:writable] Error: Lexer failed to recognize '\\"\"');
end'
[< interactive >7:123-7:123:writable] Error: Lexer failed to recognize '\"\"');
end'

After this if I want to save once more the file, or to save an other file I get:
The instruction at "0x6a214c43" referenced memory at "0x7d892880". The memory could not be "read".
and the OMEdit exits

I run OpenModelica 1.8.0 latest released version on an Windows XP system

What do I do wrong?

Can you please help me

I am not sure, but it seems that because your table has two rows that have in the first column the value 1:

0 0
1 0
1 1

Oct-31-11 11:02:40
Libraries FLUID and FLUIDDISSIPATION does not work in OpenModelica

thanks, I will look into it asap.

Oct-31-11 10:37:38
Libraries FLUID and FLUIDDISSIPATION does not work in OpenModelica

sjoelund.se,
Hi,

I have the 1.8.0 version of OpenModelica, And I have searched the Tools->Options->Libraries feature you described, but I couldn't find it, all I have in the Option tab is:
General,
Modelica Editor
Pen style
Brush Style

Can you help me locate the Libraries?

thanks

Sep-06-11 13:20:04
While simulating readRealParameterModel I got an error

Hi,
When trying to simulate the readRealParameterModel from Utilities the omc throws the following error:

The instruction at 0x7c90100b referenced memory at 0x00000034. The memory could not be "read".

to simulate this I used OMC Edit and also OMNotebook with the following code:

loadModel(Modelica);
simulate(Modelica.Utilities.Examples.readRealParametereModel);

currently I have the version 1.7.0 installed on the Windows XP

  • Index
  • » Users
  • » romar_ro
  • » Profile
You are here: