示例#1
0
def EnergyNeedGraph(f1, f2, action):
    outerdata = rm.OpenTemperatureModel(f1)
    innerdata = rm.OpenTemperatureModel(f2)

    innerTemp, outerTemp, energyNeed, x_axis = [], [], [], []

    for array in innerdata:
        innerTemp.append(array[1])
        x_axis.append(array[0])

    for array in outerdata:
        outerTemp.append(array[1])

    for i in range(0, len(innerTemp)):
        space = action['Space'][0] * action['Space'][1] * action['Space'][2]
        #space2 = action['Space'][0] * action['Space'][1] * action['Space'][3]
        energyNeed.append(
            f.EnergyRequired(f.SubstanceMass(space, 1.29), 1005,
                             (innerTemp[i] - outerTemp[i])))
        #+f.EnergyRequired(f.SubstanceMass(space2, 2500), 920, (innerTemp[i] - innerTemp[i-1])))

    fig = plt.figure()
    fig.show()
    ax = fig.add_subplot(111)

    ax.plot(x_axis, energyNeed, label="EnergyNeed", fillstyle="none")

    plt.xlabel("Time (hours)")
    plt.gcf().autofmt_xdate()
    plt.ylabel("Energy Need (Q in Joules)")
    plt.legend(loc=0)
    plt.draw()
    plt.show()
示例#2
0
文件: Simulator.py 项目: RK21898/WPS
def _CalculateNeeds(action):
    """"CalculateNeeds calculates the needs"""
    innerData = rm.OpenTemperatureModel("InsideRequestTemp")
    outerData = rm.OpenTemperatureModel("OutsideTemp")

    innerTemp, outerTemp, energyNeed = [], [], []

    for array in innerData:
        innerTemp.append(array[1])

    for array in outerData:
        outerTemp.append(array[1])

    for i in range(0, len(innerTemp)):
        space = action['Space'][0] * action['Space'][1] * action['Space'][2]
        #space2 = action['Space'][0] * action['Space'][1] * action['Space'][3]
        #print((innerTemp[i] - innerTemp[i-1]))
        energyNeed.append(f.EnergyRequired(f.SubstanceMass(space, 1.29), 1005, (innerTemp[i] - outerTemp[i])))
                            #+f.EnergyRequired(f.SubstanceMass(space2, 2500), 920, (innerTemp[i] - innerTemp[i-1])))
    
    return energyNeed