Hello, I'm reading the source code (newtonpf.m) and noticed the following lines used to indexing and updating the four "quadrants" of the J matrix according to which variables are updated depending on whether it's a PV, PQ or Ref bus: [cid:29941cfc-bf59-448b-bfcb-d1f412caaa32]
My question is, doesn't this assume the ordering of PV-PQ-Ref buses in any V, I or S vectors (that are N_BUS x 1 in size)? That is, say there are 9 buses, where 1 is Ref, 4,6,7 are PV , and 2,3,5,8,9 are PQ, then the buses would be ordered like so before this function was called: 4,6,7 2,3,5,8,9 1 (indices are sorted by bus type) (PV) (PQ) (Ref) And according to the source code it would've been 1,2,3 4,5,6,7,8, 9 (PV) (PQ) (Ref) But I didn't notice where this assumption was checked to be valid... I was thinking it should instead be: Idx_PQ = [(internal/consecutive) indices of PQ buses, sorted] Idx_PV = [... PV ...] Idx_Ref = [... Ref ...] (of course there would only be 1 element) and index as J11 = real(dSbus_dVa[all except Idx_Ref, all except Idx_Ref]), and so on for J12, J21, and J22. But if the source code was truly incorrect in this regard, surely it must have been pointed out before, so I'm thinking I made a mistake somewhere. Could you please point out where I'm wrong? Your time and help are much appreciated. Regards, Liangjie Chen