Skip to content

Conversation

@jleonqu
Copy link
Contributor

@jleonqu jleonqu commented Feb 27, 2023

This is a PR to solve the sign bug reported on issue #993
I have checked the equations for linear position and linear velocity. The linear velocity equation is correct, the problem was in the definition of the linear position.

@jleonqu jleonqu added Bug bug in WEC-Sim source, high priority PTO-Sim PTO-Sim (ptoSimClass.m) labels Feb 27, 2023
@jleonqu jleonqu requested a review from akeeste February 27, 2023 17:00
Copy link
Contributor

@akeeste akeeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jleonqu

I'm noting for future reference that this PR wants to change the sign of the Sum block immediately preceding the linearPos outport in PTOSim_Lib/Motion Conversion/Rotary to Linear Adjustable Rod/Angular to Linear Position.
Previous set-up:

  • linearPos = ptoSim.adjustableRod.rodInit - rod Position

Changed to:

  • linearPos = rod Position - ptoSim.adjustableRod.rodInit

The change is simple enough and makes sense to me, but I can't find a good reference on what this should be. Can you update this thread or the documentation to have the equation for the adjustable rod? Is there a way we can add a test to this part of PTO-Sim to prevent future issues?

@jleonqu
Copy link
Contributor Author

jleonqu commented Mar 14, 2023

The equation for the length of the adjustable rod is based on this figure:
image

The rod vector is:
$\vec{d_{rod}} = (rsin\theta-d_x)\hat{i}+(rcos\theta-d_{off})\hat{k}$

Then, the rod final length is:
$d_{rod} = \sqrt{(rsin\theta-d_x)^2 + (rcos\theta-d_{off})^2}$

So, the rod linear position is the final rod length minus the initial rod length:
$d_{rod,LinPos} = d_{rod} - d_{rod,ini}$

@akeeste
Copy link
Contributor

akeeste commented Mar 15, 2023

@jleonqu Thanks for adding that reference. I will merge this PR, then pull #1002 and #999 into dev

@akeeste akeeste merged commit 58601e5 into WEC-Sim:master Mar 15, 2023
akeeste added a commit that referenced this pull request Mar 15, 2023
Pull bug fixes #954, #999, #1002 from master into dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug bug in WEC-Sim source, high priority PTO-Sim PTO-Sim (ptoSimClass.m)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants