DC Motor parameter in simscape - matlab

I'm here because I'm trying to implement a DC motor model in simscape. I'm having trouble matching the motor specifications, after filling the block with the parameters taken from the datasheet the output is not what I was expecting. For instance the speed with load is rated at 4310rpm, the output of my model after converting rad/s to rmp is only ~0.6rpm
I'm thinking about some wrong conversion, but can't find the issue by myself. Following the model implementation and motor parameters.
motor parameters
motor scheme
block configuration
system implementation
simulation result
Thanks to everyone

Related

How to see voltage wave in simulink/simscape?

I'm analyzing the bahaviour of a RLC circuit and I need to observe the voltage and current wave of the circuit but I cannot find a way to do this. I need something like an oscilloscope but the scope does not work with the elements i am working with. What can I do?
The link below is my circuit, I'm using Simscape/Foundation Library elements
This is my circuit
Simscape and Simulink has different domains. To be able to use each one in the other domain, you need to use Simulink-PS Converter or PS-Simulink converter.
In that example, you have voltage sensor in Simscape and Scope or display in Simulink. To be able to connect them use PS-Simulink Converter.

What is the best way to build a model of automated system with neural network in Simulink (Matlab)?

I'm tring to build a model contating neural network in Simulink.
My idea is to compose a model which includes a controlled object (electrical drive), PID controller and NN block for fine-tuning of the PID controller.
NN training is provided for to be the reinforcement learning. NN calculates the koefficients of the PID controller, then it receives the feedback from the output of the object and calcucales the koefficients for the next cycle to minimize the static error.
I've build the model without NN successfully.
Now I'm triyng to add the NN block, and it puts me getting in stuck.
1). What type of block should I use to create NN? Are there pre-set blocks in Simulink for NN (in which I have to only set number of layers and neurons and finctions of activation and loss?) Or the only way is to build NN from zero?
2). As I know variables in workspace are updated only after end of modeling. If I want to change parameters of a block in runtime I need to use S-function block and 'set_param' function in it. So is it the only way to transfer object output to NN block? Or may be there a possibility for automative transfer in runtime (like between PID controller and controlled object)?
Or may be someone has a better concept for making such a model in Simulink (or even in another Matlab toolbox)?
Any thoughts and links appiriciate. Thanks in advance.
P.S. Model of the drive I took from http://pnu.edu.ru/media/ejournal/articles-2017/TGU_8_217.pdf

Converter control simulation on simulink

I am struggling with a little project I decided to tackle. I am trying to replicate an example I found on a book using matlab simulink but I have no experience with simulink and control theory (I do understand the principles etc.).
The control block diagram is given but I do not understand some blocks and how to add my input (sine wave block on simulink)?
Here are the details:
Example I wish to reproduce
Schematic of the converter and desired control block diagram
If anyone could give me a little insight or direct me to some examples from which I could build on an understanding would be great!
Thank you in advance.
The portion entitled controller is the closed-loop feedback control for the system. K(s) would typically contain some type of PI control. In a more complicated control system, the structure of K(s) may be a little different, but will usually always contain an integration in order to ensure that the system eventually settles at the desired value.
The input Iref is your current command. In this case you would inject your sinusoid here which would produce a current waveform matching your desired output. If your desired output.
Output m is the modulating waveform produced by the controller. Everything inside the half-bridge converter section is a representation of the converter and everything that it is interfaced to (voltage sources).
The feedforward filter here is also a very important component. Since Vs contains an alternating waveform, the feed forward filter allows the system to respond to changes in Vs without relying on feedback compensation K(s). This helps to decouple current regulation from changes in voltage VD.
To start with the project, you can probably build the half bridge converter as shown. You can inject 400*cos(377t - pi/2) as VD.
For the feedback compensator K(s) you can feed the input into two gains (Ki and Kp) which you will select values for later. At the output of Ki insert an integrator (1/s) then sum the output of Kp and the integrator together.
For the feed-forward filter, you should probably just use a low pass filter with a gain of 1 at DC. The low pass filter prevents noise from entering the system. In this case you are running a simulation, so there will be no noise. However, the filter will eliminate any algebraic loops, which can cause warnings or errors in the simulation.
You can input your control signal at Iref.

Input/output port in Simulink

Is there a way to create an input/output port in Simulink (some workaround)? The port would be a bus and some signals are set from outside the block while some signals are set by the block. Here is an example:
Given the following bus:
Flow (scalar)
Composition (vector)
Enthalpy (scalar)
I would like Flow to be set from outside the block (there's a pump downstream which sets this value). Composition and Enthalpy are computed by the block.
My solution so far: Make Flow an input into the block and with direct feedthrough set it on the outport. I don't find this solution intuitive because from a graphical point of view the outflow becomes an input into the block (which is true from a math point of view - but I would like to make the Simulink diagram intuitive). I've seen in Modelica the possiblity to create input/output ports (RealPort) and the signal could be read or written by the block. I would need such a feature in Simulink.
It sounds like you need to use Simscape and SimHydraulics, which do excatly what Modelica does, but within Simulink. Each physical domain is represented with through and across variables, which are flow rate and pressure for the hydraulic domain. However, that's extra $$/££/€€ and a new modelling paradigm (you don't think in terms of inputs and outputs anymore)...
If you stay with Simulink blocks, there isn't much else you can do above what you've already done, although I assume you mean the flow is set on the input, not the output.

How to use Revolute - Rotational Interface to connect SimScape motor to SimMechanics Joint

I tried to rotate the revolute joint of a machine in SimMechanics. The actuator is from SimElectronics, so I use the Revolute - Rotational Interface block to connect the motor and the joint together. The whole block model is as follows (also available here)
But when I tried to run the simulation, I got the following error:
Not enough input derivatives were provided for one or more Simulink-PS Converter blocks associated with the highlighted Solver Configuration block, for the solver chosen. Implicit solvers (ode23t, ode15s, and ode14x) typically require fewer input derivatives than explicit solvers, and local solvers never require any. You can provide more input derivatives by selecting different options (including turning input filtering on or increasing the number of user-provided input derivatives) on the Input Handling tab of Simulink-PS Converter blocks linked below:
...'R0x2D1000iA80F_1joint_motor/Revolute - Rotational Interface/Simulink-PS Converter' (1 required, 0 provided)
I've tried to control the machine using SimMechanics Joint Actuator, which gives a correct result. The error occurred when I tried to control it with the motor from SimElectronics.
What's the problem with the model and how to solve it? Thanks
A few suggestions to try out:
Try removing the Joint Initial Condition block and see if it allows the model to run
In the DC motor block, try setting the rotor inertia parameter to 0 (as the inertia is provided by the SimMechanics part of the model). See the Warning on the Revolute-Rotational Interface documentation page
Make sure the initial condition specified in the Joint Initial Condition block is consistent with the initial condition specified in the DC Motor block
I would change how you connected your interface block to the DC Motor so that port B is connected to R, and F to C. This is because your Follower in the SimMechanics is welded to ground, whereas the Base if free to move.
Arnaud