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

modelica 3D Visualisation problems

modelica 3D Visualisation problems

I'm trying to visualise a simulation with modelica 3d

I can run my model without the visualisation fine.

when I load the modelica 3D services it will no longer run

I think that the main error is

"[D:\users\Lewis\Modelica\001_OpenModelica\lib\omlibrary\ModelicaServices 3.2.1 modelica3d\package.mo:693:5-694:97:writable] Error: Base class Modelica.Utilities.Internal.PartialModelicaServices.ExternalReferences.PartialLoadResource not found in scope ModelicaServices.ExternalReferences.loadResource.

But I don't understand what I should do about it

Code

 Spoiler Show Spoiler Hide Spoiler
 
loadModel(Modelica); getErrorString();
getVersion();

loadFile("D:/users/Lewis/Modelica/003_OpenModelicaRuns/PID_001.mo"); getErrorString();

simulate(PID_001,outputFormat="csv");


loadModel(ModelicaServices, {"3.2.1 modelica3d"}); getErrorString();

// get the path to modelica3d patches

m3d_path := getInstallationDirectoryPath() + "lib/omlibrary-modelica3d/";

// load the changed Modelica.Utilities.Internal

loadFile(m3d_path + "Internal.mo"); getErrorString();


cd("D:/users/Lewis/Modelica/003_OpenModelicaRuns/WD"); getErrorString();

simulate(PID_001,outputFormat="csv");




loadString("

model Visualise_2

inner ModelicaServices.Modelica3D.Controller m3d_control;

extends PID_001;

end Visualise_2;

");getErrorString();

simulate(Visualise_2); getErrorString();
Error
 Spoiler Show Spoiler Hide Spoiler
 

true
""
"1.9.1 Beta2 (r19512) (RML version)"
true
""
record SimulationResult
    resultFile = "C:/Users/l.barnaby/PID_001_res.csv",
    simulationOptions = "startTime = 0.0, stopTime = 4.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'PID_001', options = '', outputFormat = 'csv', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "Warning: Variable PID.k out of [min, max] interval: PID.k >= 0.0 has value: -20
",
    timeFrontend = 1.142922184871792,
    timeBackend = 0.3263187973914907,
    timeSimCode = 0.1418492973228509,
    timeTemplates = 0.5762805270086848,
    timeCompile = 2.668712801599422,
    timeSimulation = 0.735466554648296,
    timeTotal = 5.592271785888649
end SimulationResult;
true
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
"
"D:/users/Lewis/Modelica/001_OpenModelica/lib/omlibrary-modelica3d/"
true
""
"D:/users/Lewis/Modelica/003_OpenModelicaRuns/WD"
""
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 4.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'PID_001', options = '', outputFormat = 'csv', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "Failed to build model: PID_001",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;
true
"[D:\users\Lewis\Modelica\001_OpenModelica\lib\omlibrary\ModelicaServices 3.2.1 modelica3d\package.mo:693:5-694:97:writable] Error: Base class Modelica.Utilities.Internal.PartialModelicaServices.ExternalReferences.PartialLoadResource not found in scope ModelicaServices.ExternalReferences.loadResource.
Error: Error occurred while flattening model PID_001
"
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Visualise_2', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "Failed to build model: Visualise_2",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;
"[D:\users\Lewis\Modelica\001_OpenModelica\lib\omlibrary\ModelicaServices 3.2.1 modelica3d\package.mo:693:5-694:97:writable] Error: Base class Modelica.Utilities.Internal.PartialModelicaServices.ExternalReferences.PartialLoadResource not found in scope ModelicaServices.ExternalReferences.loadResource.
Error: Error occurred while flattening model Visualise_2
"

I have the dbus server running (it says "Running dbus-server...)


Does anybody have any suggestions?


Thanks
Dexter

Re: modelica 3D Visualisation problems

Do you have MSL 3.1 or 3.2.1 loaded? getVersion(Modelica) should tell.

Re: modelica 3D Visualisation problems

3.2.1

Re: modelica 3D Visualisation problems

Then do not load the Internal.mo. It is only for MSL 3.1. Skip that or simply call: loadModelica3D()

Re: modelica 3D Visualisation problems

Thanks, but I still have a problem:



true
""
"3.2.1"
true
""
true
""
true
""
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Visualize_DoublePendulum', options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "Failed to build model: Visualize_DoublePendulum",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
Error: Error building simulator. Build log: gcc   -falign-functions -msse2 -mfpmath=sse     -I"D:/users/Lewis/Modelica/001_OpenModelica//include/omc/c" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o Visualize_DoublePendulum.o Visualize_DoublePendulum.c

gcc   -falign-functions -msse2 -mfpmath=sse     -I"D:/users/Lewis/Modelica/001_OpenModelica//include/omc/c" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o Visualize_DoublePendulum_functions.o Visualize_DoublePendulum_functions.c

gcc   -falign-functions -msse2 -mfpmath=sse     -I"D:/users/Lewis/Modelica/001_OpenModelica//include/omc/c" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o Visualize_DoublePendulum_records.o Visualize_DoublePendulum_records.c

gcc   -falign-functions -msse2 -mfpmath=sse     -I"D:/users/Lewis/Modelica/001_OpenModelica//include/omc/c" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o Visualize_DoublePendulum_01exo.o Visualize_DoublePendulum_01exo.c

Visualize_DoublePendulum_functions.c:10:22: error: modcount.h: No such file or directory

Visualize_DoublePendulum_functions.c:11:20: error: modbus.h: No such file or directory

Visualize_DoublePendulum_functions.c: In function 'omc_ModelicaServices_modbus_Connection_constructor':

Visualize_DoublePendulum_functions.c:693: warning: assignment makes pointer from integer without a cast

Visualize_DoublePendulum_functions.c: In function 'omc_ModelicaServices_modbus_Message_constructor':

Visualize_DoublePendulum_functions.c:1317: warning: assignment makes pointer from integer without a cast

Visualize_DoublePendulum_functions.c: In function 'omc_ModelicaServices_modcount_Context_constructor':

Visualize_DoublePendulum_functions.c:1331: warning: assignment makes pointer from integer without a cast

Visualize_DoublePendulum_functions.c: In function 'omc_ModelicaServices_modcount_getString':

Visualize_DoublePendulum_functions.c:1393: warning: assignment makes pointer from integer without a cast

Visualize_DoublePendulum_functions.c: In function 'omc_ModelicaServices_modcount_HeapString_constructor':

Visualize_DoublePendulum_functions.c:1420: warning: assignment makes pointer from integer without a cast

gcc   -falign-functions -msse2 -mfpmath=sse     -I"D:/users/Lewis/Modelica/001_OpenModelica//include/omc/c" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o Visualize_DoublePendulum_02nls.o Visualize_DoublePendulum_02nls.c

mingw32-make: *** [Visualize_DoublePendulum_functions.o] Error 1

mingw32-make: *** Waiting for unfinished jobs....


"

Re: modelica 3D Visualisation problems

You should have the files in: D:/users/Lewis/Modelica/001_OpenModelica/lib/omlibrary/ModelicaServices 3.2.1 modelica3d/Resources/Include/
If you don't, it might have been fixed in the nightly build.

Re: modelica 3D Visualisation problems

Thanks,

I don't seem to have a resources folder there. I'll download the new build

Re: modelica 3D Visualisation problems

Right, I think I'm getting closer, but still have an error:

true
""
"3.2.1"
""
true
""
true
""
true
""
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Visualize_DoublePendulum', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "Simulation execution failed for model: Visualize_DoublePendulum
process 1036: arguments to dbus_message_iter_append_basic() were incorrect, assertion \"_dbus_check_is_valid_utf8 (*string_p)\" failed in file dbus-message.c line 2598.
This is normally a bug in some application using the D-Bus library.


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Backtrace:
3    ZwWaitForSingleObject+0x15
3    WaitForSingleObjectEx+0x43
3    WaitForSingleObject+0x12
3    dbus_threads_init+0x2119
3    dbus_malloc+0x182b
3    dbus_pending_call_set_notify+0x844
3    dbus_message_iter_append_basic+0x129
3    omc_OpenModelica_Scripting_Internal_stat+0x4430a
3    omc_OpenModelica_Scripting_Internal_stat+0x443d0
3    omc_ModelicaServices_modbus_addString+0x25
3    omc_ModelicaServices_Modelica3D_setAmbientColor+0xa0
3    omc_OpenModelica_Scripting_Internal_stat+0x24fa7
3    omc_OpenModelica_Scripting_Internal_stat+0x2ed85
3    dbus_server_listen+0x37cda
3    dbus_server_listen+0x39167
3    dbus_server_listen+0x128f3
3    dbus_server_listen+0x12f1f
3    dbus_server_listen+0xacd6
3    dbus_server_listen+0xb28a
3    dbus_server_listen+0xd3e9
2    C:\\Users\\l.barnaby\\Visualize_DoublePendulum.exe+0x13931
2    C:\\Users\\l.barnaby\\Visualize_DoublePendulum.exe+0x10db
2    C:\\Users\\l.barnaby\\Visualize_DoublePendulum.exe+0x1178
3    BaseThreadInitThunk+0x12
3    RtlInitializeExceptionChain+0x63
3    RtlInitializeExceptionChain+0x36
",
    timeFrontend = 1.014565460790223,
    timeBackend = 0.6924996963059945,
    timeSimCode = 0.4708807652891414,
    timeTemplates = 1.010064205357063,
    timeCompile = 3.058960421675423
end SimulationResult;
"Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
"


dbus says its running, and I'm using the new one in the nightly build ...\lib\omlibrary-modelica3d\osg-gtk

Re: modelica 3D Visualisation problems

It seems we need to make some fixes for modelica3d again... I added a check for an illegal feature used by the library:

Code:

[/home/marsj/trunk/build/lib/omlibrary/ModelicaServices 3.2.1 modelica3d/Modelica3D/package.mo:455:5-505:23:writable] Error: Function Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape.shapeDescrTo3D returns an external object, but the only function allowed to return this object is ModelicaServices.modcount.HeapString.constructor.

Re: modelica 3D Visualisation problems

Should be fixed in r21083. New nightly builds appear in around 12 hours if nothing breaks them.

Re: modelica 3D Visualisation problems

Brilliant - it works just fine now.

Thanks for your help

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