Aug-10-2020, 10:29 AM
Hi , I've used the sp.solveset function to calculate a variable.
so solveset gives me a value of 11.34.. for b . I then want to use b as 11.34.. in the formula for w and for the mean. This doesn't seem to be working and I'm having to input this manually.
This error is relating to mean formula
TypeError: Arguments to ProductSet should be of type Set
This error is relating to w formula
TypeError: unsupported operand type(s) for /: 'int' and 'ProductSet'
any help would be greatly appeciated.
Cheers
so solveset gives me a value of 11.34.. for b . I then want to use b as 11.34.. in the formula for w and for the mean. This doesn't seem to be working and I'm having to input this manually.
#This imports various libraries import matplotlib.pyplot as plt import numpy as np import sympy as sp from scipy.integrate import simps from numpy import trapz import math from sympy.solvers import solve V_cutin=4 #m/s Mean_windspeed=10.054113100183285 #m/s V_cutout=25 #m/s #linspace creates an array from 0-25 with 26 intervals. cutout speed+1=26 x=np.linspace(0,25,26) #print(x) #y is power results from Blade element theory, enter manually. value 26 is power at 25m/s this should be 0 as turbine is cut out. y=[0,0,0,0,0.0488,0.6955,1.6501,2.8708,4.4371,6.3941,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,8.000,0.000] #print( len(y), "= number of values in y") # this should be equal to cut out speed +1 #print(y) a=2 # weibul shape factor c=sp.symbols("c") b=sp.solveset((c*np.exp(math.lgamma(1+1/2)))-Mean_windspeed,c) #print(b) #b=11.3448517658689 #weibul shape factor , use solveset function above to determine and then manually enter here. mean=b*np.exp(math.lgamma(1+1/a)) print("The weibul scale factor is =", a) print("The weibul shape factor is =", b) print("The mean of the distribution is =", mean) w=a/b**a*x**(a-1)*np.exp(-(x/b)**a) #weibul PDF function #print(x) displays "x-axis" (wind speeds) #print(w) displays "y-axis" (probabilities)I'm unable to use the b variable and get the following errors :
This error is relating to mean formula
TypeError: Arguments to ProductSet should be of type Set

This error is relating to w formula
TypeError: unsupported operand type(s) for /: 'int' and 'ProductSet'

any help would be greatly appeciated.
Cheers