Skip to content

Commit 7a3e09d

Browse files
feat(Electrical): add ChuaDiode as a @mtkmodel
1 parent bb001cb commit 7a3e09d

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/Electrical/Analog/ideal_components.jl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,43 @@ Electromotoric force (electric/mechanic transformer)
273273
flange.tau ~ -k * i
274274
end
275275
end
276+
277+
"""
278+
ChuaDiode(; name, Ga, Gb, Ve)
279+
280+
Chua's Diode
281+
282+
# States
283+
284+
See [OnePort](@ref)
285+
286+
# Connectors:
287+
288+
- `p` Positive pin
289+
- `n` Negative pin
290+
291+
# Parameters:
292+
293+
- `Ga` : [`Ohm`] Negative of the slope of the V-I curve when v < -Ve and v > V
294+
- `Gb` : [`Ohm`] Negative of the slope of the V-I curve when -Ve < v < Ve
295+
- `Ve` : [`V`] Absolute value of voltage where the behaviour of the diode changes
296+
"""
297+
@mtkmodel ChuaDiode begin
298+
@extend v, i = oneport = OnePort()
299+
@parameters begin
300+
Ga = 1.0,
301+
[description = "Negative of the slope of the V-I curve when v < -Ve and v > Ve"]
302+
Gb = 1.0, [description = "Negative of the slope of the V-I curve when -Ve < v < Ve"]
303+
Ve = 1.0,
304+
[
305+
description = "Absolute value of voltage where the behaviour of the diode changes",
306+
]
307+
end
308+
@equations begin
309+
i ~ ifelse(v < -Ve,
310+
Gb * (v + Ve) - Ga * Ve,
311+
ifelse(v > Ve,
312+
Gb * (v - Ve) + Ga * Ve,
313+
Ga * v))
314+
end
315+
end

src/Electrical/Electrical.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include("utils.jl")
1717

1818
export Capacitor,
1919
Ground, Inductor, Resistor, Conductor, Short, IdealOpAmp, EMF,
20-
HeatingResistor
20+
HeatingResistor, ChuaDiode
2121
include("Analog/ideal_components.jl")
2222

2323
export CurrentSensor, PotentialSensor, VoltageSensor, PowerSensor, MultiSensor

0 commit comments

Comments
 (0)