In [1]:
#!/usr/bin/env python
#Confort

import numpy as np
import matplotlib.pyplot as plt 
import math

def fun(TComfAgent):
    C = 0
    T = 24
    diffAux = T - TComfAgent
    if diffAux < 0:
        T = TComfAgent - diffAux
    diff = math.fabs(T - TComfAgent)
    if(2>=diff):
        C = 100-10*math.pow((T-TComfAgent)/1.5, 2)
    elif(diff>2 and 4>=diff):
        m = -(82-50)/(4-2)
        x0 = (TComfAgent+2)-(82/m)
        C = m*(T-x0)
    else:
        x0 = math.log(50) + (TComfAgent+4)
        C = math.pow(math.e, x0-T)
        C = float(int(C))
    return C


vfun = np.vectorize(fun)

x = np.linspace(18, 30, 1000) 
y = vfun(x)
plt.plot(x, y, '-')
plt.xlabel('Temperature')
plt.ylabel('Comfort [%]')
plt.show()


<Figure size 640x480 with 1 Axes>

In [2]:
#!/usr/bin/env python
#Temperatura para votar

import numpy as np
import matplotlib.pyplot as plt 
import math

def fun(TComfAgent):
    C = 0
    T = 24
    diffAux = T - TComfAgent
    if diffAux < 0:
        T = TComfAgent - diffAux
    diff = math.fabs(T - TComfAgent)
    if(2>=diff):
        C = 100-10*math.pow((T-TComfAgent)/1.5, 2)
    elif(diff>2 and 4>=diff):
        m = -(82-50)/(4-2)
        x0 = (TComfAgent+2)-(82/m)
        C = m*(T-x0)
    else:
        x0 = math.log(50) + (TComfAgent+4)
        C = math.pow(math.e, x0-T)
        C = float(int(C))
    return C


vfun = np.vectorize(fun)

x = np.linspace(18, 30, 1000) 
y = vfun(x)
plt.plot(x, y, '-')
plt.xlabel('Temperature')
plt.ylabel('Comfort [%]')
plt.show()



In [62]:
#!/usr/bin/env python
#Temperatura para votar

import numpy as np
import matplotlib.pyplot as plt 
import math

def fun(TComfAgent):
    C = 0
    T = 24
    diffAux = T - TComfAgent
    if diffAux < 0:
        T = TComfAgent - diffAux
    diff = math.fabs(T - TComfAgent)
    C = 0.3 + (100-10*math.pow((T-TComfAgent)/0.8, 1.7))/10
    return C


vfun = np.vectorize(fun)

x = np.linspace(18, 30, 100000) 
y = vfun(x)
plt.plot(x, y, '-')
plt.xlabel('Temperature')
plt.ylabel('Degree [%]')
plt.show()



In [ ]: