Commit 48ea0468 authored by Villez, Kris's avatar Villez, Kris
Browse files

minor mods

parent 9104bc64
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ def observability_redundancy_labelling_rref(
    enforce_integer=True,
):

    J_sym = J.copy()
    if len(x0) > 0:
        J = J.subs(x0)
    if enforce_integer and len(x0) > 0:
@@ -163,10 +164,11 @@ def observability_redundancy_labelling_rref(
    bool_measured = np.array(bool_measured).astype(bool)
    Jm = J[:, list(np.where(bool_measured)[0])]
    Ju = J[:, list(np.where(~bool_measured)[0])]
    # Jm_sym = J_sym[:, list(np.where(bool_measured)[0])]
    # Ju_sym = J_sym[:, list(np.where(~bool_measured)[0])]

    bool_observable, Ju_rref, Zero = get_observability_rref(Ju, bool_measured)


    if le_red_method:
        bool_redundant = bool_measured.copy()
        include_rows = np.any(~Zero, axis=1)
+24 −19
Original line number Diff line number Diff line
@@ -61,34 +61,39 @@ def build_pgraph(
            arc_equal_composition = [[4 - 1, 5 - 1, 6 - 1]]

    if sys_name == "ccro":
        strSystemID = "NAWI305"
        strSystemID = "NAWI503"
        incidence = np.array(
            [  # e   P1  Mx Me1 Sp1  P2
                [-1, +1, 0, 0, 0, 0],  # 1
                [0, -1, +1, 0, 0, 0],  # 2
                [0, 0, -1, +1, 0, 0],  # 3
                [+1, 0, 0, -1, 0, 0],  # 4
                [0, 0, 0, -1, +1, 0],  # 5
                [+1, 0, 0, 0, -1, 0],  # 6
                [0, 0, 0, 0, -1, +1],  # 7
                [0, 0, +1, 0, 0, -1],  # 8
            [  # e  P1  Mx  Me1 P2  Sp1 V
                [-1, +1, 0, 0, 0, 0, 0],  # 1
                [0, -1, +1, 0, 0, 0, 0],  # 2
                [0, 0, -1, +1, 0, 0, 0],  # 3
                [+1, 0, 0, -1, 0, 0, 0],  # 4
                [0, 0, 0, -1, +1, 0, 0],  # 5
                [0, 0, 0, 0, -1, +1, 0],  # 6
                [0, 0, +1, 0, 0, -1, 0],  # 7
                [0, 0, 0, 0, 0, -1, +1],  # 8
                [+1, 0, 0, 0, 0, 0, -1],  # 9
            ]
        )

        coordinates = np.array(
            [
                [2, 1],  # env
                [0, 0],  # p1
                [0.75, 0],  # mx
                [1.5, 0],  # me1
                [2, -1],  # sp1
                [1.5, -1],
                [4, 2],  # env
                [0, 0],  # P1
                [2, 0],  # mx
                [4, 0],  # me1
                [4, -2],  # P2
                [4, -4],  # sp1
                [6, 0],  # v
            ]  # p2
        )
        if arc_splitter is None:
            arc_splitter = [[5 - 1, 6 - 1, 7 - 1]]
            arc_splitter = [[6 - 1, 7 - 1, 8 - 1]]
        if arc_equal_composition is None:
            arc_equal_composition = [[1 - 1, 2 - 1], [5 - 1, 6 - 1, 7 - 1, 8 - 1]]
            arc_equal_composition = [
                [1 - 1, 2 - 1],
                [6 - 1, 7 - 1, 8 - 1, 9 - 1],
            ]

    elif sys_name == "pilot":
        incidence = np.array(
@@ -147,7 +152,7 @@ def build_pgraph(
    )

    # this is the longest step, generates the cutsets.
    pgraph.add_graph_info(verbose=5, use_networkx=True)
    pgraph.add_graph_info(verbose=5, cutset_method="connected_subgraphs")

    # save pgraph
    with open(pgraph_path, "wb") as f:
+3 −3
Original line number Diff line number Diff line
@@ -184,9 +184,9 @@ def make_layout(soar_layout, varbs_sys, ptype=1):
    type: test to be performed
    """
    # get number of pressure variables
    nmass = sum(1 for varb in varbs_sys if varb.lower().startswith("m"))
    nconc = sum(1 for varb in varbs_sys if varb.lower().startswith("x"))
    npress = sum(1 for varb in varbs_sys if varb.lower().startswith("p"))
    nmass = sum(1 for varb in varbs_sys if str(varb).lower().startswith("m"))
    nconc = sum(1 for varb in varbs_sys if str(varb).lower().startswith("x"))
    npress = sum(1 for varb in varbs_sys if str(varb).lower().startswith("p"))
    ncoeff = len(varbs_sys) - nmass - nconc - npress
    match ptype:
        case 100: