Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mix Fixed and Variable Step

Status
Not open for further replies.

TooHotToHandle

New member
Nov 30, 2011
8
Hello

I am attempting to model a simple mass-spring-damper system with PID contol. I am attempting to run the MSD side of things in a simulink model block with a variable step solver and the controller in a separate fixed step model bloack. The top model which contains the both of the two model blocks has a variable step solver.

The simulink solver documentation mstates that this is a feaxible solver configuration:

Top Model Solver Type Submodel Solver Type
Variable Step Fixed-step

Compatibility
Allowed unless the submodel is multi-rate and specifies both a discrete sample time and a continuous sample time

The submodel used has a single discrete time step of 4ms so to my mind the conditions that have been set are feasible. Only problem is when i run the simulation MATLAB and Simulink both close. This makes inspection of the problem somewhat difficult.

I am attaching the files so that anybody who is interested and who feels they may have an idea as to what the solution may be can help.

Any help would be more than appreciated. I have battled with this for some time now.
 
Replies continue below

Recommended for you

I think the problem may have something to do with selecting the 'Inline Parameters' check box for model referencing..
 
Warning: The model 'SCM2' does not have continuous states, hence using the solver 'FixedStepDiscrete' instead of solver 'ode4'. You can disable
this diagnostic by explicitly specifying a discrete solver in the solver tab of the Configuration Parameters dialog, or setting 'Automatic
solver parameter selection' diagnostic to 'none' in the Diagnostics tab of the Configuration Parameters dialog.
Warning: Output port 1 of 'SCM2/Sum1' is not connected.

------------------------------------------------------------------------
Segmentation violation detected at Thu Dec 01 10:38:32 2011
------------------------------------------------------------------------

Configuration:
MATLAB Version: 7.6.0.324 (R2008a)
MATLAB License: 226352
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 2)
Processor ID: x86 Family 6 Model 15 Stepping 13, GenuineIntel
Virtual Machine: Java 1.6.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Default Encoding: windows-1252

Fault Count: 1

Register State:
EAX = 00000001 EBX = 00000000
ECX = 00000001 EDX = 00000000
ESI = 00000000 EDI = 00000001
EBP = 00d3a654 ESP = 00d3a654
EIP = 6facd14a FLG = 00210202

Stack Trace:
[0] libmwsimulink.dll:bool (__cdecl*__cdecl utGetSlBuiltinDtypeConvFcn(int,int,enum fxpModeOverflow_tag,enum fxpModeRounding_tag))(void const *,void *,unsigned int,unsigned int,bool,bool,bool,int,int,enum fxpModeOverflow_tag,enum fxpModeRounding_tag)(0xfffffff6, 0, 1, 0) + 58 bytes
[1] libmwsimulink.dll:bool __cdecl slConvertBuiltInDTypeVectWithCheck(void const *,unsigned int,int,bool,void *,unsigned int,int,bool,enum fxpModeOverflow_tag,enum fxpModeRounding_tag,bool)(0x1e728168, 1, 0xfffffff6, 0) + 27 bytes
[2] libmwsimulink.dll:int __cdecl ConvertBetweenBuiltinFcn(struct _slDataTypeAccess_tag *,char const *,int,int,int,void const *,void const *,void *)(0x16b2a580, 0x6fc02708, 0, 14) + 94 bytes
[3] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl ConnectFixedPath(class slBlock *,void const *)(0, 0x1643d270 "@tÖoPzdo", 0x03d349b0, 0x1d6df530) + 554 bytes
[4] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl PostCompileOptimization(struct slBlockDiagram_tag *)(0x18a20340, 0, 0x1e50b6c0, 0x00d3a834 "¤¨Ó") + 83 bytes
[5] libmwsimulink.dll:_BlockReductionOptimization(0x18a20340, 0x1d6df530, 0x193e18e0, 0x18a20340) + 67 bytes
[6] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl sleCompileBlockDiagram(struct slBlockDiagram_tag *,bool,bool,enum SimType,struct mxArray_tag *)(0x03d349b0, 0, 0, 1) + 8931 bytes
[7] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl GetBlockDiagramModelType(class slModel *,struct sleInitModelContext *,bool,bool)(0x00d3a8fc, 0, 0, 0x15764d50) + 2049 bytes
[8] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl sleInitModel(class slModel *,struct sleInitModelContext,bool,bool)(0x18a20340, 1, 0xffffffff, 0) + 182 bytes
[9] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl sleInitModelForMenuSim(struct slBlockDiagram_tag *)(0x03d349b0, 0, 0x03d349b0, 0) + 113 bytes
[10] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl sleModelExecutionInterface(struct slBlockDiagram_tag *,enum slEngineCmdOption,enum ECStatus *)(0x03d349b0, 0, 0x00d3a990, 0) + 143 bytes
[11] libmwsimulink.dll:enum ECStatus __cdecl sluiEngBdMenuCmdInterface(struct slBlockDiagram_tag *,enum slEngineCmdOption)(0x03d349b0, 0, 0x1db43d60, 0x03d349b0) + 62 bytes
[12] libmwsimulink.dll:class slsvErrMsgQueue * __cdecl StartMenuSimIfNotStarted(struct slBlockDiagram_tag *)(0x03d349b0, 0x024b7c20, 0x1db43d60, 4) + 61 bytes
[13] libmwsimulink.dll:void __cdecl Menu_Simulation_Start(struct WinRec_tag *,void *)(0x1db43d60, 0, 18, 0x1d61d008) + 128 bytes
[14] libmwsimulink.dll:private: short __thiscall CMdlFrame::model_command(struct HWND__ *,unsigned int,unsigned int,long)(917976, 273, 18, 786888) + 91 bytes
[15] libmwsimulink.dll:public: virtual int __thiscall CMdlFrame::OnCommand(unsigned int,long)(18, 786888, 0x6efcffa0, 273) + 168 bytes
[16] MFC80.DLL:0x78202804(273, 18, 786888, 0x00d3ab44)
[17] MFC80.DLL:0x7820277e(273, 18, 786888, 0x6efcfe80)
[18] MFC80.DLL:0x78201514(0, 983634, 273, 18)
[19] MFC80.DLL:0x7820172a(983634, 273, 18, 786888)
[20] libmwsimulink.dll:long __stdcall AfxWndProcDllStatic(struct HWND__ *,unsigned int,unsigned int,long)(983634, 273, 18, 786888) + 51 bytes
[21] USER32.dll:0x77d48709(0x6fafef2d, 983634, 273, 18)
[22] USER32.dll:0x77d487eb(603728, 0x6fafef2d, 983634, 273)
[23] USER32.dll:0x77d4b743(3356272, 0x01304280, 18, 786888)
[24] USER32.dll:0x77d4b7ab(983634, 273, 18, 786888)
[25] COMCTL32.dll:0x0031b204(886752, 786888, 514, 18)
[26] COMCTL32.dll:0x002ead6c(786888, 514, 0, 0x000b0143 "^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^N#Ð..")
[27] USER32.dll:0x77d48709(3056418, 786888, 514, 0)
[28] USER32.dll:0x77d487eb(603728, 3056418, 786888, 514)
[29] USER32.dll:0x77d4c00e(0xffff0261, 786888, 514, 0)
[30] USER32.dll:0x77d4e366(0xffff0261, 786888, 514, 0)
[31] MFC80.DLL:0x78201f40(514, 0, 0x000b0143 "^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^N#Ð..", 0x1d61d3ac)
[32] MFC80.DLL:0x78202795(514, 0, 0x000b0143 "^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^N#Ð..", 514)
[33] MFC80.DLL:0x7820d4a3(514, 0, 0x000b0143 "^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^N#Ð..", 0x6efcfa44)
[34] MFC80.DLL:0x78201514(0, 786888, 514, 0)
[35] MFC80.DLL:0x7820172a(786888, 514, 0, 0x000b0143 "^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^N#Ð..")
[36] libmwsimulink.dll:long __stdcall AfxWndProcDllStatic(struct HWND__ *,unsigned int,unsigned int,long)(786888, 514, 0, 0x000b0143 "^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^:#Ð^+#Ð^N#Ð..") + 51 bytes
[37] USER32.dll:0x77d48709(0x6fafef2d, 786888, 514, 0)
[38] USER32.dll:0x77d487eb(603728, 0x6fafef2d, 786888, 514)
[39] USER32.dll:0x77d489a5(0x00d3b20c, 0, 0x00d3b104 "$±Ó", 0x77d6e819)
[40] USER32.dll:0x77d489e8(0x00d3b20c, 0x00d3b20c, 0x00d3b214, 0x1d61d008)
[41] USER32.dll:0x77d6e819(786888, 0x013333c0, 0x1d61d008, 0x1d61d3ac)
[42] USER32.dll:0x77d65ce2(786888, 0x00d3b20c, 0x1d61d3ac, 0x782053ba)
[43] MFC80.DLL:0x7822a4e5(0x00d3b20c, 0x00d3b20c, 1, 0x6fa9c118)
[44] MFC80.DLL:0x7820384b(0x00d3b20c, 0x7b50bfd0, 0x7b508e30, 0x00d3b250 "`²Ó")
[45] uiw.dll:int __cdecl UIW_PreTranslateMessages(struct tagMSG *)(0x00d3b20c, 0x7a84a300, 0, 0x7a7d3204) + 62 bytes
[46] uiw.dll:char * __cdecl getCommand(char *,int)(0x78564b40, 4096, 0x00d3b2b0 "(³Ó", 0x78552abf) + 461 bytes
[47] uiw.dll:public: virtual char * __thiscall uiw::UIW_IOProxy::getCmdWindowCommand(char *,int)const (0x78564b40, 4096, 0x78552a30, 0x7a7d3204) + 16 bytes
[48] bridge.dll:char * __cdecl winReadStdin(char * const,unsigned int,bool)(0x78564b40, 4096, 0, 0x00d3f42c) + 79 bytes
[49] bridge.dll:char * __cdecl ioReadLineOS(bool,struct _iobuf * const,char * const,char * const,int,bool * const,void (__cdecl*const)(void),char * (__cdecl*const)(char * const,unsigned int,bool))(0, 0x781c1b78, 0x16b0bb20, 4096) + 174 bytes
[50] bridge.dll:char * __cdecl ioReadLine(bool,struct _iobuf *,char *,char *,int,bool *)(0, 0x781c1b78, 0x16b0bb20, 0x16b0bb20) + 99 bytes
[51] bridge.dll:void __cdecl mnGetFullLine(char * *,unsigned int *,unsigned int *,bool)(0x00d3f430, 0x00d3f424, 0, 0x7acae190) + 139 bytes
[52] bridge.dll:_mnGetCommandLineBuffer(0, 0x01652d78, 0x01652dd8, 0x01652d78) + 124 bytes
[53] bridge.dll:__catch$_mnParser$0(0x01652d78, 0x167881d0, 0x79730101, 0x016f1b30) + 158 bytes
[54] mcr.dll:public: void __thiscall mcrInstance::mnParser(void)(0x004043ec, 336710, 0, 0x505c3a43) + 51 bytes
[55] MATLAB.exe:_WinMain@16(0x01652dd8, 0, 336710, 0x01652d78) + 405 bytes
[56] MATLAB.exe:___tmainCRTStartup(0, 0, 0x7ffd6000, 0) + 320 bytes
[57] kernel32.dll:0x7c816fe7(0x00401943, 0, 0x78746341, 32)

Please follow these steps to report this problem to The MathWorks so we
have the best chance of correcting it:

The next time MATLAB is launched under typical usage, a dialog box will
open to help you send the error log to The MathWorks. Alternatively, you
can send an e-mail to segv@mathworks.com with the following file attached:
C:\DOCUME~1\prattth\LOCALS~1\Temp\matlab_crash_dump.3148

If the problem is reproducible, please submit a Service Request via:

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.
 
I assume you did submit a service request via the link provided?

- Steve
 
Right. It seems that the free-running counter which is linked into another library was causing the error. Replaced with the digital clock from Simulink Extras, couple of rate transitions and bang, simulation is back on track. Savouring short-lived satisfaction. Head no doubt to soon be smahing against a brick wall again.
 
Never heard of anyone using fixed and variable solvers together. I see no advantage..

[peace]
Fe
 
To have both variable and fixed step solvers was a condition imposed by the implimentation of the system. The system mentioned is a simple test to figure out how to get the two different types of sovlers to work together. The actual system is a vibration platform which consists of a vibration spectrum generation unit and controllers which have to be run on a 250Hz industrial pc. The platform and its associated dynamics can be modelled by a continuous solver which it had to be as singularities were occuring due to insufficienctly small integration step size when it was ran at 250 Hz with the rest of the system.
 
Typically we do it where we have a clocked active controller talking to a variable step vehicle dynamics model. It becomes vastly more important when investigating timing errors in multiple active systems that are supposed to be working together, in HiL sims.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor