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
Refactor network data #6
Conversation
When i run the branch against our PowerDynamics example i get this error:
|
Ok, i fixed the above error myself by adding a "using SparseArrays" to NetworkStructures.jl
Before the refactoring the code handled the case of the mass_matrix being Nothing. This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the refactoring makes much sense and looks good to me in general!
We need to fix the above error though.
I also was wondering why you changed:
dim_nd = sum(dim_e) + sum(dim_v)
to:
dim_nd = sum(dim_v)
in
function network_dynamics(vertices!::Array{ODEVertex}, edges!::Array{ODEEdge}, graph)
Shouldn't the total dimension include the dynamic edge variables?
And one additional note: The DDE parts still use the old code path not the refactored version.
First one is a breaking API change. Before we had the incorrect default of mass_matrix=nothing, the correct default is mass_matrix=I, if you were passing mass_matrix=nothing manually this needs to be adjusted. Second one is a copy paste bug. I will add a test for this. |
After adding a few more fixes our PowerDynamic examples are running again using this branch. |
This is a big refactor in preparation for work on adding more Type awareness to the system. Some of the old API that I believe we never used is deprecated in this version. The internal structure now relies on the Vertex|EdgeFunction types directly, and the network dynamics retains the full information in its internal fields.
All the logic for calculating the indices, etc, that was duplicated all over the place now has a clear place, the indices and internal variables were combined into a struct that lives in NetworkStructures
The tests work, but they are rather limited. Could you please check if your branch of PowerDynamics works against this? Also happy to hear about what you think about the design as such.