Skip to content

Commit 011e4f4

Browse files
committed
Remove arbitrary defaults
1 parent f8bdbb9 commit 011e4f4

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

src/Blocks/math.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Gain(k=1; name)
2+
Gain(k; name)
33
44
Output the product of a gain value with the input signal.
55
@@ -10,7 +10,7 @@ Output the product of a gain value with the input signal.
1010
- `input`
1111
- `output`
1212
"""
13-
function Gain(k=1; name)
13+
function Gain(k; name)
1414
@named siso = SISO()
1515
@unpack u, y = siso
1616
pars = @parameters k=k

src/Electrical/Analog/ideal_components.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ end
1717

1818
"""
1919
```julia
20-
function Resistor(; name, R = 1.0)
20+
function Resistor(; name, R)
2121
```
2222
2323
Creates an ideal Resistor following Ohm's Law.
@@ -36,7 +36,7 @@ Creates an ideal Resistor following Ohm's Law.
3636
- `R`: [`Ω`]
3737
Resistance
3838
"""
39-
function Resistor(;name, R=1.0)
39+
function Resistor(;name, R)
4040
@named oneport = OnePort()
4141
@unpack v, i = oneport
4242
pars = @parameters R=R
@@ -48,7 +48,7 @@ end
4848

4949
"""
5050
```julia
51-
function Capacitor(; name, C = 1.0)
51+
function Capacitor(; name, C)
5252
```
5353
5454
Creates an ideal Capacitor.
@@ -69,7 +69,7 @@ Creates an ideal Capacitor.
6969
- `v_start`: [`V`]
7070
Initial voltage of capacitor
7171
"""
72-
function Capacitor(;name, C=1.0, v_start=0.0)
72+
function Capacitor(;name, C, v_start=0.0)
7373
@named oneport = OnePort(;v_start=v_start)
7474
@unpack v, i = oneport
7575
pars = @parameters C=C
@@ -81,7 +81,7 @@ end
8181

8282
"""
8383
```julia
84-
function Inductor(; name, L = 1.0)
84+
function Inductor(; name, L)
8585
```
8686
8787
Creates an ideal Inductor.
@@ -102,7 +102,7 @@ Creates an ideal Inductor.
102102
- `i_start`: [`A`]
103103
Initial current through inductor
104104
"""
105-
function Inductor(;name, L=1.0e-6, i_start=0.0)
105+
function Inductor(;name, L, i_start=0.0)
106106
@named oneport = OnePort(;i_start=i_start)
107107
@unpack v, i = oneport
108108
pars = @parameters L=L

src/Electrical/Analog/sources.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _xH(t, δ, tₒ) = (t-tₒ)*(1+((t-tₒ)/sqrt((t-tₒ)^2+δ^2)))/2
1818

1919
"""
2020
```julia
21-
function ConstantVoltage(; name, V=1.0)
21+
function ConstantVoltage(; name, V)
2222
```
2323
2424
The source for an ideal constant voltage.
@@ -37,7 +37,7 @@ The source for an ideal constant voltage.
3737
- `V`: [`V`]
3838
The constant voltage across the terminals of this source
3939
"""
40-
function ConstantVoltage(;name, V = 1.0)
40+
function ConstantVoltage(;name, V)
4141
@named oneport = OnePort()
4242
@unpack v, i = oneport
4343
pars = @parameters V=V

src/Mechanical/Rotational/components.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Fixed(;name, phi0=0.0)
1414
end
1515

1616
"""
17-
Inertia(;name, J=1.0, phi_start=0.0, w_start=0.0, a_start=0.0)
17+
Inertia(;name, J, phi_start=0.0, w_start=0.0, a_start=0.0)
1818
1919
1D-rotational component with inertia.
2020
@@ -29,7 +29,7 @@ end
2929
- `w`: [rad/s] Absolute angular velocity of component (= der(phi))
3030
- `a`: [rad/s²] Absolute angular acceleration of component (= der(w))
3131
"""
32-
function Inertia(;name, J=1.0, phi_start=0.0, w_start=0.0, a_start=0.0)
32+
function Inertia(;name, J, phi_start=0.0, w_start=0.0, a_start=0.0)
3333
@named flange_a = Flange()
3434
@named flange_b = Flange()
3535
@parameters J=J
@@ -57,7 +57,7 @@ Linear 1D rotational spring
5757
- `c`: [N.m/rad] Spring constant
5858
- `phi_rel0`: Unstretched spring angle
5959
"""
60-
function Spring(;name, c=1.0e5, phi_rel0=0.0)
60+
function Spring(;name, c, phi_rel0=0.0)
6161
@named partial_comp = PartialCompliant()
6262
@unpack phi_rel, tau = partial_comp
6363
pars = @parameters begin
@@ -69,14 +69,14 @@ function Spring(;name, c=1.0e5, phi_rel0=0.0)
6969
end
7070

7171
"""
72-
Damper(;name, d=0.0)
72+
Damper(;name, d)
7373
7474
Linear 1D rotational damper
7575
7676
# Parameters:
7777
- `d`: [N.m.s/rad] Damping constant
7878
"""
79-
function Damper(;name, d=0.0)
79+
function Damper(;name, d)
8080
@named partial_comp = PartialCompliantWithRelativeStates()
8181
@unpack w_rel, tau = partial_comp
8282
pars = @parameters d=d

src/Thermal/HeatTransfer/ideal_components.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
HeatCapacitor(; name, C=1.0, T_start=293.15 + 20)
2+
HeatCapacitor(; name, C, T_start=293.15 + 20)
33
44
Lumped thermal element storing heat
55
@@ -11,7 +11,7 @@ Lumped thermal element storing heat
1111
- `T`: [K] Temperature of element
1212
- `der_T`: [K/s] Time derivative of temperature
1313
"""
14-
function HeatCapacitor(; name, C=1.0, T_start=293.15 + 20)
14+
function HeatCapacitor(; name, C, T_start=293.15 + 20)
1515
@named port = HeatPort()
1616
@parameters C=C
1717
sts = @variables begin
@@ -29,14 +29,14 @@ function HeatCapacitor(; name, C=1.0, T_start=293.15 + 20)
2929
end
3030

3131
"""
32-
ThermalConductor(;name, G=1.0)
32+
ThermalConductor(;name, G)
3333
3434
Lumped thermal element transporting heat without storing it.
3535
3636
# Parameters:
3737
- `G`: [W/K] Constant thermal conductance of material
3838
"""
39-
function ThermalConductor(;name, G=1.0)
39+
function ThermalConductor(;name, G)
4040
@named element1d = Element1D()
4141
@unpack Q_flow, dT = element1d
4242
pars = @parameters G=G
@@ -47,14 +47,14 @@ function ThermalConductor(;name, G=1.0)
4747
end
4848

4949
"""
50-
ThermalResistor(; name, R=1.0)
50+
ThermalResistor(; name, R)
5151
5252
Lumped thermal element transporting heat without storing it.
5353
5454
# Parameters:
5555
- `R`: [K/W] Constant thermal resistance of material
5656
"""
57-
function ThermalResistor(; name, R=1.0)
57+
function ThermalResistor(; name, R)
5858
@named element1d = Element1D()
5959
@unpack Q_flow, dT = element1d
6060
pars = @parameters R=R
@@ -66,7 +66,7 @@ function ThermalResistor(; name, R=1.0)
6666
end
6767

6868
"""
69-
ConvectiveConductor(; name, G=1.0)
69+
ConvectiveConductor(; name, G)
7070
7171
Lumped thermal element for heat convection.
7272
@@ -77,7 +77,7 @@ Lumped thermal element for heat convection.
7777
- `dT`: [K] Temperature difference across the component solid.T - fluid.T
7878
- `Q_flow`: [W] Heat flow rate from solid -> fluid
7979
"""
80-
function ConvectiveConductor(; name, G=1.0)
80+
function ConvectiveConductor(; name, G)
8181
@named solid = HeatPort()
8282
@named fluid = HeatPort()
8383
@parameters G=G
@@ -92,7 +92,7 @@ function ConvectiveConductor(; name, G=1.0)
9292
end
9393

9494
"""
95-
ConvectiveResistor(; name, R=1.0)
95+
ConvectiveResistor(; name, R)
9696
9797
Lumped thermal element for heat convection.
9898
@@ -103,7 +103,7 @@ Lumped thermal element for heat convection.
103103
- `dT`: [K] Temperature difference across the component solid.T - fluid.T
104104
- `Q_flow`: [W] Heat flow rate from solid -> fluid
105105
"""
106-
function ConvectiveResistor(; name, R=1.0)
106+
function ConvectiveResistor(; name, R)
107107
@named solidport = HeatPort()
108108
@named fluidport = HeatPort()
109109
@parameters R=R
@@ -118,14 +118,14 @@ function ConvectiveResistor(; name, R=1.0)
118118
end
119119

120120
"""
121-
BodyRadiation(; name, G=1.0)
121+
BodyRadiation(; name, G)
122122
123123
Lumped thermal element for radiation heat transfer.
124124
125125
# Parameters:
126126
- `G`: [m^2] Net radiation conductance between two surfaces
127127
"""
128-
function BodyRadiation(; name, G=1.0)
128+
function BodyRadiation(; name, G)
129129
sigma = 5.6703744191844294e-8 # Stefan-Boltzmann constant TODO: extract into physical constants module or use existing one
130130

131131
@named element1d = Element1D()
@@ -142,13 +142,13 @@ end
142142
"""
143143
ThermalCollector(; name, m=1)
144144
145-
Collects m heat flows
145+
Collects `m` heat flows
146146
147147
This is a model to collect the heat flows from `m` heatports to one single heatport.
148148
# Parameters:
149149
- `m`: Number of heat ports (e.g. m=2: `port_a1`, `port_a2`)
150150
"""
151-
function ThermalCollector(; name, m=1)
151+
function ThermalCollector(; name, m::Integer=1)
152152
port_a = [HeatPort(name=Symbol(:port_a, i)) for i in 1:m]
153153
@named port_b = HeatPort()
154154
eqs = [

src/Thermal/HeatTransfer/sources.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function FixedHeatFlow(; name, Q_flow=1.0, T_ref=293.15, alpha=0.0)
2727
end
2828

2929
"""
30-
FixedTemperature(; name, T=0.0)
30+
FixedTemperature(; name, T)
3131
3232
Fixed temperature boundary condition in kelvin.
3333
@@ -36,7 +36,7 @@ This model defines a fixed temperature T at its port in kelvin, i.e., it defines
3636
# Parameters:
3737
- `T`: [K] Fixed temperature boundary condition
3838
"""
39-
function FixedTemperature(; name, T=0.0)
39+
function FixedTemperature(; name, T)
4040
@named port = HeatPort()
4141
pars = @parameters T=T
4242
eqs = [

0 commit comments

Comments
 (0)