Skip to content

rf_line_up

RFBloc

Bases: BaseModel

class used to defined RF-bloc.

Source code in passive_auto_design\system\rf_line_up.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class RFBloc(BaseModel):
    """
    class used to defined RF-bloc.
    """

    freq: Frequency
    gain: PhysicalDimension
    noise: Optional[NoiseFigure]

    @validator("gain", "noise")
    def check_size(cls, v, values, field):
        if "freq" in values and v.shape != values["freq"].shape:
            raise ValueError(f"freq and {field.name} must be the same length")
        return v

RFLineUp

Bases: BaseModel

class used to size rf line-up

Source code in passive_auto_design\system\rf_line_up.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class RFLineUp(BaseModel):
    """
    class used to size rf line-up
    """

    chain: List[RFBloc]

    def NF(self):
        """
        return the noise figure of the global line-up.
        """
        NF = NoiseFigure(value=list(l.noise.value for l in self.chain))
        gain = PhysicalDimension(
            value=list(l.gain.dB().value for l in self.chain)[:-1], scale="dB"
        )
        return friis(NF, gain)

    def gain(self):
        """
        return the gain of the global line-up.
        """
        gain = np.zeros(self.chain[0].gain.shape)
        for l in self.chain:
            gain += l.gain.dB().value
        print(gain)
        return sum(gain)

NF()

return the noise figure of the global line-up.

Source code in passive_auto_design\system\rf_line_up.py
32
33
34
35
36
37
38
39
40
def NF(self):
    """
    return the noise figure of the global line-up.
    """
    NF = NoiseFigure(value=list(l.noise.value for l in self.chain))
    gain = PhysicalDimension(
        value=list(l.gain.dB().value for l in self.chain)[:-1], scale="dB"
    )
    return friis(NF, gain)

gain()

return the gain of the global line-up.

Source code in passive_auto_design\system\rf_line_up.py
42
43
44
45
46
47
48
49
50
def gain(self):
    """
    return the gain of the global line-up.
    """
    gain = np.zeros(self.chain[0].gain.shape)
    for l in self.chain:
        gain += l.gain.dB().value
    print(gain)
    return sum(gain)

friis(nf, gain)

Parameters:

Name Type Description Default
nf NoiseFigure

List of the noise figure (in dB) of each block.

required
gain PhysicalDimension

List of the gain of each block (in dB).

required

Returns:

Type Description
float

Total noise figure of the system

Source code in passive_auto_design\system\rf_line_up.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
def friis(nf: NoiseFigure, gain: PhysicalDimension):
    """

    Parameters
    ----------
    nf : NoiseFigure
        List of the noise figure (in dB) of each block.
    gain : PhysicalDimension
        List of the gain of each block (in dB).


    Returns
    -------
    float
        Total noise figure of the system

    """

    m = gain.shape[0]
    n = nf.shape[0]
    if m != n - 1:
        raise ValueError("gain should have 1 item less than noise factor f")
    g_tot = 1.0
    f_lin = nf.lin()
    res = f_lin[0]
    for i in range(m):
        g_tot *= gain[i].lin()
        res += (f_lin[i + 1] - 1) / g_tot
    return res.dB()