Skip to content

Commit f51768c

Browse files
committed
fix: set k and q as constants in Diode
k -> Boltzmann constant q -> Elementary charge
1 parent b5b01b4 commit f51768c

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/Electrical/Analog/ideal_components.jl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,22 +273,21 @@ Ideal diode based on the Shockley diode equation.
273273
- See [OnePort](@ref)
274274
275275
# Connectors
276-
276+
277277
- `p` Positive pin
278278
- `n` Negative pin
279279
280280
# Parameters
281-
281+
282282
- `Is`: [`A`] Saturation current
283283
- `n`: Ideality factor
284284
- `T`: [K] Ambient temperature
285285
"""
286286
@mtkmodel Diode begin
287-
begin
287+
@constants begin
288288
k = 1.380649e-23 # Boltzmann constant (J/K)
289289
q = 1.602176634e-19 # Elementary charge (C)
290290
end
291-
292291
@extend v, i = oneport = OnePort(; v = 0.0)
293292
@parameters begin
294293
Is = 1e-6, [description = "Saturation current (A)"]
@@ -310,13 +309,13 @@ Temperature dependent diode based on the Shockley diode equation.
310309
- See [OnePort](@ref)
311310
312311
# Connectors
313-
312+
314313
- `p` Positive pin
315314
- `n` Negative pin
316315
- `port` [HeatPort](@ref) Heat port to model the temperature dependency
317316
318317
# Parameters:
319-
318+
320319
- `Is`: [`A`] Saturation current
321320
- `n`: Ideality factor
322321
"""
@@ -349,13 +348,13 @@ end
349348
350349
Variable resistor with optional temperature dependency.
351350
352-
The total resistance R ∈ [R_const, R_const + R_ref], where pos is the
353-
position of the wiper and R_ref is the variable resistance between p and n.
351+
The total resistance R ∈ [R_const, R_const + R_ref], where pos is the
352+
position of the wiper and R_ref is the variable resistance between p and n.
354353
The total resistance is then:
355354
356355
R = R_const + pos * R_ref
357356
358-
If T_dep is true, then R also depends on the temperature of the heat port with
357+
If T_dep is true, then R also depends on the temperature of the heat port with
359358
temperature coefficient alpha. The total resistance is then:
360359
361360
R = R_const + pos * R_ref * (1 + alpha * (port.T - T_ref))
@@ -367,14 +366,14 @@ R = R_const + pos * R_ref * (1 + alpha * (port.T - T_ref))
367366
- `R(t)`: Resistance
368367
369368
# Connectors
370-
369+
371370
- `p` Positive pin
372371
- `n` Negative pin
373372
- `position` RealInput to set the position of the wiper
374373
- `port` [HeatPort](@ref) Heat port to model the temperature dependency
375374
376375
# Parameters
377-
376+
378377
- `R_ref`: [`Ω`] Resistance at temperature T_ref when fully closed (pos=1.0)
379378
- `T_ref`: [K] Reference temperature
380379
- `R_const`: [`Ω`] Constant resistance between p and n

0 commit comments

Comments
 (0)