我目前正在研究一种算法来确定风力涡轮机支撑结构的成本。我写的算法需要优化初始输入支撑结构的重量,这样应力水平不会超过,而是接近所用材料性能的失效标准。另一个要求是结构的固有频率需要限定在2个值之间。为了优化结构,可以改变4个变量。在
我可以使用斯皮比。优化使用几个设计参数优化结构重量的库,但同时考虑了支撑结构的固有频率和最大应力值?在
我正在优化的函数如下所示:
def func(self, x):
self.properties.D_mp = x[0] # Set a new diameter for the monopile
self.properties.Dtrat_tower = x[1] # Set a new thickness ratio for the tower
self.properties.Dtrat_tp = x[2] # Set a new thickness ratio for the transition piece
self.properties.Dtrat_mud = x[3] # Set a new thickness ratio for the mudline region of the monopile
self.UpdateAll() # Update the support structure based on the changes in variables above
eig = self.GetEigenFrequency() # Get the natural frequency
maxUtil = self.GetMaximumUtilisationFactor() # Get the maximum utilisation ratio on the structure (more than 1 means stress is higher than maximum allowed)
# Natural frequency of 0.25 and utilisation ratio of 1 are ideal
# Create some penalty...
penalty = (100000 * abs((eig - 0.25)))
penalty += (100000 * abs(maxUtil - 1))
return self.GetTotalMass() + penalty
提前谢谢!在
通过折叠频率和压力约束作为对整体适应度的惩罚,使这成为一个单值优化问题可能是最简单的,比如
。。。当然,你会想找到更合适的惩罚函数和使用相对权重,但这应该给你一个大概的想法。然后你就可以把它最大化
^{pr2}$(使用lambda可以让fmin(一个最小值)找到一个最大值,以获得整体拟合度)。在
或者,
fmin
允许在每次迭代后应用回调函数;如果您知道如何适当地调整a、b、c、d,可以使用它来对频率施加硬限制,比如您可以使用的leatsq函数辛辣。优化. 在
在我的例子中,它是用两个变量拟合指数函数:
但是要使用leatsq函数,你需要创建一个error函数,这个函数需要优化。在
^{pr2}$要使用它:
因此,返回最佳参数,以生成结果:
我希望这对你有帮助
克里斯。在
相关问题 更多 >
编程相关推荐