Skip to content
Snippets Groups Projects

add PowerCtXr and update WindTurbines.ipynb and ChangeLog.ipynb

Merged Mads M. Pedersen requested to merge update_doc into master
1 file
+ 9
5
Compare changes
  • Side-by-side
  • Inline
@@ -174,9 +174,13 @@ def get_continuous_curve(key, optional):
@@ -174,9 +174,13 @@ def get_continuous_curve(key, optional):
tab_powerct_curve = PowerCtTabular(ws=u_p, power=p, power_unit='w', ct=ct)
tab_powerct_curve = PowerCtTabular(ws=u_p, power=p, power_unit='w', ct=ct)
def _power_ct(ws, **kwargs):
def _power_ct(ws, **kwargs):
v = kwargs.pop(key)
try:
if optional and v is None:
v = kwargs.pop(key)
v = 1
except KeyError:
 
if optional:
 
v = 1
 
else:
 
raise
return (np.asarray(tab_powerct_curve(ws)).T * np.array([v, np.ones_like(v)]).T).T
return (np.asarray(tab_powerct_curve(ws)).T * np.array([v, np.ones_like(v)]).T).T
oi = [key] if optional else []
oi = [key] if optional else []
return PowerCtFunction(['ws', key], _power_ct, 'w', optional_inputs=oi)
return PowerCtFunction(['ws', key], _power_ct, 'w', optional_inputs=oi)
@@ -186,7 +190,7 @@ def test_continuous():
@@ -186,7 +190,7 @@ def test_continuous():
curve = get_continuous_curve('boost', True)
curve = get_continuous_curve('boost', True)
u = np.arange(0, 30, .1)
u = np.arange(0, 30, .1)
p0, ct0 = curve(u, boost=None)
p0, ct0 = curve(u)
p1, ct1 = curve(u, boost=1.1)
p1, ct1 = curve(u, boost=1.1)
p2, ct2 = curve(u, boost=1.1, Air_density=1.3)
p2, ct2 = curve(u, boost=1.1, Air_density=1.3)
@@ -214,7 +218,7 @@ def test_PowerCtXr():
@@ -214,7 +218,7 @@ def test_PowerCtXr():
u_p, p_c = np.asarray(hornsrev1.power_curve).T.copy()
u_p, p_c = np.asarray(hornsrev1.power_curve).T.copy()
ct_c = hornsrev1.ct_curve[:, 1]
ct_c = hornsrev1.ct_curve[:, 1]
ds = xr.Dataset(
ds = xr.Dataset(
data_vars={'power': (['ws' 'boost'], np.array([p_c, p_c * 1.1]).T),
data_vars={'power': (['ws', 'boost'], np.array([p_c, p_c * 1.1]).T),
'ct': (['ws', 'boost'], np.array([ct_c, ct_c * 1.1]).T)},
'ct': (['ws', 'boost'], np.array([ct_c, ct_c * 1.1]).T)},
coords={'boost': [0, 10], 'ws': u_p})
coords={'boost': [0, 10], 'ws': u_p})
curve = PowerCtXr(ds, 'w')
curve = PowerCtXr(ds, 'w')
Loading