MTPA Reference block settings (Simulink)? - matlab

I am failrly recent to MATLAB and SIMULINK. I am trying to use to Motor Control blockset in Simulink to implement an FOC algorithm. I am using the MTPA Reference block for Simulink to calculate the Id and Iq currents for me but there are parameters in the block I don't understand. What is the difference between max current and base current ? How do you calculate stator d-axis inductance ? Is this given in the motor datasheet or do we have to calculate it ? And if so, how do I do it ? What is the per-unit (PU) in I/P singal units ? Why would you choose this rather than SI units ? Also is the permanent magnet flux linkage meant to be in the motor datasheet ? I am modelling the iPower Gimbal motor GBM2804H-100T. Please your help would be really appreciated.
MTPA Reference Documentation link: https://www.mathworks.com/help/mcb/ref/mtpacontrolreference.html

I stumbled upon your question today.
Request you to try posting on MATLAB Central for faster response.
Anyway, apologies for delayed response. Pl find your answers below.
What is the difference between max current and base current ?
Max current is motor's rated current. This is also explained in the parameters tab here.
Base current is reference value used while working with PU System. This is usually higher than motor's rated current. Usually, we consider peak ac current as measured by ADCs, to be base value. But you're free to change it to any reference value. It may be same as Max current, may also be different.
How do you calculate stator d-axis inductance ?
For starters, Ld = Ls (total stator inductance) for Surface PMSMs. It's different for IPMSMs.
Is this given in the motor datasheet or do we have to calculate it ? And if so, how do I do it ?
It's usually specified by manufacturers. However, the real motor may have variation w.r.to. design specifications. Hence, you need to run some tests and measure it.
We have a tool to measure the motor parameters. See this link for more details.
What is the per-unit (PU) in I/P signal units ?
You can choose to work with SI units or PU system in the algorithm. We recommend working with PU System for efficient code generation.
For more details, refer to this page.
Try simulation/code-generation of this example. Type the variable name 'PU_System' at MATLAB Command Prompt for details related to base values.
Why would you choose this rather than SI units ?
Computational efficiency for embedded systems.
Scalability.
This is also answered on this page.
Also is the permanent magnet flux linkage meant to be in the motor datasheet ?
No. This is also measured via the parameter estimation tool.
You can also compute the PM flux linkage from backEMF constant or torque constant using the equations mentioned on this page.
I hope this was useful.
Stay safe!
--
Darshan Pandit | MathWorks
For more resources see: MATLAB Central

Related

CrossSim crossbar simulation software

Is anyone using CrossSim - crossbar simulator from Sandia national laboratories? In the manual, it is not explained about the input files reset.csv/set.csv for lookup table generation. I need to know about the rmp values in that file. What is rmp and how was it calculated?
Or are there any other crossbar array simulation software that can be used for vector multiplication, etc mainly for memristor devices?
I am in graduate school student.
I'm studying Resistive Memory Devices for Neuromorphic Computing.
I am also using this CrossSim simulator(ver. 0.2). Maybe I can help you.
Generally, a Memristor device has two terminals whose resistance value is modulated by an arbitrary voltage pulse. If this memristor undergoes higher than the threshold voltage(Vth), its state changes. otherwise, it holds its state.
So, we program it with a higher than Vth and read its state by applying a voltage lower than Vth.
In the manual, there is no specific explanation of what's in the reset.csv/set.csv file. it contains a current value that is acquired experimentally. not a calculated value. Actually, after the lookup table is generated its values becomes conductance value. That's why reading voltage is required in the create_lookup_table.py example. (conductance) = (current) / (voltage) you know.
The lookup table is for experimental data to verify when memristors come to hardware. if you want to simulation just algorithmically you don't need a lookup table. you can do this by adding the following codes.
params.numeric_params.update_model = "ANALYTIC"
I hope this is helpful to you. :)

Non-liner solver couldn't converge during the initialization in Dymola

I met an error during initialization when using ThermoSysPro library.
It seems like the Turbine5.Pe is larger than Turbine2.Pe, so the result is negative. but I checked my parameters, there shouldn't be such a problem.
Is this because the nonlinear solver couldn't solve the equation in the following picture?
There is not enough information and I would recommend to set Details and/or Nonlinear iterations in Simulation setup>Debug>Nonlinear solver diagnostics to get more information.
The full expression causing the problem is sqrt((Turbine2.Pe^2-Turbine5.Pe^2)/(Turbine2.Cst*Turbine2.proe.T))
Since the two Pe-values have fixed=true it seems unlikely that they are wrong, but it is impossible to see without the complete model.
However, it is also possible that either Cst or proe.T is negative, or computed to a negative value based on other values.
Without a complete model that is impossible to tell.
According to the comparison between ThermoSysPro(Open source library from EDF https://github.com/alex19941215/ThermoSysPro ) and ThermalPower(Commercial library from Modelon https://www.modelon.com/library/thermal-power-library ), there should be some inspiration for people faced with the same situation.
Here is the code form ThermoSysPro library:
Connectors.FluidInlet Ce
Connectors.FluidOutlet Cs
Here is a type code from Thermal Power library:
Interfaces.FlowPort feed(
h_outflow(start=hstartin))
Interfaces.FlowPort drain(
p(start=pstart),
h_outflow(start=hstartout))
From the code, we can see that in the Thermal Power library each connector's attribute is assigned values according to the parameters, but in the ThermoSysPro library, the connector is using default values, probably zero. So that's why the Thermal Power library has better performance in the term of initialization convergence

How to Calculate 3 Phase Voltage & Current from Power (VA)?

I am trying to develop a MATLAB Simulink model that will help me study the load of my department.
The model works, however one of the blocks goes right over my head when it comes to understanding, as I used the internet to help me with it.
Here is the main block:
The Scope Displays the Voltage, Current & Power
The "dept01" block inputs the data from .csv file and contains only [Time,Power].
Here is what goes inside of the "Electrical Department" Block:
I have no problem understanding this part, I'm simply splitting the total power into three portions.
NOTE: I am also assuming that ultimately Q=0 so Total Power = Real Power
This is the Second Step of the "Electrical Department" block which I cannot understand in any way. Maybe my concepts are weak but this part makes no sense to me.
Can someone please explain it to me that how is the block calculating Voltage & Current using just the Power??? Also how does it imitate the function of a Load so that the Energy Meter sees it as a load?
Thanks!
Load can be emulated by connecting a current source in series with the voltage source as it is seen the diagram. In your case, the controlled current source has been used. It also looks like the dependent current source is derived from the voltage. I request you to give the details of relational operator used and the sigma block. Without which you can not derive the relation ship. If the current is dependent on the voltage like the case, voltage and current can be calculated simply from the power.

How to determine value from previous time step during simulation in Modelica?

How can I determine value from previous time step during simulation in Modelica?
I have equation Q=m*c*(Ts2-Ts1-Tr) I need to extract value of Ts2 and Ts1 from it.
Ts2 - is the value from time step 2
Ts1 - is value from previous time step
Ts is input signal and it has variations during the time. Each step
it has different value. In my case time step is 1s. Other values are
fixed.
Can I set in equation variable time?
For example:
Ts2 (start=time);
Ts (start=time-1);
Or it should be input inside this model?
regards Tymofii
This was addressed in a similar question already.
The key point is that equations describing physical behavior cannot refer to time steps. This is because there is no "timestep" in nature or the laws of physics and so the response of a system cannot depend on it.
You don't really explain why you need to do what you are doing. Are you trying to extract simulation results? Are you trying to correlate to experimental data? Or, are you just trying to solve a differential equation?
It isn't clear what you want to do. Please elaborate and we can probably give you some guidance on how to proceed in Modelica.
Update
Using values from a "previous interval" is fine. For example, if you wanted to sample your solution at regular intervals, express a "z transform" or implement a Kalman Filter in Modelica, you could do each of those very easily (for example, see the 'sample' keyword here). In other words, it is possible to store as many previous values as you would like.
What you cannot do is use the timestep of the continuous solver in expressing how your system behaves. The intervals you reference must be independent from any intervals that the solver is using.

How to use the value of the variable in the previous interval as an input to the equation....?

Is it possible to use the previous value of the time varying variable
for eg:
Suppose I have pipe whose inlet temperature is 298K with a specified uniform mass flow(m_flow), now suppose i am heating the pipe using a heater of 100 watts.
The outlet temperature will be attain a higher temperature of suppose 302K, now if i have to use this outlet temperature as my inlet temperature (in the sense i am recircuilating the water), how would i be doing it?
is it possible to update the value of the inlet temperature based on the outlet temperature at the previous timestep? so that for the next iteration the inlet temperature will be the same as the oulet temperature in the previous iteration (in other words the fluid would be recirculating).
Thanks
You cannot access the value in the previous time step. The closest you can get in Modelica is using delay(exp,T) to get the value T units of time ago.
The timestep does not enter into it at all. A model that uses information about timestep is just wrong. Nature doesn't know or care about integration time steps, the model should reflect that.
It seems to me what you want to capture is transport delay. Transport delay is the delay introduced by the time it takes for molecules, electrons, etc. through the system. So presumably what you wish to model is the time it takes the inlet fluid to reach the exit. Again, this has nothing to do with the integration timestep but rather the velocity of the fluid and the distance it must travel. Once you know how long that takes (by either a priori knowledge of the system of by looking at the simulation results themselves), you can follow Marco's suggestion of using the delay operator.
In order to setup a proper model for the system you described I suggest you to look at the example :
Modelica.Thermal.FluidHeatFlow.Examples.IndirectCooling
of the modelica standard library ver. 3.2. Instead of one pipe you can put an ambient or control volume component to better suit you needs. Moreover using continous and differentiable equations (the delay function is not) you will benefit from some of the advantages of the Modelica code, e.g. you will be able to reuse your models in a much wider range of cases, solve inverse problems, solve initial value problems, ...
I hope this helps,
Marco