Simulink Single-phase Synchronous Reluctance Motor

4 views (last 30 days)
Hello everyone.
I am trying to make a Simulink Diagram found in the book "Mechatronics and Control of Electromechanical Systems" by Sergey Edward Lyshevski.
The diagram is in the page 206 and when I try to run it come the next error:
"An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Domain error. To compute complex results from real x, use 'sqrt(complex(x))'. Error in sqrt.m (line 13) coder.internal.error('Coder:toolbox:ElFunDomainError',mfilename); Error in 'single_phase_reluctance_motor/MATLAB Function2' (line 3)
"
I also noticed that in the 4th Fcn Block (P^2*Ldm....) there is something like a negative sign in the upper right part of the function.
It was possible to make that with the Fcn Blocks? I wonder if its because of that that I got the error

Answers (1)

Kothuri
Kothuri on 28 Mar 2024
I understand that you want to know why your simulation got terminated with the domain error due to ‘sqrt’ function.
The MATLAB ‘sqrt’ function can operate on non-negative real numbers. But it throws a domain error in the physical modelling of a system when it encounters a non-negative input as its corresponding output will be a complex number.
The above error message indicates that the value of the variable ‘x’ is considered as a real number by default. But the actual value of ‘x’ being passed in the MATLAB Function2 block is a negative number whose square root will result in a complex number.
To resolve this issue, you need to modify the MATLAB ‘Function2’ block in the model such that the variable ‘x’ is never negative (setting ‘x’ to zero or a positive value if it is negative) or modify the code sqrt(x) to sqrt(complex(x) ). In this way it treats ‘x’ as complex and allows ‘sqrt’ to return a complex result.
You can refer the below link which indicates the usage of ‘sqrt’ function.
Hope this clarifies the error.

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!