Simulink complexity propogation
66 views (last 30 days)
Show older comments
[EDIT: 20110621 11:40 - clarify - WDR]
What error is this?
Code Directory :
"C:\Users\Nuno\Desktop\Modelo\slprj\_sfprj\modelo_novo\_self\sfun\src"
Machine (#96): "modelo_novo" Target : "sfun"
Chart "Tensão" (#149):
.
Code generation failed Inferred complexity ('on') for data 'V' (#154) does not match back
propagated complexity ('off') from Simulink.
0 Comments
Answers (5)
Walter Roberson
on 19 Jun 2011
Note: An argument can also inherit its complexity (whether its value is a real or complex number) from the signal that is connected to it. To inherit complexity, set the Complexity field on the Data properties dialog to Inherited.
I speculate that the blocks "above" that point lead Simulink to think that V should probably be a complex number, but that the blocks "below" that point that use V have something set in them that indicates that V is not a complex number.
If V is not a complex number, then you should follow the creation of V "upwards" until you find the point where real numbers are being operated upon to produce a (potentially) complex number and stuff in a block that adjusts for the complex case.
If V is a potentially complex number, then you should follow V "downwards" until you find a point that relies upon it being real-only and adjust that code.
I suspect that if you take the square root or other non-integral power of a real number somewhere, and Simulink cannot prove that the result will be real, that Simulink will infer that it might be complex. For example, if you had sqrt(x-2) and Simulink did not have reason to know that x could not possibly be less than 2, it should infer that the result might be complex.
0 Comments
Arnaud Miege
on 20 Jun 2011
As Walter pointed out, it means that in your Stateflow machine modelo_novo, Simulink has inferred that V should be a complex variable, but the complexity property propagated from the rest of the model is that V is not complex.
You know the model, therefore you should know whether V is complex or not. If it is, specify it as such in the Model Explorer. If it isn't, figure out why it's propagated as complex from the rest of model and fix it. There is probably a block somewhere that outputs a complex signal, which determines that V should be complex. You'll need to take the abs or the real/imaginary part of that signal, depending on what you want to to.
HTH,
Arnaud
4 Comments
Walter Roberson
on 20 Jun 2011
*You* know that V is never complex, but Simulink thinks there is a possibility that it is complex.
Like Arnaud suggested, use the Model Explorer to specifically mark V as real, in the Data Properties dialog.
Nuno
on 20 Jun 2011
4 Comments
Kaustubha Govind
on 21 Jun 2011
I don't know if you saw my comment on your duplicate post:
Is the "Data must resolve to Simulink signal object" parameter box selected for output 'V' in the Embedded MATLAB block's Ports and Data Manager (http://www.mathworks.com/help/toolbox/simulink/ug/f6-94058.html#bqgwvsq-1)? If yes, uncheck it and see if you can run your model.
Fangjun Jiang
on 21 Jun 2011
Let me guess, if you type V.Complexity in command window, it probably says 'auto'. In your Stateflow chart, if you click menu Tools>Explorer, then double click the variable V, you probably see Complexity as Off. That might be what the error message is about. Uncheck "Data must resolve to Simulink signal object". Kaustubha already asked you to do that. I suspect you did on the outut signal line.
2 Comments
Kaustubha Govind
on 21 Jun 2011
@Nuno: Is "Data must resolve to Simulink signal object" unchecked on both: the Embedded MATLAB Block's Port and Data Manager AND the output signal (right click on signal -> Signal Properties) as Fangjun suggested?
Sami
on 8 Dec 2015
All,
I came to the same problem where I had multiplication with complex number, and it through the same error. After I went through model explorer and made sure I forced all my data types to correct data, I tracked down where I came cross the complicity issue and there I cast it to the correct data type.
V = Something*Something ----> Data type change.
V = real(Something*Something) ----> cast into the data type I needed. took teh real part of the complex value. it worked for me for now, but didn't verify the values yet, at least I can start there for now. Hope this helps if you or someone still running into the same issue.
Sami Oweis
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!