-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRuO2spline.py
More file actions
49 lines (40 loc) · 4.57 KB
/
RuO2spline.py
File metadata and controls
49 lines (40 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
tempdata=[280,200,150,120,80,70,60,50,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19.5,19,18.5,18,17.5,17,16.5,16,15.5,15,14.5,14,13.5,13,12.5,12,11.5,11,10.5,10,9.5,9,8.5,8,7.5,7,6.5,6,5.8,5.6,5.4,5.2,5,4.8,4.6,4.4,4.2,4,3.9,3.8,3.7,3.6,3.5,3.4,3.3,3.2,3.1,3,2.9,2.8,2.7,2.6,2.5,2.4,2.3,2.2,2.1,2,1.9,1.8,1.7,1.6,1.5,1.4,1.3,1.2,1.15,1.1,1.05,1,0.95,0.9,0.85,0.8,0.75,0.7,0.65,0.6,0.55,0.5,0.48,0.46,0.44,0.42,0.4,0.38,0.36,0.34,0.32,0.3,0.29,0.28,0.27,0.26,0.25,0.24,0.23,0.22,0.21,0.2,0.19,0.18,0.17,0.16,0.15,0.14,0.13,0.12,0.11,0.1,0.095,0.09,0.085,0.08,0.075,0.07,0.065,0.06,0.055,0.05]
resistancedata=[1000,1004.6,1009.7,1014.3,1025.1,1029.3,1034.2,1040.5,1049.085,1050.134,1051.234,1052.39,1053.606,1054.889,1056.243,1057.677,1059.198,1060.815,1062.539,1064.38,1066.352,1068.47,1070.749,1073.21,1075.874,1078.766,1081.916,1085.358,1089.133,1091.161,1093.292,1095.534,1097.896,1100.389,1103.024,1105.815,1108.777,1111.927,1115.285,1118.874,1122.719,1126.849,1131.295,1136.092,1141.28,1146.901,1153.006,1159.651,1166.915,1174.892,1183.729,1193.602,1204.75,1217.388,1231.551,1247.556,1266.578,1275.01,1283.982,1293.599,1303.938,1315.073,1327.083,1340.083,1354.199,1369.584,1386.413,1395.435,1404.903,1414.85,1425.318,1436.348,1447.99,1460.3,1473.34,1487.181,1501.905,1517.604,1534.385,1552.367,1571.691,1592.512,1615.014,1639.398,1665.903,1694.798,1726.405,1761.101,1799.379,1841.854,1889.421,1943.254,2005.177,2077.48,2162.933,2211.3,2263.645,2320.085,2380.767,2446.939,2523.007,2609.096,2704.598,2812.425,2936.565,3080.725,3250.526,3453.501,3700.518,3815.025,3940.326,4078.034,4230.018,4398.491,4586.345,4797.016,5034.682,5304.976,5615.03,5787.872,5974.484,6176.7,6396.627,6636.722,6900.157,7190.652,7512.681,7872.352,8277.056,8735.858,9261.107,9868.596,10579.591,11421.609,12431.613,13658.217,15165.463,17039.129,19400.468,20820.341,22443.68,24330.677,26563.618,29253.31,32601.283,37123.896,43515.78,52106.706,63765.093]
splinecoefficient=[-0.0575,-0.102,-0.153333333,-0.27,-0.42,-0.49,-0.63,-0.8585,-1.049,-1.1,-1.156,-1.216,-1.283,-1.354,-1.434,-1.521,-1.617,-1.724,-1.841,-1.972,-2.118,-2.279,-2.461,-2.664,-2.892,-3.15,-3.442,-3.775,-4.056,-4.262,-4.484,-4.724,-4.986,-5.27,-5.582,-5.924,-6.3,-6.716,-7.178,-7.69,-8.26,-8.892,-9.594,-10.376,-11.242,-12.21,-13.29,-14.528,-15.954,-17.674,-19.746,-22.296,-25.276,-28.326,-32.01,-38.044,-42.16,-44.86,-48.085,-51.695,-55.675,-60.05,-65,-70.58,-76.925,-84.145,-90.22,-94.68,-99.47,-104.68,-110.3,-116.42,-123.1,-130.4,-138.41,-147.24,-156.99,-167.81,-179.82,-193.24,-208.21,-225.02,-243.84,-265.05,-288.95,-316.07,-346.96,-382.78,-424.75,-475.67,-538.33,-619.23,-723.03,-854.53,-967.34,-1046.9,-1128.8,-1213.64,-1323.44,-1521.36,-1721.78,-1910.04,-2156.54,-2482.8,-2883.2,-3396.02,-4059.5,-4940.34,-5725.35,-6265.05,-6885.4,-7599.2,-8423.65,-9392.7,-10533.55,-11883.3,-13514.7,-15502.7,-17284.2,-18661.2,-20221.6,-21992.7,-24009.5,-26343.5,-29049.5,-32202.9,-35967.1,-40470.4,-45880.2,-52524.9,-60748.9,-71099.5,-84201.8,-101000.4,-122660.4,-150724.6,-187366.6,-236133.9,-283974.6,-324667.8,-377399.4,-446588.2,-537938.4,-669594.6,-904522.6,-1278376.8,-1718185.2,-2331677.4]
r=len(resistancedata)
def splinepoint(x):
if x>0:
if x<resistancedata[0]:
t=(float(x-resistancedata[0]))/float(splinecoefficient[0])+float(tempdata[0])
elif x>resistancedata[-1]:
t=(float(x-resistancedata[-1]))/float(splinecoefficient[-1])+float(tempdata[-1])
else:
for j in range(0,r-1):
if resistancedata[j]<=x<resistancedata[j+1]:
t=(float(x-resistancedata[j]))/float(splinecoefficient[j])+float(tempdata[j])
elif x<0:
y=-x
if y<resistancedata[0]:
t=(float(y-resistancedata[0]))/float(splinecoefficient[0])+float(tempdata[0])
elif y>resistancedata[-1]:
t=(float(y-resistancedata[-1]))/float(splinecoefficient[-1])+float(tempdata[-1])
else:
for j in range(0,r-1):
if resistancedata[j]<=y<resistancedata[j+1]:
t=(float(y-resistancedata[j]))/float(splinecoefficient[j])+float(tempdata[j])
return t
def linearspline(res):
splinetemp=np.array([])
for i in range(0,len(res)):
"""
if res[i]<resistancedata[0]:
t=0
elif res[i]>resistancedata[148]:
t=0
else:
"""
t=splinepoint(res[i])
print t
splinetemp=np.append(splinetemp,t)
return splinetemp