Simulink complexity propogation
이전 댓글 표시
[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.
답변 (5개)
Walter Roberson
2011년 6월 19일
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.
Arnaud Miege
2011년 6월 20일
0 개 추천
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
Nuno
2011년 6월 20일
Arnaud Miege
2011년 6월 20일
As I suggested, figure out what in the model causes V to be complex.
Nuno
2011년 6월 20일
Walter Roberson
2011년 6월 20일
*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
2011년 6월 20일
0 개 추천
댓글 수: 4
Nuno
2011년 6월 21일
Walter Roberson
2011년 6월 21일
We already did: we told you to specifically mark V as being real in the Model Explorer Data Properties dialog.
Kaustubha Govind
2011년 6월 21일
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.
Nuno
2011년 6월 21일
Fangjun Jiang
2011년 6월 21일
0 개 추천
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
Nuno
2011년 6월 21일
Kaustubha Govind
2011년 6월 21일
@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
2015년 12월 8일
0 개 추천
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
카테고리
도움말 센터 및 File Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!