Exemplo n.º 1
0
    # --Obtain list of building heights-- #
    # --Obtain list of building coordinates-- #

    listBuildingHeights = []
    listBuildingCoordinates = []

    for building in listOfIRIs:

        buildingHeight = sparqlBuildingHeights(building, sparqlEndPoint)["results"]["bindings"]
        height = getBuildingHeights(buildingHeight)
        listBuildingHeights.append(height)

        buildingCoordinates = sparqlBuildingCoordinates(building, sparqlEndPoint)["results"]["bindings"]
        coordinates = getBuildingCoordinates(buildingCoordinates, owlCRS, osmCRS)
        listBuildingCoordinates.append(coordinates)


    listBuildingsToTransfer = getGeoJSON(listBuildingCoordinates, listBuildingHeights, cityiri)

    return json.dumps(listBuildingsToTransfer)

if __name__ == "__main__":
    pythonLogger = PythonLogger('ADMSGeoJsonGetter.py')
    pythonLogger.postInfoToLogServer('start of ADMSGeoJsonGetter.py')
    try:
        returnResultsToJava(return_buildings())
        pythonLogger.postInfoToLogServer('end of ADMSGeoJsonGetter.py')
    except Exception as e:
        returnExceptionToJava(e)
        pythonLogger.postInfoToLogServer('end of ADMSGeoJsonGetter.py')
Exemplo n.º 2
0
        miscCosts, cpo, fame)
    u_prices['V_Price_Electricity_001'] /= ex_rates['V_USD_to_SGD']

    # Adjust prices to include the transport cost
    prices = transport_costs(prices, t_prices)

    # Search through the arbitrage opportunities
    return look_for_munnies(MoDS_data, prices, dates, s_prices, u_prices)

    # Define titles and labels to plot the futures prices data and plot the data
    #labels = {'FAME':{'title':'Biodiesel FAME futures prices from Chicago Mercantile Exchange', 'label':'Price (USD per tonne)'},'CPO':{'title':'Crude palm oil futures prices from Chicago Mercantile Exchange', 'label':'Price (USD per tonne)'}, 'x':{'title':'Delivery date (-)', 'label':dates['FAME']}}
    #plotting_prices(dates, prices, labels)


if __name__ == "__main__":

    pythonLogger = PythonLogger('CPO_to_FAME_MoDS2.py')
    pythonLogger.postInfoToLogServer('start of CPO_to_FAME_MoDS2.py')

    MoDS_data = str(sys.argv[1])
    miscCosts = json.loads(sys.argv[2])
    cpo = json.loads(sys.argv[3])
    fame = json.loads(sys.argv[4])
    try:
        returnResultsToJava(run(MoDS_data, miscCosts, cpo, fame))
    except Exception as e:
        import traceback
        pythonLogger.postInfoToLogServer(traceback.print_exc())
        returnExceptionToJava(e)
    finally:
        pythonLogger.postInfoToLogServer('end of CPO_to_FAME_MoDS2.py')
        queryStringWorld = """
            PREFIX system: <http://www.theworldavatar.com/ontology/ontocape/upper_level/system.owl#>

            SELECT ?powerplantIRI
            WHERE
            {{
                GRAPH <{0}>
            {{
                <http://www.theworldavatar.com/kb/powerplants/WorldPowerPlants.owl#WorldPowerPlants> system:hasSubsystem ?powerplantIRI .
            }}}}
        """.format(self.graph)

        results = sparqlQueryRead(queryStringWorld)['results']['bindings']
        powerplants = []
        for result in results:
            powerplants.append(result['powerplantIRI']['value'])
        return powerplants


if __name__ == "__main__":
    #     pythonLogger = PythonLogger('world_powerplants_sparql.py')
    #     pythonLogger.postInfoToLogServer('start of world_powerplants_sparql.py')

    try:
        wPSPARQL = WorldPowerPlantsSPARQL()
        powerplants = wPSPARQL.getPowerplants()
        returnResultsToJava(json.dumps(powerplants))
#         pythonLogger.postInfoToLogServer('end of world_powerplants_sparql.py')
    except Exception as e:
        returnExceptionToJava(e)
#         pythonLogger.postInfoToLogServer('end of world_powerplants_sparql.py')
Exemplo n.º 4
0
        RoomTempLow, RoomTempHigh, InitialTemp, C1, C2, C3, K1, K2, K3, K4, K5,
        A, B, C, Nc, industry_below, industry_above, cf, T0, F, z1, dG0, dH,
        r1, r2, s, t1, t2, t3, f1, f2, h_cond, h_conv, Ar, nc1, Ct, Rt, taut,
        Qcw, Tcwi, Ccw, z2, U0, E1, E2, I0, R, nc2, eta, Tlow, Thigh, Ilow,
        Ihigh, quantity, Ni)

    out0 = result[0]
    out1 = result[1]
    out2 = result[2]
    residential = out0[2] + out1[2] + out2[2]
    commercial = result[3][2]
    industrial = result[4][2]
    renewableGen = result[5]
    gridGen = residential + commercial + industrial - renewableGen
    #clear to zero
    gridGen = gridGen.clip(min=0)
    # for some reason, parsing the file in Claudius doesn't work, so this line is added
    folder = folder.replace("//", "/")
    np.savetxt(folder + "/totgen.csv",
               [residential, commercial, industrial, renewableGen, gridGen],
               delimiter=",")
    np.savetxt(folder + "/rh1.csv", [
        out0[3], out0[4], out0[5], out1[3], out1[4], out1[5], out2[3], out2[4],
        out2[5]
    ],
               delimiter=",")
    returnResultsToJava(result)
    now = datetime.now()
    current_time = now.strftime("%H:%M:%S")
    pythonLogger.postInfoToLogServer('end of system.py, Current time = ' +
                                     current_time)
Exemplo n.º 5
0
    # Adjust prices to include the transport cost
    prices = transport_costs(prices, t_prices)

    # Search through the arbitrage opportunities
    return look_for_munnies(MoDS_data, prices, dates, s_prices, u_prices)

    # Define titles and labels to plot the futures prices data and plot the data
    #labels = {'NG':{'title':'Natural gas futures prices from Chicago Mercantile Exchange', 'label':'Price (USD per mmBTU)'},'MeOH':{'title':'Methanol futures prices from Zhengzhou Commodity Exchange', 'label':'Price (USD per tonne)'}, 'x':{'title':'Delivery date (-)', 'label':dates['NG']}}
    #plotting_prices(dates, prices, labels)


if __name__ == "__main__":
    pythonLogger = PythonLogger('NG_to_MeOH_MoDS.py')
    pythonLogger.postInfoToLogServer('start of NG_to_MeOH_MoDS.py')

    MoDS_data = str(sys.argv[1])
    miscCosts = json.loads(sys.argv[2])
    hng = json.loads(sys.argv[3])
    zce = json.loads(sys.argv[4])

    try:
        returnResultsToJava(run(MoDS_data, miscCosts, hng, zce))
    except Exception as e:
        returnExceptionToJava(e)
    finally:
        pythonLogger.postInfoToLogServer('end of NG_to_MeOH_MoDS.py')

#     run("0.5527777778,-1.9678704734013681E43,-1.947340493583137E67,-1.3064212763820435E47,3063955.568812896,0.0,-1.312550425729447E46,-1.8126031951762418E54,-1.052184254037493E43",
#         json.loads('{"V_Price_Electricity_001":"0.0000385833","V_Price_Storage_NaturalGas_001":"0.11104","V_Price_FuelGas_001":"9.8","V_USD_to_CNY":"6.4757816642","V_USD_to_SGD":"1.3582620112","V_Price_Transport_USGC-NEA_NaturalGas_001":"6.571428571_1.142857143","V_Price_Transport_SG-SC_Methanol_001":"22.9","V_Price_CoolingWater_001":"0.00174","V_Price_ProcessWater_001":"0.00033","V_Price_MediumPressureSteam_001":"0.01264","V_Price_HighPressureSteam_001":"0.00349","V_Price_Storage_Methanol_001":"0.2075"}'),
#         json.loads('{"arrayHeader": ["NG", "Date", "Price type", "Size (mmBTU)"], "arrayMonths": ["JUL 2018", "AUG 2018", "SEP 2018", "OCT 2018", "NOV 2018", "DEC 2018", "JAN 2019", "FEB 2019", "MAR 2019", "APR 2019", "MAY 2019", "JUN 2019", "JUL 2019", "AUG 2019", "SEP 2019", "OCT 2019", "NOV 2019", "DEC 2019", "JAN 2020", "FEB 2020", "MAR 2020", "APR 2020", "MAY 2020", "JUN 2020", "JUL 2020", "AUG 2020", "SEP 2020", "OCT 2020", "NOV 2020", "DEC 2020", "JAN 2021", "FEB 2021", "MAR 2021", "APR 2021", "MAY 2021", "JUN 2021", "JUL 2021", "AUG 2021", "SEP 2021", "OCT 2021", "NOV 2021", "DEC 2021", "JAN 2022", "FEB 2022", "MAR 2022", "APR 2022", "MAY 2022", "JUN 2022", "JUL 2022", "AUG 2022", "SEP 2022", "OCT 2022", "NOV 2022", "DEC 2022", "JAN 2023", "FEB 2023", "MAR 2023", "APR 2023", "MAY 2023", "JUN 2023", "JUL 2023", "AUG 2023", "SEP 2023", "OCT 2023", "NOV 2023", "DEC 2023", "JAN 2024", "FEB 2024", "MAR 2024", "APR 2024", "MAY 2024", "JUN 2024", "JUL 2024", "AUG 2024", "SEP 2024", "OCT 2024", "NOV 2024", "DEC 2024", "JAN 2025", "FEB 2025", "MAR 2025", "APR 2025", "MAY 2025", "JUN 2025", "JUL 2025", "AUG 2025", "SEP 2025", "OCT 2025", "NOV 2025", "DEC 2025", "JAN 2026", "FEB 2026", "MAR 2026", "APR 2026", "MAY 2026", "JUN 2026", "JUL 2026", "AUG 2026", "SEP 2026", "OCT 2026", "NOV 2026", "DEC 2026", "JAN 2027", "FEB 2027", "MAR 2027", "APR 2027", "MAY 2027", "JUN 2027", "JUL 2027", "AUG 2027", "SEP 2027", "OCT 2027", "NOV 2027", "DEC 2027", "JAN 2028", "FEB 2028", "MAR 2028", "APR 2028", "MAY 2028", "JUN 2028"], "arrayDatetime": ["Tue, 19 Jun 2018 10:48:18 GMT", "Prior Settlement (USD per mmBTU)", "10.0"], "arrayPrices": ["2.951", "2.951", "2.932", "2.944", "2.986", "3.095", "3.183", "3.154", "3.056", "2.677", "2.639", "2.665", "2.694", "2.701", "2.687", "2.702", "2.755", "2.880", "2.979", "2.945", "2.854", "2.547", "2.520", "2.548", "2.579", "2.587", "2.573", "2.595", "2.650", "2.780", "2.879", "2.845", "2.757", "2.512", "2.487", "2.515", "2.545", "2.556", "2.554", "2.580", "2.641", "2.781", "2.889", "2.862", "2.793", "2.556", "2.535", "2.561", "2.589", "2.602", "2.603", "2.631", "2.692", "2.837", "2.953", "2.928", "2.863", "2.633", "2.615", "2.640", "2.667", "2.684", "2.686", "2.714", "2.775", "2.921", "3.037", "3.012", "2.947", "2.707", "2.689", "2.714", "2.743", "2.760", "2.762", "2.790", "2.851", "2.997", "3.113", "3.088", "3.023", "2.783", "2.764", "2.789", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "2.691", "2.821", "2.875"]}'),
#         json.loads('{"arrayHeader": ["MeOH", "Date", "Price type", "Size (tonne)"], "arrayMonths": ["JUL 2018", "AUG 2018", "SEP 2018", "OCT 2018", "NOV 2018", "DEC 2018", "JAN 2019", "FEB 2019", "MAR 2019", "APR 2019", "MAY 2019", "JUN 2019"], "arrayDatetime": ["Tue, 19 Jun 2018 10:48:08 GMT", "Prior Settlement (CNY per tonne)", "1.0"], "arrayPrices": ["2755.0", "2816.0", "2818.0", "2795.0", "2869.0", "2909.0", "2903.0", "2871.0", "2864.0", "2827.0", "2734.0", "2749.0"]}'))