Stateflow fails to compile after calling Simulink from a Matlab script

4 次查看(过去 30 天)
I am trying to run a fairly complex hybrid vehicle model in Simulink, using Matlab2012b. The model has always worked fine until now. Today I created a Matlab script to call the model, run its initialization file, run the model, and gather some data for post-processing. This script ran successfully, once. On the second execution, Simulink failed to run, with the following error messages: Coder Error - unknown - Stateflow - Failed to create file: "model path".h Model error - unknown - Simulink - error using sf, error using construct_error(line 108), failed to create file: "...path and name...".h
What's more, when I try to run the model just in Simulink, it gives the same error. Normal, Accelerator, Rapid Accelerator give the same error. I tried the usual troubleshooting steps (restarts, mex -setup, clearing out slprj and mex32 files), and I re-installed the c++ compiler. Same error. I have tried running Matlab as administrator, and different versions of Matlab. Same error. It's like this model is set to no longer compile correctly.
I can run Matlab scripts and other Simulink models just fine. I have searched the forums and tried the other suggested solutions, but it hasn't fixed the problem. Any ideas out there??

采纳的回答

Zack Peters
Zack Peters 2013-10-25
Hi Stefan,
This is just a guess at this point but it could be possible that your path names are too long. The Windows maximum path length is 260 Characters. Is the model in a directory with a long filename or is the model name itself quite long?
If so then try renaming the model to a shorter name and move it into a directory with a shorter path name.
~Zack
  1 个评论
Stefan
Stefan 2013-11-6
Wow! I never saw any error or warning messages to this effect, but I renamed everything to be as short as possible, and suddenly everything works again. Well done sir!
I think this came about, in part, as the result of version control. We kept appending numbers and codes to the names over the course of development, and I guess we hit the limit. I didn't know about the Windows character limit , good to know.
Thanks!

请先登录,再进行评论。

更多回答(1 个)

samir samir
samir samir 2016-7-20
hello stefan,
I myself am currently designing a model of hybrid vehicle on Simulink matlab 2009
can you help me?
I arrived at the coupling phase.
I do not know how to continue?
I have designed vector control of the electric motor.
I modeled the battery, the chopper, the rectifier, the engine, the generatrice.
the rest I do not know how to combine these blocks via a DC bus and especially I have used a state flow control, (I'm beginner of stateflow) to simulate the states of this vehicle: stop startup, acceleration, braking (charging the battery ... etc).
at least is what you can advise me documentation for methodology forward to continue my project?
cordially. samir.

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by