ENع
→Mason's rule
الدرس S1 · Special topics

Signal-flow graphs and Mason's gain rule

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

18 دقيقة11 خطوة5 أسئلةIntermediate
عن هذا الدرس

A signal-flow graph draws a system as nodes (signals) and arrows (gains). Mason's gain rule reads the transfer function straight off the graph, with no redrawing: find the forward paths, the loops and which loops touch, then T = Σ PₖΔₖ/Δ. Follow a token round every path and loop of one graph to get T(s) = (s + 2)/(s² + 3s + 3), then check it against a node-by-node simulation.

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل S1 · تفاعلي
01 / 11

Dots and arrows, not boxes

A signal-flow graph draws a system as dots and arrows. Each dot, called a node, is a signal. Each arrow, called a branch, multiplies its signal by the gain written on it. We want one answer: T = Y/R.

node     a signal (R, x₁ … x₄, Y)
branch   an arrow with a gain:
         head signal = gain × tail signal

this graph   6 nodes, 9 branches
goal         T(s) = Y(s)/R(s)

The same system as a block diagram:
two lags 1/(s + 1) and 1/(s + 2) in a row,
a feedforward from R into the second,
all inside unity negative feedback.
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. Dots and arrows, not boxes

    A signal-flow graph draws a system as dots and arrows. Each dot, called a node, is a signal. Each arrow, called a branch, multiplies its signal by the gain written on it. We want one answer: T = Y/R.

    node     a signal (R, x₁ … x₄, Y)
    branch   an arrow with a gain:
             head signal = gain × tail signal
    
    this graph   6 nodes, 9 branches
    goal         T(s) = Y(s)/R(s)
    
    The same system as a block diagram:
    two lags 1/(s + 1) and 1/(s + 2) in a row,
    a feedforward from R into the second,
    all inside unity negative feedback.
  2. A node adds what flows in

    A node's value is the sum of the signals arriving on its arrows. Node x₁ receives R × 1, x₂ × (−1) and Y × (−1), so x₁ = R − x₂ − Y. Arrows leaving a node copy its value; they never change it.

    x₁ = 1·R + (−1)·x₂ + (−1)·Y
    x₂ = (1/s)·x₁
    x₃ = 1·x₂ + 1·R + (−2)·x₄
    x₄ = (1/s)·x₃
    Y  = 1·x₄
    
    A summing junction and a pickoff point
    are both just a node here.
  3. Forward path P₁

    A forward path runs from input to output, visiting no node twice. Its gain is the product of its branch gains. The main path gives P₁ = 1 × 1/s × 1 × 1/s × 1 = 1/s².

    P₁  R → x₁ → x₂ → x₃ → x₄ → Y
        = 1 × 1/s × 1 × 1/s × 1
        = 1/s²
  4. A shortcut makes path P₂

    The branch R → x₃ skips ahead, so there is a second forward path: R → x₃ → x₄ → Y. Its gain is P₂ = 1 × 1/s × 1 = 1/s. Mason's rule uses every forward path.

    P₂  R → x₃ → x₄ → Y
        = 1 × 1/s × 1
        = 1/s
    
    forward paths found: 2
  5. Two small loops

    A loop starts at a node, follows the arrows and comes back, visiting no node twice. Its gain is the product around it. L₁ = 1/s × (−1) = −1/s. L₂ = 1/s × (−2) = −2/s.

    L₁  x₁ → x₂ → x₁
        = 1/s × (−1) = −1/s
    L₂  x₃ → x₄ → x₃
        = 1/s × (−2) = −2/s
  6. The big loop L₃

    One more loop goes all the way round, through the output and back to x₁. L₃ = 1/s × 1 × 1/s × 1 × (−1) = −1/s². That makes three loops in all.

    L₃  x₁ → x₂ → x₃ → x₄ → Y → x₁
        = 1/s × 1 × 1/s × 1 × (−1)
        = −1/s²
    
    loops found: 3
  7. Loops that don't touch

    Two loops touch if they share a node. L₁ uses x₁ and x₂; L₂ uses x₃ and x₄. They share nothing, so they are non-touching. L₃ touches both. The only non-touching pair is L₁L₂ = 2/s².

    L₁ nodes  x₁ x₂
    L₂ nodes  x₃ x₄
    L₃ nodes  x₁ x₂ x₃ x₄ Y
    
    non-touching pairs: L₁L₂ only
    L₁·L₂ = (−1/s)(−2/s) = 2/s²
    no non-touching triples
  8. The graph determinant Δ

    Δ = 1 − (sum of all loop gains) + (sum of non-touching pairs) − (non-touching triples) and so on. Here: Δ = 1 + 1/s + 2/s + 1/s² + 2/s² = 1 + 3/s + 3/s².

    Δ = 1 − (L₁ + L₂ + L₃) + L₁L₂
      = 1 − (−1/s − 2/s − 1/s²) + 2/s²
      = 1 + 1/s + 2/s + 1/s² + 2/s²
      = 1 + 3/s + 3/s²
    
    Signs alternate: odd-sized groups of
    non-touching loops subtract, even add.
  9. Each path's own Δ

    Δₖ is Δ worked out with only the loops that do not touch path k. P₁ touches all three loops, so Δ₁ = 1. P₂ misses L₁, so Δ₂ = 1 − L₁ = 1 + 1/s.

    P₁ nodes  R x₁ x₂ x₃ x₄ Y  → touches L₁ L₂ L₃
              Δ₁ = 1
    P₂ nodes  R x₃ x₄ Y        → misses L₁
              Δ₂ = 1 − L₁ = 1 + 1/s
  10. Mason's gain rule

    T = (P₁Δ₁ + P₂Δ₂)/Δ = (1/s + 2/s²)/(1 + 3/s + 3/s²). Multiply top and bottom by s²: T(s) = (s + 2)/(s² + 3s + 3). One formula, no redrawing.

    T = Σ Pₖ Δₖ / Δ
      = (1/s²·1 + 1/s·(1 + 1/s)) / Δ
      = (1/s + 2/s²) / (1 + 3/s + 3/s²)
      = (s + 2)/(s² + 3s + 3)
    
    def mul(a, b):  # polynomials in q = 1/s, lowest power first
        out = [0] * (len(a) + len(b) - 1)
        for i, x in enumerate(a):
            for j, y in enumerate(b):
                out[i + j] += x * y
        return out
    def add(*ps):
        n = max(len(p) for p in ps)
        return [sum(p[i] for p in ps if i < len(p)) for i in range(n)]
    neg = lambda p: [-x for x in p]
    
    L1, L2, L3 = [0, -1], [0, -2], [0, 0, -1]  # loop gains
    P1, P2 = [0, 0, 1], [0, 1]                 # forward paths
    D = add([1], neg(add(L1, L2, L3)), mul(L1, L2))  # L1, L2 don't touch
    D1, D2 = [1], add([1], neg(L1))            # P2 misses L1
    num = add(mul(P1, D1), mul(P2, D2))
    print(num, D)  # [0, 1, 2] [1, 3, 3]
  11. Check it with a step

    Push a unit step into R. Simulating the graph node by node and simulating T(s) draw the same curve. It settles at T(0) = 2/3, the value of T(s) at s = 0.

    T(0) = 2/3   → the output ends at 0.667
    poles  s = −1.5 ± 0.87j
    
    y(t) = 2/3 − (2/3)·e^(−1.5t)·cos(0.87 t)
    
    import math
    w = math.sqrt(3) / 2
    y = lambda t: 2/3 - 2/3 * math.exp(-1.5 * t) * math.cos(w * t)
    print(round(y(1), 3), round(y(2), 3), round(y(6), 3))  # 0.57 0.672 0.667

اختبار يتاح بعد الخطوة الأخيرة.