Skip to content

Change MassMatricDAE splitting of algebraic states and differential states - #259

Open
williampiat3 wants to merge 8 commits into
pathsim:masterfrom
williampiat3:master
Open

williampiat3 wants to merge 8 commits into
pathsim:masterfrom
williampiat3:master

Conversation

@williampiat3

@williampiat3 williampiat3 commented Oct 2, 2026 •

Copy link
Copy Markdown

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

  • Add a non symetric test to the test list

@williampiat3 williampiat3 changed the title Change MassMatricDAE splitting of algebraic varaibles and differential variable Change MassMatricDAE splitting of algebraic states and differential states Oct 2, 2026
@williampiat3

Copy link
Copy Markdown
Author

I read the Contributing.md but a PR allows to have a code change to illustrate and discuss.
I am aware this might need similar changes in other libraries such as FastSim

Added test for nonsymmetric singular mass matrix in MassMatrixDAE.
@williampiat3

Copy link
Copy Markdown
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)
If it works we should probably rename the class since its scope would be larger than handling 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.
@williampiat3

Copy link
Copy Markdown
Author

Tests are passing now locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant