Skip to content

Commit aa1e749

Browse files
committed
fix: convention SPICE vs MTK
1 parent fce47cf commit aa1e749

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Electrical/Analog/controlled_sources.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Current Controlled Voltage Source (SPICE H-element).
9898
9999
A four-terminal device where the output voltage is proportional to the input current.
100100
The input port has zero impedance (no voltage drop across the sensing terminals).
101+
The controlling current is measured as current flowing from p1 to n1 (through the input port).
101102
102103
# Parameters
103104
- `Rm`: [V/A or Ω] Transresistance (default: 1000.0 Ω = 1 kΩ)
@@ -110,7 +111,7 @@ The input port has zero impedance (no voltage drop across the sensing terminals)
110111
111112
# Equations
112113
```
113-
v2 = Rm × i1
114+
v2 = Rm × i_through (where i_through = current from p1 to n1)
114115
v1 = 0 (zero input impedance)
115116
```
116117
@@ -127,8 +128,10 @@ v1 = 0 (zero input impedance)
127128
Rm = Rm, [description = "Transresistance [V/A]"]
128129
end
129130

131+
# Note: i1 = p1.i = current INTO p1. The controlling current is current
132+
# flowing THROUGH the input port (from p1 to n1), which equals -i1.
130133
eqs = Equation[
131-
v2 ~ Rm * i1,
134+
v2 ~ -Rm * i1,
132135
v1 ~ 0,
133136
]
134137

@@ -143,6 +146,7 @@ Current Controlled Current Source (SPICE F-element).
143146
144147
A four-terminal device where the output current is proportional to the input current.
145148
The input port has zero impedance (no voltage drop across the sensing terminals).
149+
The controlling current is measured as current flowing from p1 to n1 (through the input port).
146150
147151
# Parameters
148152
- `α`: [A/A] Current gain (default: 1.0). Can be negative for inverting behavior.
@@ -155,7 +159,7 @@ The input port has zero impedance (no voltage drop across the sensing terminals)
155159
156160
# Equations
157161
```
158-
i2 = α × i1
162+
i2 = α × i_through (where i_through = current from p1 to n1)
159163
v1 = 0 (zero input impedance)
160164
```
161165
@@ -172,8 +176,10 @@ v1 = 0 (zero input impedance)
172176
α = α, [description = "Current gain [A/A]"]
173177
end
174178

179+
# Note: i1 = p1.i = current INTO p1. The controlling current is current
180+
# flowing THROUGH the input port (from p1 to n1), which equals -i1.
175181
eqs = Equation[
176-
i2 ~ α * i1,
182+
i2 ~ -α * i1,
177183
v1 ~ 0,
178184
]
179185

0 commit comments

Comments
 (0)