Esempio n. 1
0
ssc.module_exec(mod, dat)

# OLD print results
# ac = ssc.data_get_array(dat, "ac")
# ann = sum([x/1000 for x in ac])
# print "PVWatts V1 Simulation ok, e_net (annual kW)=", ann

# Extract data.
# Geodata.
city = ssc.data_get_string(dat, 'city')
state = ssc.data_get_string(dat, 'state')
lat = ssc.data_get_number(dat, 'lat')
lon = ssc.data_get_number(dat, 'lon')
elev = ssc.data_get_number(dat, 'elev')
# Weather
irrad = ssc.data_get_array(dat, 'dn')
diffIrrad = ssc.data_get_array(dat, 'df')
temp = ssc.data_get_array(dat, 'tamb')
cellTemp = ssc.data_get_array(dat, 'tcell')
wind = ssc.data_get_array(dat, 'wspd')
# Power generation.
dcOut = ssc.data_get_array(dat, 'dc')
acOut = ssc.data_get_array(dat, 'ac')

# Show some results.
def printSumm(name):
	values = eval(name)
	print name, len(values), values[1:24]
print city, state, lat, lon, elev
printSumm('irrad')
printSumm('diffIrrad')
Esempio n. 2
0
                         0, 0, 0, 0, 0, 0, 0, 0.6625, 0.9625, 1, 1, 1, 1, 1,
                         0.6125, 0.4, 0, 0, 0, 0, 0, 0, 0, 0
                     ],
                     [
                         0, 0, 0, 0, 0, 0, 0, 0.2, 0.9125, 1, 1, 1, 1, 1,
                         0.7375, 0.2125, 0, 0, 0, 0, 0, 0, 0, 0
                     ],
                     [
                         0, 0, 0, 0, 0, 0, 0, 0.0625, 0.7, 1, 1, 1, 0.9375,
                         0.8, 0.7, 0.1875, 0, 0, 0, 0, 0, 0, 0, 0
                     ],
                     [
                         0, 0, 0, 0, 0, 0, 0, 0, 0.45, 0.95, 1, 1, 0.8125,
                         0.3625, 0.3625, 0.375, 0, 0, 0, 0, 0, 0, 0, 0
                     ],
                     [
                         0, 0, 0, 0, 0, 0, 0, 0.0125, 0.525, 0.95, 1, 0.9875,
                         0.75, 0.175, 0.2125, 0.275, 0, 0, 0, 0, 0, 0, 0, 0
                     ]])

# run PV system simulation
mod = ssc.module_create("pvwattsv1")
ssc.module_exec(mod, dat)

# print results
ann = 0
ac = ssc.data_get_array(dat, "ac")
for i in range(len(ac)):
    ac[i] = ac[i] / 1000
    ann += ac[i]
print "PVWatts V1 Simulation ok, e_net (annual kW)=", ann
Esempio n. 3
0
ssc.module_exec(mod, dat)

# OLD print results
# ac = ssc.data_get_array(dat, "ac")
# ann = sum([x/1000 for x in ac])
# print "PVWatts V1 Simulation ok, e_net (annual kW)=", ann

# Extract data.
# Geodata.
city = ssc.data_get_string(dat, 'city')
state = ssc.data_get_string(dat, 'state')
lat = ssc.data_get_number(dat, 'lat')
lon = ssc.data_get_number(dat, 'lon')
elev = ssc.data_get_number(dat, 'elev')
# Weather
irrad = ssc.data_get_array(dat, 'dn')
diffIrrad = ssc.data_get_array(dat, 'df')
temp = ssc.data_get_array(dat, 'tamb')
cellTemp = ssc.data_get_array(dat, 'tcell')
wind = ssc.data_get_array(dat, 'wspd')
# Power generation.
dcOut = ssc.data_get_array(dat, 'dc')
acOut = ssc.data_get_array(dat, 'ac')


# Show some results.
def printSumm(name):
    values = eval(name)
    print name, len(values), values[1:24]

Esempio n. 4
0
File: 2swh.py Progetto: acmbc68/omf
ssc.data_set_number(dat, "pump_eff", 0.8) 				#Pumping efficiency						%
ssc.data_set_number(dat, "FRta", 0.681) 				#FRta									?
ssc.data_set_number(dat, "FRUL", 3.82) 					#FRUL									?
ssc.data_set_number(dat, "iam", -0.43) 					#Incidence angle modifier				?
ssc.data_set_number(dat, "max_iter", 100) 				#Max iterations allowed					? ?=100	MIN=0,MAX=1000,INTEGER
ssc.data_set_number(dat, "ftol_iter", 0.01) 			#Iteration tolerance					? ?=0.01 POSITIVE



# run solar water heating system simulation
mod = ssc.module_create("swh")
ssc.module_exec(mod, dat)

# extract results 
varNames = ['beam','diffuse','T_dry','Q_deliv','Q_useful', 'T_hot', 'T_cold', 'draw']
rezzies = {var:ssc.data_get_array(dat, var) for var in varNames}

# print results
for key in rezzies:	print key, len(rezzies[key]), rezzies[key][1:24]

# graph results
pyp.figure('swh annual output')
pyp.subplots_adjust(left=0.03, bottom=0.05, right=0.98, top=0.98)
pyp.subplot(411)
pyp.plot(rezzies['beam'], label='beam')
pyp.plot(rezzies['diffuse'], label='diffuse')
pyp.legend()
pyp.subplot(412)
pyp.plot(rezzies['Q_deliv'], label='Q_deliv')
pyp.plot(rezzies['Q_useful'], label='Q_useful')
pyp.legend()
Esempio n. 5
0
    0, 0, 0, 0, 0.08, 0.02, 0.35, 0.6, 1, 1.6, 2, 2.25, 2.35, 2.4, 2.4, 2.37,
    2.3, 2.09, 2, 2, 2, 2, 2, 1.98, 1.95, 1.8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0
]
ssc.data_set_array(data, 'pc_power', pc_power)
ssc.data_set_number(data, 'rotor_di', 3.7)
ssc.data_set_number(data, 'shear', 0.14)
ssc.data_set_number(data, 'turbul', 0.1)
ssc.data_set_array(data, 'wt_x', [0])
ssc.data_set_array(data, 'wt_y', [0])
ssc.data_set_number(data, 'wake_model', 0)
ssc.data_set_number(data, 'model_choice', 0)
# Took wind model Weibull parameter from here: http://www.wind-power-program.com/wind_statistics.htm
ssc.data_set_number(data, 'weibullK', 2)
ssc.data_set_number(data, 'max_cp', 0.45)
ssc.data_set_number(data, 'resource_class', 0.45)
hub_efficiency = [
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
]
ssc.data_set_array(data, 'hub_efficiency', hub_efficiency)

# run wind system simulation
mod = ssc.module_create("windpower")
ssc.module_exec(mod, data)
ann = 0
ac = ssc.data_get_array(data, "farmpwr")
for i in range(len(ac)):
    ann += ac[i]
print 'WindWatts Simulation ok, e_net (annual kW)=', ann
Esempio n. 6
0
from sscapi import PySSC

# setup inputs
ssc = PySSC()
dat = ssc.data_create()
ssc.data_set_string(dat, "file_name", "daggett.tm2")
ssc.data_set_number(dat, "system_size", 4)
ssc.data_set_number(dat, "derate", 0.77)
ssc.data_set_number(dat, "track_mode", 0)
ssc.data_set_number(dat, "azimuth", 180)
ssc.data_set_number(dat, "tilt_eq_lat", 1)
ssc.data_set_array(dat, "shading_hourly", [0.9 for x in range(0,8760)])

# run PV system simulation
mod = ssc.module_create("pvwattsv1")
ssc.module_exec(mod, dat)

# print results
ann = 0
ac = ssc.data_get_array(dat, "ac")
for i in range(len(ac)):
	ac[i] = ac[i]/1000
	ann += ac[i]
print "PVWatts V1 Simulation ok, e_net (annual kW)=", ann
Esempio n. 7
0
def sam_simulation(nsrdb_data, meta=None, verbose=False, **kwargs):
    """SAM solar PV simulation

    Perform a PVWATTS5 simulation using some input information about the
    solar plant.

    Parameters
    ----------
        weather (pd.DataFrame): Solar radiation dataframe
        meta (pd.DataFrame): NSRDB metadata
        kwargs (dictionary): Dictionary containing simulation parameters

    Returns
    ----------
        CF (float): Capacity factor
        Generation (float): Generation over the year of simulation
        meto_data (pd.DataFrame): Dataframe with hourly generation
    """

    params = {
        "lat": kwargs["lat"],
        "lng": kwargs["lon"],
        "system_capacity": kwargs["system_capacity"],
        "dc_ac_ratio": kwargs["dc_ac_ratio"],
        "inv_eff": kwargs["inv_eff"],
        "losses": kwargs["losses"],
        "tilt": kwargs["tilt"],
        "gcr": kwargs["gcr"],
        "azimuth": kwargs["azimuth"],
        "interval": kwargs["interval"],
    }
    if verbose:
        print({key: value for key, value in params.items()})

    # Start sscapi module
    ssc = PySSC()
    weather_data = ssc.data_create()
    valid_keys = [
        "lat",
        "lon",
        "tz",
        "elev",
    ]
    for key, value in kwargs.items():
        bytestr = key.encode()  # Convert string to byte to read it on C
        if key in valid_keys:
            ssc.data_set_number(weather_data, bytestr, value)
    # Set tilt of system in degrees
    ssc.data_set_array(weather_data, b"year", nsrdb_data.index.year)
    ssc.data_set_array(weather_data, b"month", nsrdb_data.index.month)
    ssc.data_set_array(weather_data, b"day", nsrdb_data.index.day)
    ssc.data_set_array(weather_data, b"hour", nsrdb_data.index.hour)
    ssc.data_set_array(weather_data, b"minute", nsrdb_data.index.minute)
    ssc.data_set_array(weather_data, b"dn", nsrdb_data["DNI"])
    ssc.data_set_array(weather_data, b"df", nsrdb_data["DHI"])
    ssc.data_set_array(weather_data, b"wspd", nsrdb_data["Wind Speed"])
    ssc.data_set_array(weather_data, b"tdry", nsrdb_data["Temperature"])

    # Create SAM compliant object
    sam_data = ssc.data_create()
    ssc.data_set_table(sam_data, b"solar_resource_data", weather_data)
    ssc.data_free(weather_data)
    valid_keys = [
        "system_capacity",  # kW
        "dc_ac_ratio",
        "array_type",
        "inv_eff",
        "losses",
        "gcr",
        "tilt",
        "azimuth",
        "interval",
        "adjust:constant",
    ]
    for key, value in kwargs.items():
        bytestr = key.encode()  # Convert string to byte to read it on C
        if key in valid_keys:
            ssc.data_set_number(sam_data, bytestr, value)
    if kwargs["model"] == "pvwattsv7" and "module_type" in kwargs:
        ssc.data_set_number(sam_data, b"module_type",
                            kwargs.get("module_type", 0))
    mod = ssc.module_create(kwargs.get("model").encode())

    ssc.module_exec(mod, sam_data)

    nsrdb_data["ac_generation_W"] = np.array(
        ssc.data_get_array(sam_data, b"ac"))
    nsrdb_data["dc_generation_W"] = np.array(
        ssc.data_get_array(sam_data, b"dc"))
    nsrdb_data["dc_capacity_factor"] = (nsrdb_data["dc_generation_W"] *
                                        1e3) / kwargs["system_capacity"]
    nsrdb_data["POA"] = np.array(ssc.data_get_array(sam_data, b"poa"))

    # Module temperature in ºC
    nsrdb_data["TCell"] = np.array(ssc.data_get_array(sam_data, b"tcell"))

    # free the memory
    ssc.data_free(sam_data)
    ssc.module_free(mod)

    return nsrdb_data
Esempio n. 8
0
ssc.data_set_number(dat, "eta_ref", 0.17)						#Desgin conversion efficiency	%
ssc.data_set_number(dat, "q_sby_frac", 0.2)						#% thermal power for standby mode	%
ssc.data_set_number(dat, "startup_frac", 0.2)					#% thermal power for startup	%
ssc.data_set_number(dat, "startup_time", 1)						#Hours to start power block	hours
ssc.data_set_number(dat, "pb_bd_frac", 0.1)						#Blowdown steam fraction	%
ssc.data_set_number(dat, "T_amb_des", 15)						#Design ambient temperature	C
ssc.data_set_number(dat, "CT", 1)								#Condenser type (Wet, Dry,Hybrid)	(1-3)		INTEGER
ssc.data_set_number(dat, "dT_cw_ref", 10)						#Design condenser cooling water inlet/outlet T diff	C
ssc.data_set_number(dat, "T_approach", 5)						#Approach Temperature	C
ssc.data_set_number(dat, "T_ITD_des", 16)						#Design ITD for dry system	C
ssc.data_set_number(dat, "P_cond_ratio", 1.0028)				#Condenser pressure ratio
ssc.data_set_number(dat, "P_cond_min", 1.25)					#Minimum condenser pressure	in Hg
ssc.data_set_number(dat, "hr_pl_nlev", 0)						## part-load increments	(0-9)		INTEGER
ssc.data_set_number(dat, "hc_ctl1", 0)							#HC Control 1
ssc.data_set_number(dat, "hc_ctl2", 0)							#HC Control 2
ssc.data_set_number(dat, "hc_ctl3", 0)							#HC Control 3
ssc.data_set_number(dat, "hc_ctl4", 0)							#HC Control 4
ssc.data_set_number(dat, "hc_ctl5", 0)							#HC Control 5
ssc.data_set_number(dat, "hc_ctl6", 0)							#HC Control 6
ssc.data_set_number(dat, "hc_ctl7", 0)							#HC Control 7
ssc.data_set_number(dat, "hc_ctl8", 0)							#HC Control 8
ssc.data_set_number(dat, "hc_ctl9", 0)							#HC Control 9
ssc.data_set_string(dat, "hybrid_dispatch_schedule", '1'*288)	#Daily dispatch schedule	TOUSCHED

# run PV system simulation
mod = ssc.module_create("geothermal")
ssc.module_exec(mod, dat)

# print results
ac = ssc.data_get_array(dat, "monthly_power")
print "Monthly Power", ac
Esempio n. 9
0
ssc.data_set_number(dat, "pb_bd_frac", 0.1)  #Blowdown steam fraction	%
ssc.data_set_number(dat, "T_amb_des", 15)  #Design ambient temperature	C
ssc.data_set_number(dat, "CT",
                    1)  #Condenser type (Wet, Dry,Hybrid)	(1-3)		INTEGER
ssc.data_set_number(dat, "dT_cw_ref",
                    10)  #Design condenser cooling water inlet/outlet T diff	C
ssc.data_set_number(dat, "T_approach", 5)  #Approach Temperature	C
ssc.data_set_number(dat, "T_ITD_des", 16)  #Design ITD for dry system	C
ssc.data_set_number(dat, "P_cond_ratio", 1.0028)  #Condenser pressure ratio
ssc.data_set_number(dat, "P_cond_min", 1.25)  #Minimum condenser pressure	in Hg
ssc.data_set_number(dat, "hr_pl_nlev",
                    0)  ## part-load increments	(0-9)		INTEGER
ssc.data_set_number(dat, "hc_ctl1", 0)  #HC Control 1
ssc.data_set_number(dat, "hc_ctl2", 0)  #HC Control 2
ssc.data_set_number(dat, "hc_ctl3", 0)  #HC Control 3
ssc.data_set_number(dat, "hc_ctl4", 0)  #HC Control 4
ssc.data_set_number(dat, "hc_ctl5", 0)  #HC Control 5
ssc.data_set_number(dat, "hc_ctl6", 0)  #HC Control 6
ssc.data_set_number(dat, "hc_ctl7", 0)  #HC Control 7
ssc.data_set_number(dat, "hc_ctl8", 0)  #HC Control 8
ssc.data_set_number(dat, "hc_ctl9", 0)  #HC Control 9
ssc.data_set_string(dat, "hybrid_dispatch_schedule",
                    '1' * 288)  #Daily dispatch schedule	TOUSCHED

# run PV system simulation
mod = ssc.module_create("geothermal")
ssc.module_exec(mod, dat)

# print results
ac = ssc.data_get_array(dat, "monthly_power")
print "Monthly Power", ac