130 lines
4.9 KiB
Python
130 lines
4.9 KiB
Python
import numpy as np
|
|
|
|
|
|
def compute_relative_error(vcur,vref):
|
|
eps = 0
|
|
for i in range(len(vref)):
|
|
eps += ((vcur[i] - vref[i])/vref[i])**2
|
|
|
|
return np.sqrt(eps)/len(vcur)
|
|
|
|
|
|
|
|
|
|
vref = [10, 250, 250, 250, 30]
|
|
|
|
#case 1
|
|
v_120_case1 = [ 10.22 , 249.1 , 254.37 , 259.15 , 29.81 ]
|
|
v_70_case1 = [20.38, 211.19, 189.01, 207.09, 28.78]
|
|
v_50_case1 = [90.45, 240.98, 241.03, 316.89, 21.27]
|
|
v_25_case1 = [2012.53, 1004.3, 1172.01, 1755.02, 12.69]
|
|
|
|
vnew_120_case1 = [ 10.26 , 249.84, 254.6, 259.69 , 29.81]
|
|
vnew_70_case1 = [ 10.26 , 250.73, 252.78, 256.62 , 29.77]
|
|
vnew_50_case1 = [ 10.27 , 248.41 ,254.71 ,253.01 , 29.82]
|
|
vnew_25_case1 = [ 10.18 , 251.13 ,253.78 ,257.4 , 29.82]
|
|
|
|
|
|
|
|
|
|
#case 2
|
|
v_120_case2 = [ 9.95, 248.5, 254.4, 253.4, 29.80]
|
|
v_70_case2 = [ 20.7 , 214.77 , 196.47 , 209.31 , 28.76]
|
|
v_50_case2 = [ 88.40, 236.7, 240.4, 312.9, 21.22]
|
|
v_25_case2 = [ 880.4, 747.2, 822.7, 1380, 9.37]
|
|
|
|
vnew_120_case2 = [ 10, 246.6, 250.5, 254.5, 29.80]
|
|
vnew_70_case2 = [ 10.00, 250.2, 252.1, 255.0, 29.76]
|
|
vnew_50_case2 = [ 9.92, 247.6, 253.4, 250.6, 29.81]
|
|
vnew_25_case2 = [ 10.04 , 247.95 , 250.51 , 253.49 , 29.8 ]
|
|
|
|
|
|
|
|
|
|
#case 3
|
|
v_120_case3 = [ 9.91 , 236.69 , 236.44 , 224.36 ,30.15]
|
|
v_70_case3 = [ 16.48 , 192.8 , 155.69 , 148.34 , 29.01]
|
|
v_50_case3 = [231.07 , 369.12 , 521.28 , 458.69 , 23.66]
|
|
v_25_case3 = [ 0, 0, 0, 0, 0]
|
|
|
|
vnew_120_case3 = [ 10.17 , 247.95, 249.76 , 248.29 ,29.91]
|
|
vnew_70_case3 = [ 9.98 , 249.29 , 248.97 , 251.16 ,29.8 ]
|
|
vnew_50_case3 = [ 9.98 , 246.89 , 251.51 , 245.14 , 29.89]
|
|
vnew_25_case3 = [ 9.6 , 244.93 , 244.42 , 245.22 ,29.84]
|
|
|
|
|
|
#######################################################################
|
|
|
|
eps_120_case1 = compute_relative_error(v_120_case1,vref)
|
|
eps_70_case1 = compute_relative_error(v_70_case1,vref)
|
|
eps_50_case1 = compute_relative_error(v_50_case1,vref)
|
|
eps_25_case1 = compute_relative_error(v_25_case1,vref)
|
|
|
|
eps_new120_case1 = compute_relative_error(vnew_120_case1,vref)
|
|
eps_new70_case1 = compute_relative_error(vnew_70_case1,vref)
|
|
eps_new50_case1 = compute_relative_error(vnew_50_case1,vref)
|
|
eps_new25_case1 = compute_relative_error(vnew_25_case1,vref)
|
|
|
|
|
|
|
|
eps_120_case2 = compute_relative_error(v_120_case2,vref)
|
|
eps_70_case2 = compute_relative_error(v_70_case2,vref)
|
|
eps_50_case2 = compute_relative_error(v_50_case2,vref)
|
|
eps_25_case2 = compute_relative_error(v_25_case2,vref)
|
|
|
|
eps_new120_case2 = compute_relative_error(vnew_120_case2,vref)
|
|
eps_new70_case2 = compute_relative_error(vnew_70_case2,vref)
|
|
eps_new50_case2 = compute_relative_error(vnew_50_case2,vref)
|
|
eps_new25_case2 = compute_relative_error(vnew_25_case2,vref)
|
|
|
|
|
|
eps_120_case3 = compute_relative_error(v_120_case3,vref)
|
|
eps_70_case3 = compute_relative_error(v_70_case3,vref)
|
|
eps_50_case3 = compute_relative_error(v_50_case3,vref)
|
|
eps_25_case3 = compute_relative_error(v_25_case3,vref)
|
|
|
|
eps_new120_case3 = compute_relative_error(vnew_120_case3,vref)
|
|
eps_new70_case3 = compute_relative_error(vnew_70_case3,vref)
|
|
eps_new50_case3 = compute_relative_error(vnew_50_case3,vref)
|
|
eps_new25_case3 = compute_relative_error(vnew_25_case3,vref)
|
|
|
|
|
|
|
|
|
|
print('--------- CASE 1 ---------')
|
|
|
|
print('venc 120% error = {e}'.format(e=np.round(100*eps_120_case1,2)))
|
|
print('venc 70% error = {e}'.format(e=np.round(100*eps_70_case1,2)))
|
|
print('venc 50% error = {e}'.format(e=np.round(100*eps_50_case1,2)))
|
|
print('venc 25% error = {e}'.format(e=np.round(100*eps_25_case1,2)))
|
|
|
|
print('odv venc 120% error = {e}'.format(e=np.round(100*eps_new120_case1,2)))
|
|
print('odv venc 70% error = {e}'.format(e=np.round(100*eps_new70_case1,2)))
|
|
print('odv venc 50% error = {e}'.format(e=np.round(100*eps_new50_case1,2)))
|
|
print('odv venc 25% error = {e}'.format(e=np.round(100*eps_new25_case1,2)))
|
|
|
|
|
|
print('--------- CASE 2 ---------')
|
|
|
|
print('venc 120% error = {e}'.format(e=np.round(100*eps_120_case2,2)))
|
|
print('venc 70% error = {e}'.format(e=np.round(100*eps_70_case2,2)))
|
|
print('venc 50% error = {e}'.format(e=np.round(100*eps_50_case2,2)))
|
|
print('venc 25% error = {e}'.format(e=np.round(100*eps_25_case2,2)))
|
|
|
|
print('odv venc 120% error = {e}'.format(e=np.round(100*eps_new120_case2,2)))
|
|
print('odv venc 70% error = {e}'.format(e=np.round(100*eps_new70_case2,2)))
|
|
print('odv venc 50% error = {e}'.format(e=np.round(100*eps_new50_case2,2)))
|
|
print('odv venc 25% error = {e}'.format(e=np.round(100*eps_new25_case2,2)))
|
|
|
|
|
|
print('--------- CASE 3 ---------')
|
|
|
|
print('venc 120% error = {e}'.format(e=np.round(100*eps_120_case3,2)))
|
|
print('venc 70% error = {e}'.format(e=np.round(100*eps_70_case3,2)))
|
|
print('venc 50% error = {e}'.format(e=np.round(100*eps_50_case3,2)))
|
|
print('venc 25% error = {e}'.format(e=np.round(100*eps_25_case3,2)))
|
|
|
|
print('odv venc 120% error = {e}'.format(e=np.round(100*eps_new120_case3,2)))
|
|
print('odv venc 70% error = {e}'.format(e=np.round(100*eps_new70_case3,2)))
|
|
print('odv venc 50% error = {e}'.format(e=np.round(100*eps_new50_case3,2)))
|
|
print('odv venc 25% error = {e}'.format(e=np.round(100*eps_new25_case3,2))) |