{"action":"created","issue":{"url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/issues/158","repository_url":"https://api.github.com/repos/WEC-Sim/WEC-Sim","labels_url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/issues/158/comments","events_url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/issues/158/events","html_url":"https://github.com/WEC-Sim/WEC-Sim/issues/158","id":206568498,"number":158,"title":"Porting to plain Matlab: What does B2B block do exactly?","user":{"login":"crobarcro","id":3159692,"avatar_url":"https://avatars1.githubusercontent.com/u/3159692?v=3","gravatar_id":"","url":"https://api.github.com/users/crobarcro","html_url":"https://github.com/crobarcro","followers_url":"https://api.github.com/users/crobarcro/followers","following_url":"https://api.github.com/users/crobarcro/following{/other_user}","gists_url":"https://api.github.com/users/crobarcro/gists{/gist_id}","starred_url":"https://api.github.com/users/crobarcro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crobarcro/subscriptions","organizations_url":"https://api.github.com/users/crobarcro/orgs","repos_url":"https://api.github.com/users/crobarcro/repos","events_url":"https://api.github.com/users/crobarcro/events{/privacy}","received_events_url":"https://api.github.com/users/crobarcro/received_events","type":"User","site_admin":false},"labels":[{"id":603876767,"url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/labels/B2B","name":"B2B","color":"bfdadc","default":false},{"id":104239749,"url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2017-02-09T17:13:07Z","updated_at":"2017-05-18T15:34:45Z","closed_at":"2017-05-18T15:34:19Z","body":"Hello,\r\n\r\nI'm porting WEC-Sim to use only plain matlab for the calculation of forces, and using MBDyn for the multibody dynamics. You can see the current status of this work [here](https://sourceforge.net/p/rnfoundry/hgrepo/ci/default/tree/wave/matlab-octave/wec-sim/). I'm essentially extending the bodyClass to also include methods for calculation of the dynamic forces. I copied the bodyClass to a new class hydrobody which has the extra methods. I've also had to tweak the simulationClass for this which isn't uploaded anywhere yet.\r\n\r\nI am working my way through making sure the force results match WEC-Sim (I'm using the RM3 example as a reference at this stage) but am having some trouble with the added mass forces, and am hoping you could clarify a couple of things for me. \r\n\r\nIn my Matlab code, to calculate the added mass I have the following:\r\n\r\n`F_addedmass = body.hydroForce.fAddedMass * accel(:);`\r\n\r\nI haven't yet applied the equivalent of the transport delay.\r\n\r\nwhere `accel` is a (6 x n) matrix (when doing body to body interactions), and therefore `accel(:)` is a (6*n x 1) column vector, which appears to be the right format. The issue is that I cannot get the right forces with this. When I compare the forces ffrom simulink (before post-processing) the forces for the first body are correct (match the original WEC-Sim output) but for body 2 are very slightly different. \r\n\r\nIf i then do the post-processing like:\r\n\r\n```\r\nfor iBod = 1:simu.numWecBodies\r\n    body(iBod).restoreMassMatrix\r\n    output.bodies(iBod).forceTotal = output.bodies(iBod).forceTotal + output.bodies(iBod).forceAddedMass;\r\n    output.bodies(iBod).forceAddedMass = body(iBod).forceAddedMass(output.bodies(iBod).acceleration,simu.b2b);\r\n    output.bodies(iBod).forceTotal = output.bodies(iBod).forceTotal - output.bodies(iBod).forceAddedMass;\r\nend; clear iBod\r\n```\r\nThe forces are then all wrong (scaled up too much). Is there anything obvious I might be missing here?\r\n\r\nMy other question is, what is the purpose of the transport delay on the accelerations for the added mass calc?\r\n"},"comment":{"url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/issues/comments/302442240","html_url":"https://github.com/WEC-Sim/WEC-Sim/issues/158#issuecomment-302442240","issue_url":"https://api.github.com/repos/WEC-Sim/WEC-Sim/issues/158","id":302442240,"user":{"login":"kmruehl","id":4603379,"avatar_url":"https://avatars2.githubusercontent.com/u/4603379?v=3","gravatar_id":"","url":"https://api.github.com/users/kmruehl","html_url":"https://github.com/kmruehl","followers_url":"https://api.github.com/users/kmruehl/followers","following_url":"https://api.github.com/users/kmruehl/following{/other_user}","gists_url":"https://api.github.com/users/kmruehl/gists{/gist_id}","starred_url":"https://api.github.com/users/kmruehl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmruehl/subscriptions","organizations_url":"https://api.github.com/users/kmruehl/orgs","repos_url":"https://api.github.com/users/kmruehl/repos","events_url":"https://api.github.com/users/kmruehl/events{/privacy}","received_events_url":"https://api.github.com/users/kmruehl/received_events","type":"User","site_admin":false},"created_at":"2017-05-18T15:34:45Z","updated_at":"2017-05-18T15:34:45Z","body":"@10472008 does this resolve the discrepancy? "}}
{"actor":{"display_login":"kmruehl"}}