<jupyter_start><jupyter_text>Electric Machinery Fundamentals 5th edition Chapter 4 (Code examples)  Example 4-4**Plot the terminal characteristics of the generator of Example 4-3 with a 0.8 PF leading and lagging load.** Import the PyLab namespace (provides set of useful commands and constants like Pi) and reduce the *displayed* precision to four digits.<jupyter_code>%pylab notebook
%precision 4<jupyter_output>Populating the interactive namespace from numpy and matplotlib<jupyter_text>First, initialize the current amplitudes (21 values in the range 0-60 A):<jupyter_code>i_a = linspace(0, 60, 21)   # syntax: linspace(start, end, NumberOfValues)<jupyter_output><empty_output><jupyter_text>Now initialize all other values:<jupyter_code>#v_phase = zeros(1,21);
e_a = 277.0   # armature voltage
x_s = 1.0     # sychronous reactance
PF=0.8        # power factor
theta_rad = arccos(PF)                        # in radians
theta_lead = degrees(theta_rad)               # angle for leading power factor
theta_lagg = - degrees(theta_rad)             # angle for lagging power factor
theta = radians([[theta_lead], [theta_lagg]]) # combine both angles in an array
theta # let's see what it looks like
theta_lead   # let's see what the angles look like
theta_lagg   # let's see what the angles look like<jupyter_output><empty_output><jupyter_text>Now calculate `v_phase` for each current level using:$$E_A^2 = (V_\phi - X_S I_A \sin(\theta))^2  + (X_S I_A \cos(\theta))^2$$which can be solved for the phase voltage:$$ V_\phi = \sqrt{E_A^2 - (X_S I_A \cos(\theta))^2} + X_S I_A \sin(\theta)$$<jupyter_code>v_phase = sqrt(e_a**2 -(x_s * i_a * cos(theta))**2) + (x_s * i_a * sin(theta))<jupyter_output><empty_output><jupyter_text>Calculate terminal voltage from the phase voltage:<jupyter_code>v_t = v_phase * sqrt(3)<jupyter_output><empty_output><jupyter_text>Plot the terminal characteristic, remembering that the line current is the same as `i_a`:<jupyter_code>plot(i_a, v_t[0], i_a, v_t[1], lw=2)  # ATTENTION! Python starts array count at 0
xlabel('Line Current (A)')
ylabel('Terminal voltage (V)')
title ('Terminal characteristic for 0.8 PF lagging and leading load')
legend(('$PF = 0.8$ leading', '$PF = 0.8$ lagging'), loc=7) # loc=7 stands for centre right
grid()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11328976034858387, 'fraction_numerical': 0.02178649237472767, 'mean_word_length': 5.1063829787234045, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '279438', 'license': 'Unlicense', 'n_tokens_mistral': 825, 'n_tokens_neox': 776, 'n_words': 240, 'path': 'Chapman/Ch4-Example_4-04.ipynb', 'repo_name': 'dietmarw/EK5312', 'size': '2295'}