Change MassMatricDAE splitting of algebraic states and differential states - #259
Open
williampiat3 wants to merge 8 commits into
Open
williampiat3 wants to merge 8 commits into
williampiat3 wants to merge 8 commits into
Conversation
Added handling for differential and algebraic equations in the mass matrix.
Author
|
I read the Contributing.md but a PR allows to have a code change to illustrate and discuss. |
Added test for nonsymmetric singular mass matrix in MassMatrixDAE.
Author
|
There was an error in the test but actually it was normal since this was a case that I wanted MassMatrixDAE to handle (having a non symmetric and singular "mass" matrix) |
Refactor mass matrix handling to use pseudoinverse for rectangular systems and streamline Jacobian calculations.
Refactor mass matrix solver to use SVD for stability.
Author
|
Tests are passing now locally |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I am trying to use MassMatrixDAE in a collaborative effort to make this PR: pathsim/pathsim-rf#6
We ran into an issue: MassMatrixDAE separates the algebraic states and the differential states by checking the presence of differential terms in the rows of the system M.
However this is essentially incorrect: rows in M describe the equations, columns describe state coefficients. Therefore in order to identify differential variables one needs to check the presence of terms following the columns.
Our system M is essentially non symmetric this is why this issue happened, usually Mass Matrices are symmetric making dealing with rows and columns the same
As far as I have seen lu_factor and lu_solve can handle the rectangular case, we will see soon if it breaks the tests ^^
Changes
handle differently rows and columns to split correctly differential states and algebraic states
Test plan