Skip to content

Commit

Permalink
jfet exhanges
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevan committed Sep 24, 2024
1 parent 8ffc454 commit 2b70a8b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ycx_complex_numbers/Y.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ def to_S(self, Z0=50 + 0j):
s22=((1 + yi) * (1 - yo) + yr * yf) / ((1 + yi) * (1 + yo) - yr * yf),
)

def yin(self, YL=1/(50 + 0j)):
def yin(self, YL=1 / (50 + 0j)):
return self.y11 - (self.y12 * self.y21) / (self.y22 + YL)

def yout(self, YS=1/(50 + 0j)):
def yout(self, YS=1 / (50 + 0j)):
return self.y22 - (self.y12 * self.y21) / (self.y11 + YS)

def in_out(self, ys=None, yl=None):
Expand All @@ -92,16 +92,17 @@ def in_out(self, ys=None, yl=None):

#############################################
# Amplifier Config Exchanges/Transformations
# NOTE: These apply to jfets too
def exchange_to_ce(self, from_config=None):
"""Exchange Amplifier Y Matrix to Common Emitter"""
if from_config == "cb":
if from_config in ["cb", "cg"]:
return NetY(
y11=self.y11 + self.y12 + self.y21 + self.y22,
y12=-(self.y12 + self.y22),
y21=-(self.y21 + self.y22),
y22=self.y22,
)
elif from_config == "cc":
elif from_config in ["cc", "cd"]:
return NetY(
y11=self.y11,
y12=-(self.y11 + self.y12),
Expand All @@ -113,14 +114,14 @@ def exchange_to_ce(self, from_config=None):

def exchange_to_cb(self, from_config=None):
"""Exchange Amplifier Y Matrix to Common Base"""
if from_config == "ce":
if from_config in ["ce", "cs"]:
return NetY(
y11=self.y11 + self.y12 + self.y21 + self.y22,
y12=-(self.y12 + self.y22),
y21=-(self.y21 + self.y22),
y22=self.y22,
)
elif from_config == "cc":
elif from_config in ["cc", "cd"]:
return NetY(
y11=self.y22,
y12=-(self.y21 + self.y22),
Expand All @@ -132,14 +133,14 @@ def exchange_to_cb(self, from_config=None):

def exchange_to_cc(self, from_config=None):
"""Exchange Amplifier Y Matrix to Common Collector"""
if from_config == "ce":
if from_config in ["ce", "cs"]:
return NetY(
y11=self.y11,
y12=-(self.y11 + self.y12),
y21=-(self.y11 + self.y21),
y22=self.y11 + self.y12 + self.y21 + self.y22,
)
elif from_config == "cb":
elif from_config in ["cb", "cg"]:
return NetY(
y11=self.y11 + self.y12 + self.y21 + self.y22,
y12=-(self.y11 + self.y21),
Expand Down

0 comments on commit 2b70a8b

Please sign in to comment.