<commit_before># Sam Rankine Cycle

import numpy as np
import pandas as pd
import math
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

# Given properties

# number of time steps desired per process
step = 25

# these pressures must exist in the saturation table
# ... later add function to create new record of interpolated data in between
# pressure points if the user selects a pressure that isn't in the saturation table
p_low = 0.1 # low pressure, in MPa (condenser pressure)
p_hi = 10 # high pressure, in MPa (boiler pressure)

h2o_psat = pd.read_csv('H2O_PresSat.csv')
h2o_psat = h2o_psat.dropna(axis=1) #remove last NaN column
#print h2o_psat
h2o_tsat = pd.read_csv('H2O_TempSat.csv')
h2o_tsat = h2o_tsat.dropna(axis=1) #remove last NaN column
#print h2o_tsat
# merge the psat and tsat tables into one saturated table
h2o_sat = pd.concat([h2o_psat,h2o_tsat], axis=0, join='outer', join_axes=None, ignore_index=True,
                    keys=None, levels=None, names=None, verify_integrity=False)
#print h2o_sat
#sort by pressure
h2o_sat = h2o_sat.sort('P')
#print 'sorted...'
#print h2o_sat
h2o_comp = pd.read_csv('H2O_Compressed.csv')
h2o_comp = h2o_comp.dropna(axis=1) #remove last NaN column
#print h2o_comp

# begin computing processess for rankine cycle
fig = plt.figure(1)
plt.figure(1).suptitle("Rankine Cycle T-s Diagram \n Blue = adiabatic \n Green = isentropic")
plt.xlabel("Entropy (kJ/kg.K)")
plt.ylabel("Temperature (deg C)")

# create numpy arrays to save data from modeling
TT = np.zeros(step*4)
PP = np.zeros(step*4)
vv = np.zeros(step*4)
uu = np.zeros(step*4)
hh = np.zeros(step*4)
ss = np.zeros(step*4)
xx = np.zeros(step*4)

# process 2-3, isentropic turbine expansion with work output
# assume that this isn't a superheated rankine cycle, so state 2 is saturated vapor at pressure p_hi
s_o = h2o_sat[h2o_sat['P']==p_hi]['sg'].values[0] # this is the original entropy value
print s_o
#now interpolate down the saturation table and save the values for h, u, P, T, v
#for idx, row in h2o_sat.iterrows():
#    h2o_sat.ix[idx, grop] = 0
# save figure to directory
fig.savefig("graph.png")<commit_msg>add comments in the module import section<commit_after># Sam Rankine Cycle

import numpy as np  # for some numerical methods
import pandas as pd # for data analysis tools like dataframes
import math         # duh
import matplotlib   # for pretty pictures
matplotlib.use('Agg') # to get matplotlib to save figures to a file instead of using X windows
import matplotlib.pyplot as plt 

# Given properties

# number of time steps desired per process
step = 25

# these pressures must exist in the saturation table
# ... later add function to create new record of interpolated data in between
# pressure points if the user selects a pressure that isn't in the saturation table
p_low = 0.1 # low pressure, in MPa (condenser pressure)
p_hi = 10 # high pressure, in MPa (boiler pressure)

h2o_psat = pd.read_csv('H2O_PresSat.csv')
h2o_psat = h2o_psat.dropna(axis=1) #remove last NaN column
#print h2o_psat
h2o_tsat = pd.read_csv('H2O_TempSat.csv')
h2o_tsat = h2o_tsat.dropna(axis=1) #remove last NaN column
#print h2o_tsat
# merge the psat and tsat tables into one saturated table
h2o_sat = pd.concat([h2o_psat,h2o_tsat], axis=0, join='outer', join_axes=None, ignore_index=True,
                    keys=None, levels=None, names=None, verify_integrity=False)
#print h2o_sat
#sort by pressure
h2o_sat = h2o_sat.sort('P')
#print 'sorted...'
#print h2o_sat
h2o_comp = pd.read_csv('H2O_Compressed.csv')
h2o_comp = h2o_comp.dropna(axis=1) #remove last NaN column
#print h2o_comp

# begin computing processess for rankine cycle
fig = plt.figure(1)
plt.figure(1).suptitle("Rankine Cycle T-s Diagram \n Blue = adiabatic \n Green = isentropic")
plt.xlabel("Entropy (kJ/kg.K)")
plt.ylabel("Temperature (deg C)")

# create numpy arrays to save data from modeling
TT = np.zeros(step*4)
PP = np.zeros(step*4)
vv = np.zeros(step*4)
uu = np.zeros(step*4)
hh = np.zeros(step*4)
ss = np.zeros(step*4)
xx = np.zeros(step*4)

# process 2-3, isentropic turbine expansion with work output
# assume that this isn't a superheated rankine cycle, so state 2 is saturated vapor at pressure p_hi
s_o = h2o_sat[h2o_sat['P']==p_hi]['sg'].values[0] # this is the original entropy value
print s_o

#now interpolate down the saturation table and save the values for h, u, P, T, v
#for idx, row in h2o_sat.iterrows():
#    h2o_sat.ix[idx, grop] = 0

# save figure to directory
# fig.savefig("graph.png")
{'fraction_non_alphanumeric': 0.10376940133037695, 'fraction_numerical': 0.022172949002217297, 'mean_word_length': 4.761174968071519, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '2033982', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1623, 'n_words': 537}