-
Notifications
You must be signed in to change notification settings - Fork 163
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
[Theory or Implementation] Extracting State-Space Matrices #1233
Comments
Thanks for your observations. Some thoughts, The matrices you are extracting are not the same as the typical matrices. For some context, refer, To your question regarding the matrix extraction, refer the lines 769-809, on how the extracted 4D matrices ought to be reshaped, To extract the matrices, one could use the command line and exploit the protected methods in the body class shown above. Something like this, for instance,
Cheers, |
@salhus, thank you for the suggestions! I will try reshaping the matrices using this method and get back to you. To clarify: obtaining the final A, B & C matrices without running WEC-Sim requires that I implement a code similar to the image you shared that iteratively combines the intermediate matrices. Is this correct? Cheers, |
Hi @salhus. I've tried to reshape the matrices using the method shown above but am facing an issue. Consider matrix
Variable For specific DOFs, the order of this intermediate matrix is 10, meaning that the 4th index of I switched the arguments so that the matrices fit:
But this yields an incorrect matrix that does not match the WEC-Sim SS output. While I continue figuring this out, could you please help me out with 2 queries:
Thank you for the assistance! Cheers, |
Hi @ajay-menon-iitkgp Ajay, Sorry I couldn't get to back to you last week. I am guessing you have BEM data and basically need a way to estimate and easily access the final SS model after the canonical forms have been processed. Here is some code I wrote a while back that you may find helpful. You could also check out the FOAMM functionality in BEM Rosetta. Let me know if this helps. Cheers, |
Thank you for sending the code, @salhus. I'm currently on break, so I will need a week or two to test it out. I will also take a look at the FOAMM functionality and see if that simplifies the process. Good day! |
Hi @ajay-menon-iitkgp , Hope you are doing well. This issue has been open for a bit. I was wondering if you still wanted to keep this open? If not we could close this. Cheers, |
Hi @salhus. Apologies for not getting back earlier. I was finally able to resolve the issue - here's a summary of the solution. Problem: Solving Cummins equation using the SS matrices directly imported from BEMIO returned incorrect results. Reason: The BEMIO matrices are only intermediate forms that WEC-Sim manipulates before solving Cummins equation. Solution: The issue was solved by replicating the matrix manipulation performed by WEC-Sim's internal functions. Transpose each SS matrices and scale it by the water density Thank you for your help with this problem. Have a great day! Cheers, |
Thanks for the update @ajay-menon-iitkgp ! That makes sense. I am glad it is resolved. |
Hi there!
Is your question request related to a problem? Please describe.
I would like to extract specific variables from the BEMIO HDF5 output file for the RM3 device using the
h5read()
function. To keep things simple, I am directly using therm3.h5
file available as an example in WEC-Sim and am only concerned with the heave mode of the float (body 1). This extraction works for most of the variables I require but yields unexpected values for the state space matrices.Personal project context
I am extracting these variables to solve Cummins equation in Modelica using a state space approach. As matrix manipulation from a HDF5 file is rather tedious in OpenModelica, I must export the required hydro data into a '.mat' structure.
Describe the theory or implementation approach that you have a question$A$ , $B$ , $C$ , $D$ ) have a maximum order of 10 for each mode. The required order is based on an R2 threshold. For example, the RM3 float (body1) achieves this threshold with an order of 2. Since heave represents the 3rd index, the state-space $A$ matrix of body 1 in the heave mode should be $A(:,:,3,3)$ . After extracting this $10 \times 10$ matrix, I remove all the rows and columns that are entirely $0$ (to reduce the order to 2). Likewise, for the $B$ matrix, I extract a $10 \times 1$ column vector using $B(:,:,3,3)$ and then remove the rows that are $0$ . I have implemented this using the following MATLAB code block:
My understanding of WEC-Sim's implementation of the state space radiation convolution is as follows (please correct me if I am mistaken): All 4 matrices (
While the coefficients are correctly extracted, the SS matrices appear to be incorrect judging from the values. For instance, comparing the extracted matrices from BEMIO with more typical ones I would expect:
I've obtained the typical matrices for the RM3 float using an external tool. The exported BEMIO matrices share the same dimension, but the values are all over the place. Another cause for concern is that while the$D$ matrix should be $0$ to maintain the system's causality, the value extracted from BEMIO is non-zero.
Describe the type of conclusion or resolution you are looking for$D$ is non-zero) and if my MATLAB code/approach is correct.
I've reviewed the WEC-Sim documentation and past issues, but nothing stands out. I used issue #162 as the basis for my understanding and code. I would appreciate your thoughts on whether the matrices extracted from BEMIO are correct (even though
Additional context
N/A
Cheers,
Ajay
The text was updated successfully, but these errors were encountered: