Borrar filtros
Borrar filtros

Simulink complexity propogation

51 visualizaciones (últimos 30 días)
Nuno
Nuno el 19 de Jun. de 2011
Respondida: Sami el 8 de Dic. de 2015
[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.

Respuestas (5)

Walter Roberson
Walter Roberson el 19 de Jun. de 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.

Arnaud Miege
Arnaud Miege el 20 de Jun. de 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 comentarios
Nuno
Nuno el 20 de Jun. de 2011
I already verify...
V never is complex...
What is this error?
Inferred complexity ('on') for data 'V' (#74) does not match back
propagated complexity ('off') from Simulink.
Walter Roberson
Walter Roberson el 20 de Jun. de 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.

Iniciar sesión para comentar.


Nuno
Nuno el 20 de Jun. de 2011
This is very strange!!! In my model i conect "SCOPE" in the V output and appear the error that i said. Now, i connected the V output "To Workspace" and the model run successfully... Why this appenned? Note that the values that appears in my workspace is not complex...
  4 comentarios
Kaustubha Govind
Kaustubha Govind el 21 de Jun. de 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.
Nuno
Nuno el 21 de Jun. de 2011
It's already uncheck...

Iniciar sesión para comentar.


Fangjun Jiang
Fangjun Jiang el 21 de Jun. de 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 comentarios
Nuno
Nuno el 21 de Jun. de 2011
No... In complexity appear: "Inherited" and the "Data must resolve to Simulink signal object" is already uncheck...
Kaustubha Govind
Kaustubha Govind el 21 de Jun. de 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?

Iniciar sesión para comentar.


Sami
Sami el 8 de Dic. de 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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by