OMJulia.jl icon indicating copy to clipboard operation
OMJulia.jl copied to clipboard

OMJulia simulate command returns error

Open cubakija opened this issue 3 years ago • 17 comments

Hi everyone, I've got an error message when execute simulate command. When I go to the directory that error point out, and run RLC exe, following message pop up:

RLC.exe - Entry point not found
Procedure entry point not found
_gfortran_os_error_at in the dynamic link library
C: \ Users \ USER \ AppData \ Local \ Temp \ jl_y6LgBj \ RLC.exe.

I am using win-10, OpenModelica1.17.0-64bit, Julia-1.6.1 and OMJulia v0.1.0 https://github.com/OpenModelica/OMJulia.jl#master

Attached openmodelica file and julia script. RLC_OM.txt RLC_OMJulia.txt

Below is the error the message I've got when I try to simulate my RLC model:

failed process: Process(`C:/Users/USUARIO/AppData/Local/Temp/jl_m25Fbu/RLC.exe`, ProcessExited(3221225785)) [3221225785]
Stacktrace:
  [1] pipeline_error
    @ .\process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base .\process.jl:440
  [3] run
    @ .\process.jl:438 [inlined]
  [4] (::OMJulia.var"#29#31"{Bool, Vector{String}})()
    @ OMJulia C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:619
  [5] withenv(f::OMJulia.var"#29#31"{Bool, Vector{String}}, keyvals::Pair{String, String})
    @ Base .\env.jl:161
  [6] simulate(omc::OMJulia.OMCSession, resultfile::Nothing, simflags::Nothing; verbose::Bool)
    @ OMJulia C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:617
  [7] simulate (repeats 2 times)
    @ C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:569 [inlined]
  [8] top-level scope
    @ In[8]:1
  [9] eval
    @ .\boot.jl:360 [inlined]
 [10] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:1094

cubakija avatar Aug 09 '21 19:08 cubakija

@cubakija I hope the simulation works in OMEdit ?

arun3688 avatar Aug 11 '21 08:08 arun3688

Yes, "The simulation finished successfully." That was first I've checked.

cubakija avatar Aug 11 '21 08:08 cubakija

@cubakija Can you add the following paths to your PATH Environment variable to find all the DLL's and test it again

OpenModelica1.17.1/bin
OpenModelica1.17.1/lib/omc
OpenModelica1.17.1/lib/omc/cpp
OpenModelica1.17.1/lib/omc/omsicpp

arun3688 avatar Aug 11 '21 13:08 arun3688

👍 Yes, it works OK that way in REPL, but not in Jupyter where I've got an error. Guess it is not OMJulia issue now, but something regarding Jupyter config. I will appriciate if you could give me the advise on how to fix this problem.

cubakija avatar Aug 11 '21 17:08 cubakija

@cubakija Great it worked, but i guess you are still not using the current master of OMJulia, because when executing the simulation executable in your case RLC.exe we append the dll´s path to PATH environment variable , how did you install OMJulia ? Did you do it like below

julia> import Pkg
julia> Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/OMJulia.jl")) 

Also regarding Jupyter notebook, please post the error message you are getting

arun3688 avatar Aug 11 '21 19:08 arun3688

Yes, I've done the way you shown above. Here is my package status, if it could help:

(@v1.6) pkg> status
      Status `C:\Users\USUARIO\.julia\environments\v1.6\Project.toml`
  [7073ff75] IJulia v1.23.2
  [0f4fe800] OMJulia v0.1.0 `https://github.com/OpenModelica/OMJulia.jl#master`
  [91a5bcdd] Plots v1.15.2

The error Jupyter throws after simulate(RLC) is:

failed process: Process(`C:/Users/USUARIO/AppData/Local/Temp/jl_gzs9vj/RLC.exe`, ProcessExited(3221225785)) [3221225785]

Stacktrace:
  [1] pipeline_error
    @ .\process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base .\process.jl:440
  [3] run
    @ .\process.jl:438 [inlined]
  [4] (::OMJulia.var"#29#31"{Bool, Vector{String}})()
    @ OMJulia C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:619
  [5] withenv(f::OMJulia.var"#29#31"{Bool, Vector{String}}, keyvals::Pair{String, String})
    @ Base .\env.jl:161
  [6] simulate(omc::OMJulia.OMCSession, resultfile::Nothing, simflags::Nothing; verbose::Bool)
    @ OMJulia C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:617
  [7] simulate (repeats 2 times)
    @ C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:569 [inlined]
  [8] top-level scope
    @ In[6]:1
  [9] eval
    @ .\boot.jl:360 [inlined]
 [10] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:1094

cubakija avatar Aug 11 '21 19:08 cubakija

@cubakija can you go to this location C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl and send the OMJulia.jl , we can see what version you are using

arun3688 avatar Aug 11 '21 20:08 arun3688

Attached OMJulia.jl

OMJulia.txt

cubakija avatar Aug 11 '21 20:08 cubakija

@cubakija you are using the master version of OMJulia, so this is correct, go to this location C:/Users/USUARIO/AppData/Local/Temp/jl_gzs9vj/RLC.exe and execute RLC.exe manually by clicking on it and see if that works and we can see if the problem is related to jupyter notebook

arun3688 avatar Aug 12 '21 08:08 arun3688

Nothing happens when I execute RLC.exe, but when I execute it as administrator, command prompt appears and disappears for a moment. 😲

cubakija avatar Aug 12 '21 16:08 cubakija

@arun3688 we need to set the paths when running simulate, see my commit on this for OMPython.

adrpo avatar Aug 12 '21 17:08 adrpo

In 1.17 we compile the executable dynamically so we need to set the paths when running simulate or the executable. In 1.18 there is a setting to compile the executable statically, one could use that to escape setting the paths to the dlls.

adrpo avatar Aug 12 '21 17:08 adrpo

@adrpo We already did this for OMJulia, here is the commit https://github.com/OpenModelica/OMJulia.jl/commit/980eba4f5bb30c58b0935f949d0d84889a771f7d, the simulation works in julia REPL, but not from jupyter notebook. And even with this change the simulation did not work on his computer and we need to explicitly set the paths in PATH environment variable and it worked for him, but now it is not working in jupyter notebook

arun3688 avatar Aug 12 '21 17:08 arun3688

@cubakija , when you clicked the executable and if nothing happened means it worked, so i guess there is problem with jupyter notebook, can you also the run the jupyter notebook as administrator and test it and see if that works

arun3688 avatar Aug 12 '21 17:08 arun3688

How do you start the jupyter notebook?

adrpo avatar Aug 12 '21 17:08 adrpo

I run Jupiter notebook 6.3.0 from Start Menu > Programs> Jupyter Notebook (anaconda3) /`(as adminsrtrator). Simulate command still give the error. I rememeber then previosly I could run Jupiter notebook from the Anaconda, but it does not work for a while.

failed process: Process(`C:/Users/USUARIO/AppData/Local/Temp/jl_BeDI3M/RLC.exe`, ProcessExited(3221225785)) [3221225785]

Stacktrace:
  [1] pipeline_error
    @ .\process.jl:525 [inlined]
  [2] run(::Cmd; wait::Bool)
    @ Base .\process.jl:440
  [3] run
    @ .\process.jl:438 [inlined]
  [4] (::OMJulia.var"#29#31"{Bool, Vector{String}})()
    @ OMJulia C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:619
  [5] withenv(f::OMJulia.var"#29#31"{Bool, Vector{String}}, keyvals::Pair{String, String})
    @ Base .\env.jl:161
  [6] simulate(omc::OMJulia.OMCSession, resultfile::Nothing, simflags::Nothing; verbose::Bool)
    @ OMJulia C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:617
  [7] simulate (repeats 2 times)
    @ C:\Users\USUARIO\.julia\packages\OMJulia\P5JuJ\src\OMJulia.jl:569 [inlined]
  [8] top-level scope
    @ In[8]:1
  [9] eval
    @ .\boot.jl:360 [inlined]
 [10] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:1094

cubakija avatar Aug 12 '21 18:08 cubakija

@cubakija, I tested the model in jupyter notebook and it worked fine for me, see the attached screenshot

image

arun3688 avatar Aug 12 '21 20:08 arun3688

We fixed the version and dependecies issues of OMJulia. It could be that that was the issue here and OMJulia v0.2.1 resolves this.

AnHeuermann avatar Feb 23 '23 14:02 AnHeuermann

Closing this issue do to inactivity. If the issue is not solved feel free to reopen this.

AnHeuermann avatar Sep 07 '23 09:09 AnHeuermann