Sunday, February 22, 2015

HP Prime and TI-84+: RLC Series Circuit and Impedance

RLC Series

 
RCL Series Circuit

The program RLCSERIES (RLCSERIE for TI-84+) calculates:

·     *    The total impedance of the circuit, and its magnitude in ohms
·     *    Phase angle in a circuit in degrees.
·     *    Current of the series in amps.

Input:
Battery/Source:  enter voltage and frequency
Add as many resistors (R) (in Ohms Ω), capacitors (C) (in farad), and inductors (L) (in henrys) as needed. 

Notes:
HP Prime program only:  On the input screen, enter the real (a) and imaginary (if needed) (bi) parts separately.  Complex numbers can be directly entered on the TI-84+ program.

Example:
Series circuit powered by a 14 V, 5000 Hz battery.  The circuit has: a resistor of 100 Ω, a capacitor of 3.2*10^-6 farads, and an inductor of 0.082 henrys.

Results:
Total Resistance:
100 + 2566.158792*i
Magnitude:
2568.10649035
Phase Angle:
87.7683842611°
Current:
5.45148733225 * 10^-3

HP Prime: RLCSERIES

// Impedance of a Series
// EWS 2015-02-22
// Turn allow complex from real input on
// Declare subroutines
chsubr();
casubr();

// Main Routine
EXPORT RLCSERIES()
BEGIN
// initial steps
Z0:=0;
// radian mode
HAngle:=0;
// counter
I:=0;
// battery information
INPUT({V,F},"Battery Information",
{"V = ","F = "},
{"Volts","Frequency (Hz)"});
chsubr();
END;


// Choose Subroutine
chsubr()
BEGIN
LOCAL ch;
CHOOSE(ch,"# of Components: "+STRING(I),
{"Add Resistor (R)",
"Add Capacitor (C)",
"Add Inductor (L)",
"Calculate"});
// Execute calculation subroutine
casubr(ch);
END;

// Calculation Subroutine
casubr(x)
BEGIN
IF x==1 THEN
INPUT(R,"Add Resistor","R =",
// Impedance of a Series
// EWS 2015-02-22
// Turn allow complex from real input on
// Declare subroutines
chsubr();
casubr();

// Main Routine
EXPORT RLCSERIES()
BEGIN
// initial steps
Z0:=0;
// radian mode
HAngle:=0;
// counter
I:=0;
// battery information
INPUT({V,F},"Battery Information",
{"V = ","F = "},
{"Volts","Frequency (Hz)"});
chsubr();
END;


// Choose Subroutine
chsubr()
BEGIN
LOCAL ch;
CHOOSE(ch,"# of Components: "+STRING(I),
{"Add Resistor (R)",
"Add Capacitor (C)",
"Add Inductor (L)",
"Calculate"});
// Execute calculation subroutine
casubr(ch);
END;

// Calculation Subroutine
casubr(x)
BEGIN
LOCAL a,b;
IF x==1 THEN
INPUT({a,b},"Resistor (Ω)",
{"a =","bi="});
Z0:=Z0+(a+b*i);
I:=I+1;
chsubr();
END;

IF x==2 THEN
INPUT({a,b},"Capacitor (farad)",
{"a =","bi="});
Z0:=Z0-i/(2*π*F*(a+b*i));
I:=I+1;
chsubr();
END;

IF x==3 THEN
INPUT({a,b},"Inductor (henry)",
{"a =","bi="});
Z0:=Z0+i*2*π*F*(a+b*i);
I:=I+1;
chsubr();
END;

// Calculation
IF x==4 THEN
PRINT();
PRINT("Impedance = "+Z0);
PRINT("Magnitude (Ω) = "+ABS(Z0));
PRINT("Phase Angle (°) ="+
STRING(ARG(Z0)*180/π));
PRINT("Current (amps) = "+
STRING(V/ABS(Z0)));
RETURN Z0;
END;
END;

TI-84+: RLCSERIE

a+bi   // Complex mode
Radian  // Radians mode
0→Z
Disp “BATTERY”
Disp “V = VOLT”
Disp “F = FREQ (HZ)”
Prompt V,F
Lbl 0
Menu(“CIRCUIT”,”+ RESISTOR”,1,”+ CAPACITOR”,2,
“+ INDUCTOR”,3,”CALCULATE”,4)
Lbl 1
Input “R (OHMS):”,R
Z+R→Z
Goto 0
Lbl 2
Input “C (FARAD):”,C
Z-i/(2πFC)→Z
Goto 0
Lbl 3
Input “L (HENRY):”,L
Z+i2πFL→Z
Goto 0
Lbl 4
Disp “IMPEDANCE=”
Pause Z
Disp “MAGNITUDE=”
Pause abs(Z)
Disp “PHASE ANGLE (°)=”
Pause angle(Z)*180/π
Disp “CURRENT (AMPS)=”
Pause V/abs(Z)

Sources:
ElectronicsTutorials.  Series RLC Circuit Analysis  URL: 
Retrieved February 22, 2015

Van Valkenburg, Mac E. (Editor) and Wendy M. Middelton (Editor)
"Reference Data for Engineers: Radio, Electronics, Computer, and
Communications"  9th Edition.  Newnes, Butterworth-Heinemann:  Wolburn,
MA  2002.  Print.



This blog is property of Edward Shore.  2015.

No comments:

Post a Comment

Adventures in Python: String Manipulation and Function/Derivative Table (Subroutines)

Adventures in Python:  String Manipulation and Function/Derivative Table (Subroutines) String Manipulation This script demonstrate...