How to solve the problem?

Sir/Madam, I m doing my project Modeling and Control of a Renewable Hybrid Energy System With Hydrogen Storage. Here i m using the wind turbine induction generator(phasor block). It gives one error " Complex signal mismatch. Input port 1 of 'wind_turbine/Wind Turbine Induction Generator (Phasor Type)/B1/Mode V' expects a signal of numeric type real. However, it is driven by a signal of numeric type complex "Pls give me the suggestion... Thank you

Answers (1)

Walter Roberson
Walter Roberson on 22 Jan 2014

0 votes

In Simulink, by default, if you have an operation (such as sqrt()) on a value such that Simulink cannot prove that the result will be real-valued, then the output signal type will be set to "complex" instead of "real". The signal type does not vary with the inputs. It could be that with the particular inputs and logic that Simulink's reasoning engine is inadequate to come up with the proof, but if Simulink thinks that it might turn out complex then Simulink marks it as complex. For any step that it turns out to be real-valued, the complex component would of course be 0.
You can find the line that is being set as complex (you might have to hunt back a few blocks) and tell Simulink to mark the line as real. If you do that and Simulink encounters a value for which the output needs to be complex, Simulink will throw an error at run-time. You can insert a conversion block that throws away the complex part, but you better understand what it means mathematically and physically before you do that.

13 Comments

I'm having the same issue. any idea how should i fix it? thanks.
You have an FFT in there. The output of FFT is typically complex valued -- the input data would have to be a mix of pure cosines to avoid complex values in theory, and due to round-off error even that is likely to produce some imaginary component.
So you should expect complex FFT output. Which you then send to a peak detector that is expecting only real input.
If you are trying to detect peak frequency then you should be tossing in a https://www.mathworks.com/help/simulink/slref/complextorealimag.html Complex To RealImag block
I have a problem at three phase VI measurements block. I select the output signal to be complex, but the following error is returend:
Input port 1 of `v' expects a signal of numeric type real. However, it is driven by a signal of numeric type complex
Output port 1 of 'do not delete this gain' is a signal of numeric type complex. However, it is driving a signal of numeric type real.
how i can fix this error please?
It looks like the input to 'do not delete this gain' is complex, and that the output of that block is being sent to 'v' but 'v' is marked as expecting real . You need to go back in the chain to figure out why the input to 'do not delete this gain' is complex and work out from there whether it should be complex or not.
kindly note that I need the output of the V-I measurements block to be a complex number. and I am wondering how i can fix it ?
Then you need to have a look at whatever the block 'v' is and figure out whether it would be meaningful for it to handle a complex signal, and if so then change the properties on that input port to permit complex.
the error is under the mask of V-I measurements block and I already selected the output port of V-I measurements block to be complex. how i can now change the properties inside the mask?. also, i have S function that collects the measurements, is S function causes this error ? what i should di in this case ? thanks
I think I would need your model.
I have a large system, but the attached is a simple model. kindly note that if there is no S-function in the model, there is no error. also, please note that each measured value has three signals. but what i need is the first signal from each measured value to be an input to S function. i dont know if i need to change the type of S function
It took me a while to figure this out, as I am not all that familiar with Simulink.
You appear to be constructing the output of the measurement block okay (I think): all of the signals are specifically marked as complex, and on the steps after that there is nothing that overrules complex.
However, you are invoking a Level 1 S function, and according to https://www.mathworks.com/help/simulink/sfg/s-function-features.html, Level 1 S functions are restricted to handling real signals, never complex.
You have three choices:
  1. You can rewrite your S function block (which is not long) as a Level 2 S Function; [the recommended approach]; or
  2. You can put complex-to-real blocks where you use the signal, the V1101 "m4" tag near where you call SAA. Then you change SAA to expect larger inputs, and complex() the elements together as appropriate.
  3. It looks to me as if potentially the entire S function could be replaced with a divide block.
hello sir,
i use S-Function in my simulink model. I need s function to wait for 2 sec, then collects the measurements. How i can do that ?
Please start a new question for that. When you do, be sure to indicate if you are using a level 1 S function or a level 2 S function.
Kh zaa
Kh zaa on 26 Aug 2018
Edited: Walter Roberson on 26 Aug 2018
when i start a new question, no one answer me ! here is the question: https://www.mathworks.com/matlabcentral/answers/416288-delay-time-s-function

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Products

Tags

No tags entered yet.

Asked:

on 22 Jan 2014

Edited:

on 26 Aug 2018

Community Treasure Hunt

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

Start Hunting!