How to solve the problem?
Show older comments
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
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
Walter Roberson
on 8 May 2018
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
Kh zaa
on 30 Jun 2018
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?
Walter Roberson
on 30 Jun 2018
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.
Kh zaa
on 30 Jun 2018
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 ?
Walter Roberson
on 30 Jun 2018
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.
Kh zaa
on 30 Jun 2018
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
Walter Roberson
on 30 Jun 2018
I think I would need your model.
Kh zaa
on 1 Jul 2018
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
Walter Roberson
on 1 Jul 2018
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:
- You can rewrite your S function block (which is not long) as a Level 2 S Function; [the recommended approach]; or
- 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.
- It looks to me as if potentially the entire S function could be replaced with a divide block.
Kh zaa
on 26 Aug 2018
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 ?
Walter Roberson
on 26 Aug 2018
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
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
Categories
Find more on Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!