Open brigittedg opened 7 months ago
Hi @brigittedg,
It sounds like you're already on the right track with your second bullet point. The way we have done this in the past is to provide a dummy x_opt
and objective function that solves immediately. x_wec
is still forced to satisfy the residual constraint, so WEC.solve()
still returns the proper dynamics of the WEC even though nothing is being optimized. Try, for example:
def obj_fun(wec, x_wec, x_opt, waves):
return np.abs(x_opt)
nstate_opt = 1
x_opt_0 = np.array([0])
results = wec.solve(
waves,
obj_fun,
nstate_opt,
x_opt_0=x_opt_0)
Setting f_add=None
is valid, so it returning an error may indicate another problem with the model.
You can set nstate_opt=0
and then use any objective function that does not depend on x_wec
. See #277. Something like this should work:
nstate_opt = 0
obj_fun = lambda wec, x_wec, x_opt, waves : 0
Action:
@michaelcdevin Thank you very much! f_add now also did not have a problem anymore.
I read this paper from professor Ringwood about a method called "nonlinear frequency domain method" instead of pseudospectral method, but I think it's the same thing just without optimizing. It seems to imply that when doing simulation without optimization, it is more efficient to solve with a nonlinear equation solver like Newton's method than it is to solve the optimization with a dummy objective. So perhaps there could be a separate simulation mode in WecOptTool that when x_opt is zero length then it uses Newton's method / another solver instead of SQP?
Hi, Before optimizing I want to simulate the dynamics of the WEC with the waves acting on it, without adding PTO force. This, to compare with results I optained using previous software, so no optimization or controller. Is there an easy way to do this?
So far using WecOptTool we have succesfully obtained the mesh, the various types of coefficients and the wave elevation spectrum.
I have tried various things so to simulate without PTO but they did not work, such as: