Tuesday, 5 March 2013

MATLAB ASPECT

Well we're back again.....hopefully you guys have enjoyed the blog so far. The last post was about the hardware aspect of the project; this is about the software aspect. As mentioned before in a recent post, the software we have used so far is simulink; a software in matlab. We derived two main circuits. One for modelling the motor we used in our circuit (which was a MCLENNAN - 12711210 GEARED MOTOR by the way). This one involved direct connection of the motor to a voltage source and finding out currents and speeds. The second aspect was modelling our PWM controlled circuit on simulink and then finding currents at various voltages and all. Next we will discuss these two aspects:

SIMPLE MOTOR MODEL:
Designing this was a bit challenging as the manufacturers of the DC motor we used didn't put enough info on the datasheet so we had to do loads of calculating (thank you mclennan :| ). Anyways, we got our parameters using the formulas from an old post and so we used all these to find the back emf constant, resistance, the inductance, the rated load etc of our motor. After these, we inserted these values into matlab..tweaked some values (we didn't forge any though) and then simulated the circuit. Amazingly, the values of our simulation kind of corresponded with our physical value (yay!). We won't post our parameters and values though, for various reasons; however, here is a diagram.


The current sensor detects the current and the PS-simulink converter converts it to milli-amperes which is read on the scope (the window-looking thingy labelled current). The ideal rotational motion sensor acts like the current sensor but detects angular velocity, angle in rads etc. The solver configuration acts like the driver input of the circuit.

MOTOR CONTROLL USING PWM:
Ok, the truth is; simulating a PWM controller and h-bridge on simulink is really difficult because there are too many parameters involved (which we don't have) so we replaced our PWM controller and h-bridge with one resistor (in reality this would be a variable resistor). Use of a resistor is not advisable in real life because it uses a lot of power and so reduces the efficiency of the circuit drastically. The circuit diagram below shows the design and our resistor is set such that the motor goes at 50% its max speed.


We had one huge problem though, our current wasn't corresponding with the physical values we obtained and so like every normal person would do, we panicked....well no not really; we just did the next normal thing which was; find a relationship between our theoretical and physical values (cause we're cool) and derive a formula that relates both values (Nobel prize anyone?).....the formula was:

Im = (Vs/Vref) x Ia

where Vs is source voltage
Ia = arbitrary current obtained from simulated circuit
Vref = Reference voltage (in this case, 12V)
Im is the current in the motor

The triangle things are called gain and they multiply signals by a set constant value.
 The voltage sensor does the same as the current sensor and the product box multiplies two parameter.
The part of the circuit implementing the above formula is:


After all this, our values corresponded so we are practically finished with our project.
Thank you for reading and please wish us luck in our bench inspection on Friday :).
Sorry we couldn't post our results as we might not be allowed to.

No comments:

Post a Comment