Ejemplo n.º 1
0
from sympy import Eq

from commons import feedback, cascade, H2, G5, G1, H1, S, C2, G2, G3, G4, N, C1, R2, R1, render_exper, R, C, summing_junction

q31 = feedback(G1, H1, negative=False)
render_exper(q31, "q31")

q32 = summing_junction(cascade(1 + G1, q31, G1),
                       G1).simplify(numer=True, denom=True).expand(numer=True,
                                                                   denom=True)
render_exper(q32, "q32")

q33 = feedback(cascade(q32, G1), H1,
               negative=True).simplify(numer=True,
                                       denom=True).expand(numer=True,
                                                          denom=True)
render_exper(q33, "q33")

q34 = cascade(G1, q33).simplify(numer=True, denom=True).expand(numer=True,
                                                               denom=True)
render_exper(Eq(C / R, q34), "q34")
Ejemplo n.º 2
0
from sympy import Eq

from commons import feedback, cascade, G1, C2, G2, G3, G4, C1, R2, R1, render_exper

feedback_exp = feedback(G1, cascade(G2, G3, G4), negative=True)
KOM61 = Eq(C1 / R1, feedback_exp)
render_exper(KOM61, "KOM61")

feedback_exp = feedback(-cascade(G1, G3, G4), G2, negative=False)
KOM62 = Eq(C1 / R2, feedback_exp)
render_exper(KOM62, "KOM62")

KOM65 = Eq(KOM61.lhs + KOM62.lhs,
           KOM61.rhs + KOM62.rhs).simplify(numer=True,
                                           denom=True).expand(numer=True,
                                                              denom=True)
render_exper(KOM65, "KOM65")

feedback_exp = feedback(cascade(G1, G2, G4), G3, negative=True)
KOM63 = Eq(C2 / R1, feedback_exp)
render_exper(KOM63, "KOM63")

feedback_exp = feedback(G4, -cascade(G1, G2, G3), negative=False)
KOM64 = Eq(C2 / R2, feedback_exp)
render_exper(KOM64, "KOM64")

KOM66 = Eq(KOM63.lhs + KOM64.lhs,
           KOM63.rhs + KOM64.rhs).simplify(numer=True,
                                           denom=True).expand(numer=True,
                                                              denom=True)
render_exper(KOM66, "KOM66")
Ejemplo n.º 3
0
from sympy import Eq, symbols

from commons import feedback, cascade, H2, H, G5, G1, H1, S, C2, G2, G3, G4, N, C1, R2, R1, render_exper, R, C, summing_junction

q11 = feedback(G5, H, negative=True).simplify(numer=True, denom=True).expand(numer=True, denom=True)
render_exper(q11, "q11")

q12 = feedback(cascade(q11, G4), H / G5, negative=True).simplify(numer=True, denom=True).expand(numer=True, denom=True)
render_exper(q12, "q12")

q13 = feedback(cascade(q12, G3 * (G1 + G2)), 1, negative=True).simplify(numer=True, denom=True).expand(numer=True, denom=True)
render_exper(q13, "q13")

K = symbols("K")
q14 = (K * q13).simplify(numer=True, denom=True).expand(numer=True, denom=True)

render_exper(Eq(C / R, q14), "q14")
Ejemplo n.º 4
0
from commons import summing_junction, feedback, cascade, G2, H2, H1, G3, G4, G1, render_exper

right = summing_junction(G3, G4 / G2)
temp1 = feedback(G1, H1, negative=False)

left = feedback(cascade(temp1, G2), H2)

tf = cascade(left, right).expand().simplify().expand(numer=True)

render_exper(tf)
Ejemplo n.º 5
0
from sympy import Eq

from commons import feedback, cascade, H2, G5, G1, H1, S, C2, G2, G3, G4, N, C1, R2, R1, render_exper, R, C, summing_junction

q21 = feedback(G1, H1, negative=False)
render_exper(q21, "q21")

q22 = feedback(q21, cascade(G2, H2),
               negative=True).simplify(numer=True,
                                       denom=True).expand(numer=True,
                                                          denom=True)
render_exper(q22, "q22")

q23 = cascade(q22,
              G4 + cascade(G2, G3)).simplify(numer=True,
                                             denom=True).expand(numer=True,
                                                                denom=True)
render_exper(Eq(C / R, q23), "q23")
Ejemplo n.º 6
0
from sympy import Eq

from commons import feedback, cascade, H2, G5, G1, H1, S, C2, G2, G3, G4, N, C1, R2, R1, render_exper, R, C, summing_junction

q52 = feedback(G1, H1, negative=True)
render_exper(q52, "q52")

q51 = feedback(G4, H2, negative=True)
render_exper(q51, "q51")

forward = cascade(G5, q51, G2 + G3, q52)
q53 = feedback(forward, 1, negative=True)
render_exper(Eq(C / R, q53), "q53")

render_exper(
    Eq(C / R, q53).simplify(numer=True, denom=True).expand(numer=True,
                                                           denom=True),
    "q53expanded")
Ejemplo n.º 7
0
nested = B1 + B2 * (B1 + B2 * (B1 + B2 * (B1 + B2 * (B1 + B2 *
                                                     (B1 + B2 *
                                                      (B1 + B2 *
                                                       (B1 + B2 *
                                                        (B1 + B2 *
                                                         (B1 + B2 * B3)))))))))
#nested = B1 + B2 * (B1 + B2 * (B1 + B2 ))
print(latex(nested))
render_exper(nested, "C_over_E", mul_symbol="", reverse=False)
exit()

kom71 = feedback((10 / (S * (S + 1))).expand(), .5 * S, negative=True)
kom71 = kom71.simplify(numer=True, denom=True).expand(numer=True, denom=True)
render_exper(kom71, "KOM71", mul_symbol="", reverse=False)

kom72 = (cascade(kom71, (S + 4))).simplify(numer=True, denom=True).expand(
    numer=True, denom=True).expand(numer=True)
render_exper(kom72, "KOM72", mul_symbol="", reverse=False)

kom73 = feedback(kom72.expand(), 1,
                 negative=True).simplify(numer=True,
                                         denom=True).expand(numer=True,
                                                            denom=True)
render_exper(kom73, "kom73", mul_symbol="", reverse=False)

kom74 = cascade(1 + (3 / (S + 4)), kom73)
eq = Eq(C / R,
        kom74).simplify(numer=True,
                        denom=True).expand(numer=True,
                                           denom=True).simplify(numer=True,
                                                                denom=True)
Ejemplo n.º 8
0
from sympy import Eq

from commons import feedback, cascade, H2, G5, K, K1, K2, K3, G1, H1, S, C2, G2, G3, G4, N, C1, R2, R1, render_exper, R, C, summing_junction

q41 = feedback(G3, H1, negative=True).simplify(numer=True,
                                               denom=True).expand(numer=True,
                                                                  denom=True)

render_exper(q41, "q41")

q42 = feedback(cascade(q41, K3), 1,
               negative=False).simplify(numer=True,
                                        denom=True).expand(numer=True,
                                                           denom=True)

render_exper(q42, "q42")

q43 = feedback(cascade(q42, K2 + G2 / K3, G1), K1,
               negative=True).simplify(numer=True,
                                       denom=True).expand(numer=True,
                                                          denom=True)

render_exper(q43, "q43")

q44 = feedback(q43, H1, negative=True).simplify(numer=True,
                                                denom=True).expand(numer=True,
                                                                   denom=True)

render_exper(Eq(C / R, q44), "q43")