Access violation

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Access violation

Post by ali safaeifar » Thu Nov 10, 2016 1:48 pm

Hi.
I'm suing files of Opensim-Matlab project.
but i have a problem. when i try to run Examples Matlab crashes suddenly, the error log is in the below.
does any one have suggestions about problem?

Thanks a lot.
(Note: i'm sorry for my bad English!)

========================================================================================
MATLAB crash file:C:\Users\ALISAF~1\AppData\Local\Temp\matlab_crash_dump.5472-1:


------------------------------------------------------------------------
Access violation detected at Thu Nov 10 09:07:42 2016
------------------------------------------------------------------------

Configuration:
Crash Decoding : Disabled
Default Encoding : windows-1252
MATLAB Architecture: win32
MATLAB Root : D:\Program Files (x86)\MATLAB\R2014a
MATLAB Version : 8.3.0.532 (R2014a)
Operating System : Microsoft Windows 7 Ultimate
Processor ID : x86 Family 6 Model 42 Stepping 7, GenuineIntel
Virtual Machine : Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) Client VM mixed mode
Window System : Version 6.1 (Build 7601: Service Pack 1)

Fault Count: 1


Abnormal termination:
Access violation

Register State (from fault):
EAX = 06f269d0 EBX = 3489b408
ECX = 090e0000 EDX = 3489b408
ESP = 00c28784 EBP = 00c287b8
ESI = 3dca2b38 EDI = 3489b400

EIP = 779ce43e EFL = 00010202

CS = 00000023 DS = 0000002b SS = 0000002b
ES = 0000002b FS = 00000053 GS = 0000002b

Stack Trace (from fault):
[ 0] 0x779ce43e C:\Windows\SysWOW64\ntdll.dll+00189502 RtlInitUnicodeString+00000406
[ 1] 0x779ce0a3 C:\Windows\SysWOW64\ntdll.dll+00188579 RtlFreeHeap+00000126
[ 2] 0x76e914bd C:\Windows\syswow64\kernel32.dll+00070845 HeapFree+00000020
[ 3] 0x72794c39 C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\MSVCR80.dll+00019513 free+00000205
[ 4] 0x0a9b9969 C:\Program Files (x86)\OpenSim 1.9.1\bin\osimCommon.dll+00301417 OpenSim::XMLNode::GetAttribute+00000201
[ 5] 0x331dfa97 C:\Program Files (x86)\OpenSim 1.9.1\bin\osimSimulation.dll+00064151 OpenSim::ControlLinear::simplify+00001911
[ 6] 0x33210967 C:\Program Files (x86)\OpenSim 1.9.1\bin\osimSimulation.dll+00264551 OpenSim::Model::Model+00000727
[ 7] 0x779ce40c C:\Windows\SysWOW64\ntdll.dll+00189452 RtlInitUnicodeString+00000356
[ 8] 0x7488351b C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll+00013595 GetNVDisplayW+00003707
[ 9] 0x74885243 C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll+00021059 GetNVDisplayW+00011171
[ 10] 0x76e949d0 C:\Windows\syswow64\kernel32.dll+00084432 LoadLibraryA+00000049


This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/

A technical support engineer might contact you with further information.
==================================================================================================

Thank you for your help.

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Access violation

Post by Dimitar Stanev » Fri Nov 11, 2016 12:53 am

Probably, the the .mex that you are running and which was compiled have a runtime errors. The best way to check this is to first run it in the c++ environment. Moreover, make sure to read the instructions better, maybe this project requires some particular version of OpenSim.

User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Re: Access violation

Post by ali safaeifar » Sun Nov 13, 2016 12:20 am

mitkof6 wrote:Probably, the the .mex that you are running and which was compiled have a runtime errors. The best way to check this is to first run it in the c++ environment. Moreover, make sure to read the instructions better, maybe this project requires some particular version of OpenSim.
Hi, thanks for answer.
when i try visual studio to debug the code i receive these errors:

Code: Select all


>	KernelBase.dll!7515338e() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]	
 	mcr.dll!7cfc14b2() 	
 	udd.dll!7ba0dc34() 	
 	ntdll.dll!770471ad() 	
 	ntdll.dll!7703e0a3() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!77043406() 	
 	ntdll.dll!7703e0a3() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e172() 	
 	msvcr80.dll!71df4d83() 	
 	msvcr80.dll!71e20e30() 	
 	msvcr80.dll!71e40475() 	
 	msvcp80.dll!73da1201() 	
 	msvcp80.dll!73da394d() 	
 	msvcp80.dll!73da49ea() 	
 	osimCommon.dll!25823d6c() 	
 	osimCommon.dll!25824014() 	
 	kernel32.dll!757814bd() 	
 	msvcr80.dll!71df4c39() 	
 	osimCommon.dll!25806725() 	
 	osimCommon.dll!25823284() 	
 	osimTools.dll!2579ce83() 	
 	osimTools.dll!2579bec6() 	
 	ntdll.dll!7703160e() 	
 	ntdll.dll!770738ad() 	
 	ntdll.dll!7707349b() 	
 	ntdll.dll!7707343c() 	
 	ntdll.dll!77020143() 	
 	msvcp80.dll!73da2f20() 	
 	osimSimulation.dll!277ff1f0() 	
 	osimSimulation.dll!27800967() 	
 	openSimSFunction.mexw32!mdlCheckParameters(SimStruct_tag * S)  Line 291 + 0x13 bytes	C++
 	openSimSFunction.mexw32!_ProcessMexSfunctionCmdLineCall(int nlhs, mxArray_tag * * plhs, int nrhs, const mxArray_tag * * prhs)  Line 2669 + 0x55 bytes	C++
 	openSimSFunction.mexw32!mexFunction(int nlhs, mxArray_tag * * plhs, int nrhs, const mxArray_tag * * prhs)  Line 3260 + 0x15 bytes	C++
 	libmex.dll!7c78dd2e() 	
 	libmex.dll!7c78c469() 	
 	libmex.dll!7c78d5ad() 	
 	ntdll.dll!7704a323() 	
 	ntdll.dll!7703e0a3() 	
 	KernelBase.dll!75159d71() 	
 	ntdll.dll!7703e6ff() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!7703e40c() 	
 	m_dispatcher.dll!1000b165() 	
 	m_dispatcher.dll!1000ba21() 	
 	libut.dll!02444fb1() 	
 	user32.dll!75d24e05() 	
 	mpath.dll!7dcfef2d() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e40c() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!770442ff() 	
 	ntdll.dll!770442ff() 	
 	ntdll.dll!7703e40c() 	
 	msvcr100.dll!003009ee() 	
 	msvcr100.dll!00302306() 	
 	libmwfl.dll!7e2f26f8() 	
 	libmx.dll!7dd61303() 	
 	libmx.dll!7ddf86ff() 	
 	libmwsimulink.dll!1f7dd05f() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!0243ee71() 	
 	libmwsimulink.dll!1f875823() 	
 	libmwsimulink.dll!1f8758ef() 	
 	libmwsimulink.dll!1f7c4697() 	
 	libmwsimulink.dll!1f665110() 	
 	libmwsimulink.dll!1f665342() 	
 	libmwsimulink.dll!1f695515() 	
 	libmwsimulink.dll!1f698be6() 	
 	sl_datamodel.dll!62e955d9() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!0243ee71() 	
 	sl_datamodel.dll!62e66481() 	
 	sl_datamodel.dll!62e5d01e() 	
 	sl_editor.dll!632bf3df() 	
 	sl_editor.dll!632c3bb7() 	
 	sl_editor.dll!632c6a7c() 	
 	sl_editor.dll!632c759d() 	
 	libmwsimulink.dll!1f534452() 	
 	libmwsimulink.dll!1f534335() 	
 	libmwsimulink.dll!1f53728e() 	
 	glue2.dll!694c0fe6() 	
 	glue2.dll!694baff4() 	
 	glue2.dll!694bb31d() 	
 	sl_editor.dll!6335b649() 	
 	sl_editor.dll!6335b600() 	
 	sl_editor.dll!6335d661() 	
 	sl_editor.dll!6335d921() 	
 	libmwsimulink.dll!1f1812d7() 	
 	libmwsimulink.dll!1f182a02() 	
 	libmwsimulink.dll!1f1833df() 	
 	libmwsimulink.dll!1f18369f() 	
 	libmwsimulink.dll!1f1ad8cd() 	
 	libmwsimulink.dll!1f87d0ae() 	
 	libmwsimulink.dll!1f1824cc() 	
 	libmwsimulink.dll!1f183683() 	
 	kernel32.dll!757814bd() 	
 	libmwsimulink.dll!1f1af364() 	
 	m_dispatcher.dll!10021720() 	
 	m_dispatcher.dll!1000b37c() 	
 	m_dispatcher.dll!1000b8e6() 	
 	m_interpreter.dll!02b66eca() 	
 	m_interpreter.dll!02b06158() 	
 	kernel32.dll!757814bd() 	
 	tbbmalloc.dll!716c5869() 	
 	kernel32.dll!757814bd() 	
 	kernel32.dll!757814bd() 	
 	m_interpreter.dll!02aa715a() 	
 	m_interpreter.dll!02ab99b6() 	
 	m_interpreter.dll!02aa91f0() 	
 	libut.dll!02403f45() 	
 	libmwfl.dll!7e2f2692() 	
 	libmx.dll!7dd71774() 	
 	libmx.dll!7dd71853() 	
 	libmx.dll!7dd7198d() 	
 	m_interpreter.dll!02aa80f1() 	
 	m_dispatcher.dll!1000b37c() 	
 	kernel32.dll!757814bd() 	
 	m_dispatcher.dll!1000b8e6() 	
 	m_interpreter.dll!02b8b272() 	
 	m_interpreter.dll!02b413a5() 	
 	m_interpreter.dll!02aefe07() 	
 	m_interpreter.dll!02b0198a() 	
 	TKGeomAlgo.dll!77ca3635() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!770442ff() 	
 	ntdll.dll!7703e172() 	
 	ntdll.dll!7703e40c() 	
 	m_interpreter.dll!02aca1c4() 	
 	TKGeomAlgo.dll!77ca37e1() 	
 	ntdll.dll!7703e0a3() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	m_dispatcher.dll!1000c055() 	
 	m_dispatcher.dll!1000b8e6() 	
 	m_interpreter.dll!02abcfd4() 	
 	m_interpreter.dll!02aaaa14() 	
 	m_interpreter.dll!02ae0238() 	
 	m_interpreter.dll!02af3e15() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!0243efd9() 	
 	msvcr100.dll!00300350() 	
 	msvcr100.dll!00300726() 	
 	msvcr100.dll!00300733() 	
 	msvcr100.dll!0030076a() 	
 	msvcr100.dll!00311142() 	
 	msvcr100.dll!0031118f() 	
 	libmx.dll!7dd97356() 	
 	ntdll.dll!77043431() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!0243efd9() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	kernel32.dll!757814bd() 	
 	tbbmalloc.dll!716c744b() 	
 	m_interpreter.dll!02b08304() 	
 	libmwfl.dll!7e2f26f8() 	
 	msvcr100.dll!00300269() 	
 	msvcr100.dll!00300269() 	
 	m_interpreter.dll!02aded26() 	
 	m_interpreter.dll!02b33d5b() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	m_interpreter.dll!02b11957() 	
 	libut.dll!024428cd() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!024428cd() 	
 	m_interpreter.dll!02ab99b6() 	
 	msvcr100.dll!00300269() 	
 	m_interpreter.dll!02b2f3b5() 	
 	m_interpreter.dll!02b088c4() 	
 	m_interpreter.dll!02aefe07() 	
 	m_interpreter.dll!02b0198a() 	
 	m_interpreter.dll!02af7f7b() 	
 	m_interpreter.dll!02af398a() 	
 	m_dispatcher.dll!1000b165() 	
 	m_interpreter.dll!02abcfd4() 	
 	m_interpreter.dll!02abd008() 	
 	m_interpreter.dll!02ae0191() 	
 	m_interpreter.dll!02af3e15() 	
 	m_interpreter.dll!02b1f0b8() 	
 	m_interpreter.dll!02b1f17f() 	
 	m_interpreter.dll!02ae759f() 	
 	msvcr100.dll!0037558d() 	
 	msvcr100.dll!003755a6() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!0243efd9() 	
 	msvcr100.dll!00300269() 	
 	m_interpreter.dll!02b56d2d() 	
 	m_interpreter.dll!02aeeb57() 	
 	m_interpreter.dll!02aed4bf() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	m_interpreter.dll!02aed9d8() 	
 	m_interpreter.dll!02b3679e() 	
 	m_interpreter.dll!02b3695b() 	
 	m_interpreter.dll!02aed9d8() 	
 	libut.dll!02445684() 	
 	msvcr100.dll!00300269() 	
 	libut.dll!0243efd9() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	kernel32.dll!757814bd() 	
 	m_interpreter.dll!02b04bf3() 	
 	m_interpreter.dll!02aefe07() 	
 	m_interpreter.dll!02b0198a() 	
 	m_interpreter.dll!02af7eca() 	
 	m_interpreter.dll!02af398a() 	
 	m_dispatcher.dll!1000b30a() 	
 	m_dispatcher.dll!1000ba21() 	
 	m_interpreter.dll!02b53a33() 	
 	m_interpreter.dll!02b43edd() 	
 	m_interpreter.dll!02b439f9() 	
 	m_interpreter.dll!02b36771() 	
 	m_interpreter.dll!02b3695b() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	m_interpreter.dll!02aed9d8() 	
 	m_interpreter.dll!02ae6ca2() 	
 	libut.dll!02445684() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	m_interpreter.dll!02b3272e() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!0030016a() 	
 	m_interpreter.dll!02b54c81() 	
 	kernel32.dll!757814bd() 	
 	verify.dll!70371c9d() 	
 	icuuc49.dll!011e478f() 	
 	icuuc49.dll!011e4c34() 	
 	icuuc49.dll!011eafe9() 	
 	m_dispatcher.dll!1000b30a() 	
 	m_dispatcher.dll!1000ba21() 	
 	msvcr100.dll!00300269() 	
 	msvcr100.dll!0030233b() 	
 	m_interpreter.dll!02b746ec() 	
 	m_interpreter.dll!02b7d11f() 	
 	m_interpreter.dll!02b82159() 	
 	m_interpreter.dll!02b82135() 	
 	m_interpreter.dll!02b820f0() 	
 	kernel32.dll!757814bd() 	
 	msvcr100.dll!00300269() 	
 	msvcr100.dll!0030233b() 	
 	msvcr100.dll!003754e7() 	
 	m_interpreter.dll!02d53105() 	
 	libmwbridge.dll!7ba8ba83() 	
 	m_dispatcher.dll!1000f7f3() 	
 	m_dispatcher.dll!10045e78() 	
 	jvm.dll!0822c0d7() 	
 	jvm.dll!08233e34() 	
 	jvm.dll!08199deb() 	
 	mcr.dll!7cfaeb3c() 	
 	mcr.dll!7cf9cf73() 	
 	mcr.dll!7cf827aa() 	
 	mcr.dll!7cf82866() 	
 	uiw.dll!7b72fcdc() 	
 	uiw.dll!7b730299() 	
 	uiw.dll!7b7302f0() 	
 	uiw.dll!7b73033e() 	
 	uiw.dll!7b73033e() 	
 	user32.dll!75cd8336() 	
 	user32.dll!75cd8336() 	
 	user32.dll!75cc80a9() 	
 	user32.dll!75cc8ba1() 	
 	ntdll.dll!7702f8fa() 	
 	user32.dll!75cc8bd3() 	
 	ntdll.dll!7702011a() 	
 	user32.dll!75cd0735() 	
 	user32.dll!75cd06eb() 	
 	user32.dll!75cd60dc() 	
 	uiw.dll!7b6e46dd() 	
 	uiw.dll!7b731524() 	
 	libmwservices.dll!00fcb074() 	
 	libmwservices.dll!00fcb6da() 	
 	libmwservices.dll!00fcb28f() 	
 	libmwservices.dll!00fcc12b() 	
 	libmwservices.dll!00fd4cea() 	
 	hg.dll!79bad25b() 	
 	ntdll.dll!770498d5() 	
i don't know what's the problem! any suggestion?

thank you again.
(Note: i'm sorry for my bad English)

User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Re: Access violation

Post by ali safaeifar » Mon Nov 14, 2016 12:06 pm

i need your help yet.
please help me if you have any suggestion.

Thank you very much.

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Access violation

Post by Dimitar Stanev » Tue Nov 15, 2016 12:33 am

Please provide more details, about what you are trying to do. Where is this mex project and how did you setup your OpenSim installation. Probably you have miss-configured something.

User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Re: Access violation

Post by ali safaeifar » Tue Nov 15, 2016 4:31 am

Hi Stanev.

I explain my works here:
1- firstly i joined to this project: https://simtk.org/projects/opensim-matlab
2- I downloaded the project files (by svn method) that consists these folders: "Download Opensim", "Interface_OpenSim_v1.9.1" and "Interface_OpenSim_v2.3.1". then i copied to another directory.
3- I installed the OpenSim-1.9.1-win32.exe from the first folder.
4- I installed Microsoft visual studio 2008.
5- I installed Matlab R2010a (32bit).
6-I set my mex compiler as "Microsoft visual studio 2008"
7- after that i opened "compileOpensimSFunction.m" and "opensimSFunction.cpp" from this directory: Interface_OpenSim_v1.9.1/block.
8- in the "compileOpensimSFunction.m" i edited these lines (To fit my system):

Code: Select all

     include = [' -I"' opensimroot '\sdk\include"'...
           ' -I"' opensimroot '\sdk\include\SimTK\include"'...
           ' -I"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include"'...
           ' -I"C:\Program Files (x86)\Microsoft Visual Studio 10.0\include"'];
9- also i edited this line:

Code: Select all

eval(['mex -v -f msvc90freeopts.bat' include compilerFlags mexcode libs]) 
to

Code: Select all

eval(['mex -v -f msvc90opts.bat' include compilerFlags mexcode libs]) 
because the matlab couldn't find "msvc90freeopts.bat".

10- after that i run this m-file and get the "openSimSFunction.mexw32"
11- then i open this directory: "Interface_OpenSim_v1.9.1\examples\tug12" and open this m-file: "tug12_runsimulation.m"
12- then i run this m-file to run the simulink file. in the command window matlab shown this log:
mdlInitializeSizes.
-----------------------------------------------------------------------
mdlCheckParameters.
-----------------------------------------------------------------------
Parameter #1 (modelFileName = tug12.osim) is a valid MATLAB character array (string) naming a model file on your path.
Parameter #2 (controlsFileName = tug12_controls.xml) is a valid MATLAB character array (string) naming a file on your path.

WARNING: Parameter #3 (initialStatesFileName = ) is NOT a valid MATLAB character array (string) naming a file on your path.
The S-Function will attempt to use initial states from the MATLAB workspace instead.

-----------------------------------------------------------------------
mdlProcessParameters.
-----------------------------------------------------------------------
Loading OpenSim libraries.
Loading OpenSim model from tug12.osim.
13- after that matlab crashed and shown me Access violation error (my first comment in this post).


Thank you very much for your help.
Note: I'm so sorry for my bad English!

User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Re: Access violation

Post by ali safaeifar » Tue Nov 15, 2016 11:16 am

Hi again!
I had a bit of progress. Other systems have used and I changed several assumptions. In this case, the following text appears in the command window:

MATLAB desktop keyboard shortcuts, such as Ctrl+S, are now customizable.
In addition, many keyboard shortcuts have changed for improved consistency
across the desktop.

To customize keyboard shortcuts, use Preferences. From there, you can also
restore previous default settings by selecting "R2009a Windows Default Set"
from the active settings drop-down list. For more information, see Help.

Click here if you do not want to see this message again.

-------------------------------------------------------
This program includes software developed by the
Apache Software Foundation (http://www.apache.org/).
-------------------------------------------------------


-------------------------------------------------------
Library SimbodyEngine...
-------------------------------------------------------

mdlInitializeSizes.
-----------------------------------------------------------------------
mdlCheckParameters.
-----------------------------------------------------------------------
Parameter #1 (modelFileName = tug12.osim) is a valid MATLAB character array (string) naming a model file on your path.
Parameter #2 (controlsFileName = tug12_controls.xml) is a valid MATLAB character array (string) naming a file on your path.

WARNING: Parameter #3 (initialStatesFileName = ) is NOT a valid MATLAB character array (string) naming a file on your path.
The S-Function will attempt to use initial states from the MATLAB workspace instead.

-----------------------------------------------------------------------
mdlProcessParameters.
-----------------------------------------------------------------------
Loading OpenSim libraries.
Loading OpenSim model from tug12.osim.
Version migrating an object of type SimbodyEngine to latest version.
Created model tug12 from file tug12.osim
Setting up OpenSim model.
Checking ActuatorSet of OpenSim model.
-----------------------------------------------------------------------
Input port width 2
Input port #1 width = 2.
Input port #1 number of dimensions = 2.
Input port #1 dimension[0] size = 2.
Input port #1 dimension[1] size = 1.
Input port #1 data type = SS_DOUBLE.
Output port #1 width = 6.
Output port #1 number of dimensions = 2.
Output port #1 dimension[0] size = 6.
Output port #1 dimension[1] size = 1.
Output port #1 data type = SS_DOUBLE.
-----------------------------------------------------------------------

mdlInitializeSizes.
-----------------------------------------------------------------------
mdlCheckParameters.
-----------------------------------------------------------------------
Parameter #1 (modelFileName = tug12.osim) is a valid MATLAB character array (string) naming a model file on your path.
Parameter #2 (controlsFileName = tug12_controls.xml) is a valid MATLAB character array (string) naming a file on your path.

WARNING: Parameter #3 (initialStatesFileName = ) is NOT a valid MATLAB character array (string) naming a file on your path.
The S-Function will attempt to use initial states from the MATLAB workspace instead.

-----------------------------------------------------------------------
mdlProcessParameters.
-----------------------------------------------------------------------
Loading OpenSim libraries.
Loading OpenSim model from tug12.osim.
Version migrating an object of type SimbodyEngine to latest version.
Created model tug12 from file tug12.osim
Setting up OpenSim model.
Checking ActuatorSet of OpenSim model.
-----------------------------------------------------------------------
Input port width 2
Input port #1 width = 2.
Input port #1 number of dimensions = 2.
Input port #1 dimension[0] size = 2.
Input port #1 dimension[1] size = 1.
Input port #1 data type = SS_DOUBLE.
Output port #1 width = 6.
Output port #1 number of dimensions = 2.
Output port #1 dimension[0] size = 6.
Output port #1 dimension[1] size = 1.
Output port #1 data type = SS_DOUBLE.
-----------------------------------------------------------------------

mdlInitializeSampleTimes.
-----------------------------------------------------------------------
-----------------------------------------------------------------------

mdlSetWorkWidths.
-----------------------------------------------------------------------
Setting number of continuous states to 6.
Input port #1 width = 2.
Input port #1 number of dimensions = 2.
Input port #1 dimension[0] size = 2.
Input port #1 dimension[1] size = 1.
Input port #1 data type = SS_DOUBLE.
Output port #1 width = 6.
Output port #1 number of dimensions = 2.
Output port #1 dimension[0] size = 6.
Output port #1 dimension[1] size = 1.
Output port #1 data type = SS_DOUBLE.
-----------------------------------------------------------------------
mdlStart.
-----------------------------------------------------------------------
Construct OpenSim Storage object for states output.
but matlab crashes again, this log is shown:
MATLAB crash file:C:\Users\ADMINI~1\AppData\Local\Temp\matlab_crash_dump.1228:


------------------------------------------------------------------------
Segmentation violation detected at Tue Nov 15 09:51:36 2016
------------------------------------------------------------------------

Configuration:
MATLAB Version: 7.10.0.499 (R2010a)
MATLAB License: 161051
Operating System: Microsoft Windows 7
Window System: Version 6.1 (Build 7600)
Processor ID: x86 Family 6 Model 15 Stepping 11, GenuineIntel
Virtual Machine: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: windows-1252

Fault Count: 1

Register State:
EAX = 00100000 EBX = 29d47fb8
ECX = 00000001 EDX = 000007ff
ESI = 29d37658 EDI = 01440000
EBP = 00c2d7ac ESP = 00c2d784
EIP = 77082840 FLG = 00010202

Stack Trace:
[0] ntdll.dll:0x77082840(0x01440000, 0x29d47fb8 "Óøtoã¹", 0x00c2d874 "Óø", 0)
[1] ntdll.dll:0x77082b47(0x29d47fb8 "Óøtoã¹", 0x29d47fc0, 0x29d47fc0, 2)
[2] ntdll.dll:0x77082a32(0x01440000, 0, 0x29d47fc0, 0x00c2d924)
[3] kernel32.dll:0x750314d1(0x01440000, 0, 0x29d47fc0, 0xea9c5120)
[4] MSVCR80.dll:0x00134c39(0x29d47fc0, 0x058f946e, 0x27ab1ac8, 0x00c2da04)
[5] osimSimulation.dll:0x299b71cf(0, 0, 0x2765f3a4 "ÀM`' not to increase (i.e., _cap..", 4)
[6] 0x656d6974(0x63655665, 0x2e726f74, 0x69766964, 0x203a6564)
[7] WindowsCodecs.dll:0x74617453(0x74f18b56, 0xfc468b2b, 0x99706857, 0x7e8d2763)
[8] 0x02c3f608

This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contac ... est_1.html

A technical support engineer might contact you with further information.

Thank you for your help. MATLAB may attempt to recover, but even if recovery appears successful,
we recommend that you save your workspace and restart MATLAB as soon as possible.

-------------------------------------------------------------
This segmentation violation occurred while executing the
S-function 'openSimSFunction' in block 'tug12/S-Function1'.
A common cause of this segmentation violation is an incorrect
input port direct feedthrough setting. Each input port of the
S-function that is read (accessed) in mdlOutputs and/or
mdlGetTimeOfNextVarHit must specify that it needs its input
signal in these routines by setting direct feedthrough for
these input ports.
1) To debug your C-MEX S-function, you can enable diagnostics
by compiling the S-function source with the -g flag, e.g.,
mex -g sfunction_name.c
2) You can ask Simulink to try assuming your S-function has
direct feedthrough using:
set_param('modelname','TryForcingSFcnDF','on')
If Simulink can find a valid sorting mode that does not
result in algebraic loops involving your S-function, your
model will execute (assuming that the cause of this
segmentation violation is an incorrect direct feedthrough
setting on an input port).
See matlabroot/simulink/src/sfuntmpl_directfeed.txt
-------------------------------------------------------------

User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Re: Access violation

Post by ali safaeifar » Wed Nov 16, 2016 12:33 am

Finally i tried to debug code, and i found the "Matlab.exe has triggered a breakponit" occurs in this line of "OpenSimSFunction.cpp" code (Line:1261):

Code: Select all

    model->getStateNames(stateNames);
but i don't know how to solve the problem.
please help me to solve it.

Thank you so much

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Access violation

Post by Dimitar Stanev » Wed Nov 16, 2016 6:27 am

Have you tired to use the new version of 2.4 instead of 1.8? The problem does not seems to be caused by an error in the code (hope so), because others have used this also. I think that maybe you didn't configured correctly the path variable or you haven't installed the appropriate visual studio. This may cause problems because if you are compiling with the wrong VS (dlls), there may be inconsistencies between different redistributions. Did you try to address this issue to the developers of the interface?

User avatar
ali safaeifar
Posts: 11
Joined: Wed Nov 02, 2016 2:07 am

Re: Access violation

Post by ali safaeifar » Wed Nov 16, 2016 6:37 am

Thank you so much Stanev.
my configure:
1- visual studio 2008 sp1
2- opensim 1.9.1
3-Microsoft Windows SDK: v6.0A

path seems be true!
nobody (of developers) answerd to me completely.
any more suggestions please?
where can i download 2.4 version?
Last edited by ali safaeifar on Wed Nov 16, 2016 6:58 am, edited 1 time in total.

POST REPLY