-
Notifications
You must be signed in to change notification settings - Fork 184
Fix rate transition error #799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks @akeeste for suggesting these changes and I can confirm that WECSim will run with a fixed-step solver when This is strange as you have only changed a |
|
@nathanmtom This is very strange! I reverted back to master and redid my fix to ensure nothing else changed, but this oscillation still occurs. I'll keep investigating and see if another fix does not cause this issue. |
|
@dforbush2 and @akeeste what's the status on this PR? |
|
@kmruehl Still not clear why this happens...checking if it is something related to MATLAB version, since this has not been noticed till recently. |
|
To update: Error replicated in 2020a (oldest library version), 2020b, and 2021b. Error does not occur with all fixed-step solvers: using ODE1 shows the expected results, while ode2 and ode4 show the erroneous low-frequency component. This suggests that it is a Simulink solver implementation issue and is not a product of our code. Changing the output generation at the top level as per https://www.mathworks.com/help/simulink/gui/output-times.html is NOT a robust solution because this parameter is only read for variable-step solvers and, to my investigation, cannot easily be made active for fixed-step solvers. To pursue a solution, @akeeste has contacted MathWorks. In the short term, it is recommended that any re-sampling of output data takes place in post-processing. |
|
I have received a response from Mathworks support on this issue: I only see two If blocks in our model: In response to the proposed solutions, # 1 seems like it might effect wecSimPCT though I not checked, # 2 is possible, # 3 is undesirable as we don't want to confine users to Accelerator mode. As a 4th option, we can move the if statement and ramp to a *.m function. I confirmed that this successfully works around the solver bug. The ramp is a simple enough function, but it is defined in many different places in WEC-Sim. It would be better to use a single function for all of these ramp calls, which is easiest to implement with a *.m function. Adam |
b710d66 to
2df58b4
Compare
|
I updated this branch to
|
|
@akeeste and @nathanmtom is this ready to be merged into master? |
|
@kmruehl @nathanmtom @dforbush2 This should be reviewed one more time since I implemented new changes to the library. |
|
@akeeste @kmruehl I've just reviewed these changes and can confirm that the low frequency oscillation is no longer present when running I do want to acknowledge @akeeste comment about transitioning the ramp function to a However, these does seem to be a conflict with the mooring library that needs to be resolved before merge. |
|
@nathanmtom In a different branch I have been working on combining some duplicate functions. I think I can finish implementing a ramp *.m there, but that will be after v5.0 and thanks for pointing out that conflict. The other PR causing this was just merged. I will pull those changes in next week so that we can merge this. |
|
@akeeste LMK when you've updated the Mooring library block and this is ready for a merge |




This PR resolves the issue in #793 by changing the
bustomuximmediately before each body'sToWorkspaceblock. This is the same method used in the constraint and PTO blocks.@nathanmtom Can you see if this fully resolves your issue?
@dforbush2 I couldn't quite figure out how to get the model level sample time to work correctly. I tested with the RM3 but couldn't consistently change the specified times to output. If you have any insight here I think that could be a cleaner solution.