@@ -393,15 +393,21 @@ R = R_const + pos * R_ref * (1 + alpha * (port.T - T_ref))
393393end
394394
395395"""
396- Switch(; state_init = false, Gon = 1e5, τ = 1e-3 )
396+ Switch(; Gon = 1e5, state_init = false )
397397
398398An electrical switch that is controlled by a boolean input.
399399
400+ The switch is modelled as follows:
401+ - i = G*v
402+ - G = state*G_on
403+ - state: boolean input
404+
405+ G will therefore be 0 when the input is false [0] and G_on when the input is true [1].
406+
400407# States
401408
402409 - See [OnePort](@ref)
403410 - `state(t)`: Boolean input
404- - `state_filtered(t)`: Filtered delay of state(t)
405411 - `G(t)`: Conductance
406412
407413# Connectors
@@ -412,18 +418,13 @@ An electrical switch that is controlled by a boolean input.
412418
413419# Parameters:
414420
415- - `state_init`: Initial switch state of type Bool. false: switch is open. true: switch is closed.
416- - `Gon`: [`S`] Conductance when switch is closed.
417- - `τ`: Parameter for filtered delay.
421+ - `Gon`: [`S`] Conductance when switch is closed. Value should be finite to avoid a singularity.
418422"""
419423@mtkmodel Switch begin
420424 @extend v, i = oneport = OnePort ()
421425
422426 @parameters begin
423- state_init = false ,
424- [description = " Initial switch state of type Bool. false: switch is open. true: switch is closed." ]
425427 Gon = 1e5 , [description = " Conductance when switch is closed" ]
426- τ = 1e-3 , [description = " Parameter for filtered delay" ]
427428 end
428429
429430 @components begin
@@ -432,14 +433,12 @@ An electrical switch that is controlled by a boolean input.
432433
433434 @variables begin
434435 state (t):: Bool
435- state_filtered (t) = Real (state_init)
436436 G (t)
437437 end
438438
439439 @equations begin
440440 state ~ input. u
441- D (state_filtered) ~ (state - state_filtered)/ τ
442- G ~ state_filtered* Gon
441+ G ~ state* Gon
443442 i ~ G* v
444443 end
445444end
0 commit comments