Monday, September 19, 2011

DC Motor Speed Modeling in Labview


DC Motor Modelling

A common actuator in control systems is the DC motor. It directly provides rotary motion and, coupled with wheels or drums and cables, can provide transitional motion. The electric circuit of the armature and the free body diagram of the rotor are shown in the following figure:

For this example, we will assume the following values for the physical parameters.

  • moment of inertia of the rotor (J) = 0.01 kg.m^2/s^2
  • damping ratio of the mechanical system (b) = 0.1 Nms
  • electromotive force constant (K=Ke=Kt) = 0.01 Nm/Amp
  • electric resistance (R) = 1 ohm 
  • electric inductance (L) = 0.5 H
  •  input (V): Source Voltage


The motor torque, T, is related to the armature current, i, by a constant factor Kt. The back emf, e, is related to the rotational velocity by the following equations:


In SI units (which we will use), Kt (armature constant) is equal to Ke (motor constant).



Next, we will start to modelling with Newton's law and Kirchoff's law. These laws applied to the motor system give the following equations:






Modelling the DC motor in Labview
The above derived equations we can model easily in labview.
The Integrator can found in Control Design& Simulation Tool kit as shown in figure.



 

The multiply, Division blocks can found in mathematics tool kit as shown




Signal summing block as shown in below




The Final Model is as shown in figure:



Open loop response:
To find the open loop response of the model, we have to connect the diagram as shown in fig:
we have to use Control & Simulation loop




Source is Step signal to find out open loop response 

To  check the out we need a waveform chart.

The overall open loop system as shown in figure:




The response of the system in open loop condition as shown in Fig: 



Tuning of PID controller Parameters: 
In Labview GUI interface is beautiful and very easy. We can tune the parameters on line in continuous run mode .



The PID parameters found as follows:

Kp = 81.632
Ki = 79.58
Kd = 4.08


Happy wiring

Sunday, September 18, 2011

Loops


For Loops

A For Loop, shown as follows, executes a subdiagram a set number of times.
The value in the count terminal (an input terminal), shown as follows, indicates how many times to repeat the subdiagram.
Set the count explicitly by wiring a value from outside the loop to the left or top side of the count terminal, or set the count implicitly with auto-indexing.
The iteration terminal (an output terminal), shown as follows, contains the number of completed iterations.
The iteration count always starts at zero. During the first iteration, the iteration terminal returns 0.
Both the count and iteration terminals are 32-bit signed integers. If you wire a floating-point number to the count terminal, LabVIEW rounds it and coerces it to within range. If you wire 0 or a negative number to the count terminal, the loop does not execute and the outputs contain the default data for that data type.
Add shift registers to the For Loop to pass data from the current iteration to the next iteration.

While Loops

Similar to a Do Loop or a Repeat-Until Loop in text-based programming languages, a While Loop, shown as follows, executes a subdiagram until a condition occurs.
The While Loop executes the subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value. The default behavior and appearance of the conditional terminal is Stop if True, shown as follows.
When a conditional terminal is Stop if True, the While Loop executes its subdiagram until the conditional terminal receives a TRUE value. You can change the behavior and appearance of the conditional terminal by right-clicking the terminal or the border of the While Loop and selecting Continue if True, shown as follows, from the shortcut menu.
When a conditional terminal is Continue if True, the While Loop executes its subdiagram until the conditional terminal receives a FALSE value. You also can use the Operating tool to click the conditional terminal to change the condition.
If you place the terminal of the Boolean control outside the While Loop, as shown in the following figure, and the control is set to FALSE if the conditional terminal is Stop if True when the loop starts, you cause an infinite loop. You also cause an infinite loop if the control outside the loop is set to TRUE and the conditional terminal is Continue if True.
Changing the value of the control does not stop the infinite loop because the value is only read once, before the loop starts. To stop an infinite loop, you must abort the VI by clicking the Abort Execution button on the toolbar.
You also can perform basic error handling using the conditional terminal of a While Loop. When you wire an error cluster to the conditional terminal, only the TRUE or FALSE value of the status parameter of the error cluster passes to the terminal. Also, the Stop if True and Continue if True shortcut menu items change to Stop if Error and Continue while Error.
The iteration terminal (an output terminal), shown as follows, contains the number of completed iterations.
The iteration count always starts at zero. During the first iteration, the iteration terminal returns 0.