MOC_LabVIEW_Assessment
MOC_LabVIEW_Assessment
Student Name:
Student ID:
Tutor:
Comments:
MOC LabVIEW
INSTRUCTIONS:
exam to become familiarized with the context described in the Engineering analysis section.
6) Complete the Exam questions sequentially, starting from Question 1 to Question 5.
This implies that, if the input voltage, 𝑣𝑖(𝑡), is a sinusoidal signal of angular frequency 𝜔
(rad/s), amplitude 𝐴𝑖 (volts) and phase 𝜙𝑖 rad,
then, the output voltage, 𝑣𝑜(𝑡), is also a sinusoidal signal of the form,
Magnitude response: For a specified value of the angular frequency 𝜔 (rad/s), the term
|𝐺(𝑗𝜔)| is called the magnitude of the frequency response of 𝐺(𝑠) at that angular
Page 3|7 LabVIEW Programming MOC – S1 2023
frequency. Since 𝐺(𝑗𝜔) is a complex number, then |𝐺(𝑗𝜔)| is a real number and can be
calculated using the abs () command in Matlab.
Phase response: For a specified value of the angular frequency 𝜔 (rad/s), the term ∠𝐺(𝑗𝜔)
is called the phase of the frequency response of 𝐺(𝑠) at that angular frequency. Since 𝐺(𝑗𝜔)
is a complex number, then ∠𝐺(𝑗𝜔) is a real number (units of radians) and can be
calculated using the angle () command in Matlab.
Exam Questions:
Q1) Block diagram: Add a While structure with an appropriate Stop control to simulate
the VI repeatedly and check the output of the XY Graph indicator as you vary the
parameters of the transfer function (5 Marks).
c. Write the following Matlab if statement in the Mathscript node to calculate the
theoretical value of the peak magnitude (variable name: Gjom_mag_peak)
(Marks: 2)
a. Front Panel: Create three numerical controls, one for the amplitude 𝐴𝑖, one for
the angular frequency 𝜔 and one for the phase 𝜙𝑖. (Marks: 1.5)
b. Label the numerical controls with the following names (Marks: 0.5):
i. “Amplitude (Ai)”
ii. “Frequency (rad/s)”
iii. “Phase (degrees)”
c. Specify the range for the amplitude to be between 1 to 10, in increments of 1
(Marks: 0.5).
d. Specify the range for the angular frequency to be between 0.5 – 10 (rad/s) in
increments of 0.5 (Marks: 0.5).
e. Label the Cluster with the following name: “Parameters of the input voltage
signal” (Marks: 0.5)
f. f) Block diagram: Use the Unbundle by Name VI to distinguish the 3 numerical
controls of the Cluster (Marks: 0.5 + 0.5 + 0.5).
Q3) Block diagram: Use the Mathscript block to calculate the output voltage signal 𝑣𝑜(𝑡)
(5 Marks).
a. Define the time vector (variable name: time) using the Matlab command shown
below: (Marks: 0.25)
i. time = linspace(0,10,500)
b. Add 3 inputs to the Mathscript node. One for the amplitude (variable name:
Ai), one for the angular frequency (variable name: w) and one for the phase
(variable name: phi). Define the input voltage using the following Matlab
command: (Marks: 1.75)
i. vi = Ai*cos(w*time + phi*pi/180)
c. Calculate the output voltage using the Matlab commands shown below:
(Marks: 1)
i. Frequency response at w:
s = j*w
Gjom_w = (wn^2)./(s.^2+2*zeta*wn*s+wn^2) Frequency response at w:
Page 5|7 LabVIEW Programming MOC – S1 2023
ii. Output voltage:
vo = Ai*abs(Gjom_w)*cos(w*time + phi*pi/180 + angle(Gjom_w))
d. Add 2 outputs to the Mathscript node. One for the input voltage (variable
name: vi) and one for the output voltage (variable name: vo) (Marks: 2).
Q4) Use an appropriate graph indicator to visualize the input and output voltage
signals (5 Marks).
a. Block diagram: Use the Merge Signals VI to combine the array variables
corresponding to the input voltage signal (variable name: vi) and the output
voltage signal (variable name: vo) (Marks: 2).
b. Front Panel: Use a Waveform Graph indicator and connect it to the Merge
Signals VI for the voltage signals. (Marks: 2)
Q5) Use a Case Structure/Boolean Logic to specify when the input voltage signal is being
amplified or when it is being attenuated (12 Marks).
a. Block diagram: Place 2 Array Max & Min VIs to calculate the maximum values for
the input voltage (max(𝑣𝑖)) and the output voltage signals (max(𝑣𝑜)). (Marks: 2)
b. Block diagram: Place a Greater or Equal block to check the condition shown below.
The output of this block will be the selector of the Case Structure (Marks: 1).
i. a. max(𝑣𝑖)≥max(𝑣𝑜)
c. Block diagram: Use Boolean logic to turn on or off two LEDs labeled
“Attenuation” and “Amplification” based on the following:
i. Turn on the “Attenuation” LED and turn off the “Amplification” LED when
max(𝑣𝑖)≥max(𝑣𝑜) AND max(𝑣𝑖)≠0 (Marks: 1.5)
ii. Turn on the “Amplification” LED and turn off the “Attenuation” LED when
max(𝑣𝑖)<max(𝑣𝑜) AND max(𝑣𝑖)≠0 (Marks: 1.5)
Page 6|7 LabVIEW Programming MOC – S1 2023
d. Block diagram: Use a Case structure to implement the following conditional
statement.
i. If max(𝑣𝑖)≥max(𝑣𝑜) is TRUE then, send the word “Attenuation” to a
string indicator with label “Signal Conditioning” (Marks: 1.5)
ii. If max(𝑣𝑖)<max(𝑣𝑜) is TRUE then, send the word “Amplification” to a
string indicator with label “Signal Conditioning” (Marks: 1.5)
e. Block diagram: Use a Sub VI to calculate the signal conditioning factor as
max(𝑣𝑜) / max(𝑣𝑖) and send it to a numerical indicator with label “Signal Conditioning
Factor”. (Marks: 3)