1818end
1919
2020"""
21- Resistor(; name, R_ref = 1.0, T_ref = 300.15, alpha = 0, T_dep = false)
21+ Resistor(; name, R = 1.0, T_ref = 300.15, alpha = 0, T_dep = false)
2222
2323Generic resistor with optional temperature dependency.
2424
@@ -205,47 +205,6 @@ See [OnePort](@ref)
205205 end
206206end
207207
208- """
209- HeatingResistor(; name, R_ref = 1.0, T_ref = 300.15, alpha = 0)
210-
211- Temperature dependent electrical resistor
212-
213- # States
214-
215- - See [OnePort](@ref)
216- - `R(t)`: [`Ohm`] Temperature dependent resistance `R ~ R_ref*(1 + alpha*(heat_port.T(t) - T_ref))`
217-
218- # Connectors
219-
220- - `p` Positive pin
221- - `n` Negative pin
222-
223- # Parameters:
224-
225- - `R_ref`: [`Ω`] Reference resistance
226- - `T_ref`: [K] Reference temperature
227- - `alpha`: [K⁻¹] Temperature coefficient of resistance
228- """
229- @mtkmodel HeatingResistor begin
230- @extend v, i = oneport = OnePort ()
231- @components begin
232- heat_port = HeatPort ()
233- end
234- @parameters begin
235- R_ref = 1.0 , [description = " Reference resistance" ]
236- T_ref = 300.15 , [description = " Reference temperature" ]
237- alpha = 0 , [description = " Temperature coefficient of resistance" ]
238- end
239- @variables begin
240- R (t), [guess = R_ref]
241- end
242- @equations begin
243- R ~ R_ref * (1 + alpha * (heat_port. T - T_ref))
244- heat_port. Q_flow ~ - v * i # -LossPower
245- v ~ i * R
246- end
247- end
248-
249208"""
250209 EMF(; name, k)
251210
@@ -291,7 +250,7 @@ Electromotoric force (electric/mechanic transformer)
291250end
292251
293252"""
294- Diode(; name, Is = 1e-6, n = 1, T_ref = 300.15, T_dep = false)
253+ Diode(; name, Is = 1e-6, n = 1, T = 300.15, T_dep = false)
295254
296255Generic diode with optional temperature dependency.
297256
@@ -303,13 +262,13 @@ Generic diode with optional temperature dependency.
303262
304263 - `p` Positive pin
305264 - `n` Negative pin
306- - `port` [HeatPort](@ref) (only if `T_dep = true`) Heat port to model the temperature dependency
265+ - `port` [HeatPort](@ref) (only if `T_dep = true`) Heat port to model variable temperature dependency
307266
308267# Parameters:
309268
310269 - `Is`: [`A`] Saturation current
311270 - `n`: Ideality factor
312- - `T_ref `: [K] Reference temperature
271+ - `T `: [K] Constant ambient temperature - only used if T_dep=false
313272 - `T_dep`: [bool] Temperature dependency
314273"""
315274@mtkmodel Diode begin
@@ -326,8 +285,7 @@ Generic diode with optional temperature dependency.
326285 @parameters begin
327286 Is = 1e-6 , [description = " Saturation current (A)" ]
328287 n = 1 , [description = " Ideality factor" ]
329- T_ref = 300.15 , [description = " Reference temperature (K)" ]
330- Vt_const = k * T_ref / q, [description = " Constant thermal voltage" ]
288+ T = 300.15 , [description = " Ambient temperature" ]
331289 end
332290
333291 if T_dep
@@ -344,7 +302,7 @@ Generic diode with optional temperature dependency.
344302 end
345303 else
346304 @equations begin
347- i ~ Is * (exp (v / (n * Vt_const )) - 1 ) # Shockley diode equation
305+ i ~ Is * (exp (v * q / (n * k * T )) - 1 ) # Shockley diode equation
348306 end
349307 end
350308end
@@ -372,20 +330,20 @@ R = R_const + pos * R_ref * (1 + alpha * (port.T - T_ref))
372330 - `R(t)`: Resistance
373331
374332# Connectors
375-
376- - `p` Positive pin
377- - `n` Negative pin
378- - `position` RealInput to set the position of the wiper
379- - `port` [HeatPort](@ref) Heat port to model the temperature dependency
333+
334+ - `p` Positive pin
335+ - `n` Negative pin
336+ - `position` RealInput to set the position of the wiper
337+ - `port` [HeatPort](@ref) Heat port to model the temperature dependency
380338
381339# Parameters
382-
383- - `R_ref`: [`Ω`] Resistance at temperature T_ref when fully closed (pos=1.0)
384- - `T_ref`: [K] Reference temperature
385- - `R_const`: [`Ω`] Constant resistance between p and n
386- - `T_dep`: [bool] Temperature dependency
387- - `alpha`: [K⁻¹] Temperature coefficient of resistance
388- - `enforce_bounds`: Enforce bounds for the position of the wiper (0-1)
340+
341+ - `R_ref`: [`Ω`] Resistance at temperature T_ref when fully closed (pos=1.0)
342+ - `T_ref`: [K] Reference temperature
343+ - `R_const`: [`Ω`] Constant resistance between p and n
344+ - `T_dep`: Temperature dependency
345+ - `alpha`: [K⁻¹] Temperature coefficient of resistance
346+ - `enforce_bounds`: Enforce bounds for the position of the wiper (0-1)
389347"""
390348@mtkmodel VariableResistor begin
391349 @extend v, i = oneport = OnePort ()
0 commit comments