Skip to content

Commit eced33a

Browse files
fixes docs
1 parent 1af4a62 commit eced33a

File tree

4 files changed

+116
-162
lines changed

4 files changed

+116
-162
lines changed

src/Electrical/Analog/ideal_components.jl

Lines changed: 43 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"""
2-
```julia
3-
function Ground(; name)
4-
```
2+
Ground(; name)
53
64
Ground node with the potential of zero and connector `g`. Every circuit must have one ground
75
node.
86
9-
# Connectors
7+
# Connectors:
108
- `g`
119
"""
1210
function Ground(;name)
@@ -16,25 +14,19 @@ function Ground(;name)
1614
end
1715

1816
"""
19-
```julia
20-
function Resistor(; name, R)
21-
```
17+
Resistor(; name, R)
2218
2319
Creates an ideal Resistor following Ohm's Law.
2420
25-
# States
26-
- `v(t)`: [`V`]
27-
The voltage across the resistor, given by `p.i * R`
21+
# States:
22+
See [OnePort](@ref)
2823
29-
# Connectors
30-
- `p`
31-
Positive pin
32-
- `n`
33-
Negative pin
24+
# Connectors:
25+
- `p` Positive pin
26+
- `n` Negative pin
3427
3528
# Parameters:
36-
- `R`: [`Ω`]
37-
Resistance
29+
- `R`: [`Ω`] Resistance
3830
"""
3931
function Resistor(;name, R)
4032
@named oneport = OnePort()
@@ -47,18 +39,18 @@ function Resistor(;name, R)
4739
end
4840

4941
"""
50-
Conductor(;name, G)
42+
Capacitor(; name, C)
5143
52-
Ideal linear electrical conductor.
44+
Creates an ideal Capacitor.
5345
54-
# States
55-
- see [`OnePort`](@ref)
46+
# States:
47+
See [OnePort](@ref)
5648
57-
# Connectors
49+
# Connectors:
5850
- `p` Positive pin
5951
- `n` Negative pin
6052
61-
# Parameters:
53+
# Parameters:
6254
- `G`: [`S`] Conductance
6355
"""
6456
function Conductor(;name, G)
@@ -72,27 +64,22 @@ function Conductor(;name, G)
7264
end
7365

7466
"""
75-
```julia
76-
function Capacitor(; name, C)
77-
```
67+
Capacitor(; name, C)
68+
7869
7970
Creates an ideal Capacitor.
8071
81-
# States
72+
# States:
8273
- `v(t)`: [`V`]
8374
The voltage across the capacitor, given by `D(v) ~ p.i / C`
8475
85-
# Connectors
86-
- `p`
87-
Positive pin
88-
- `n`
89-
Negative pin
76+
# Connectors:
77+
- `p` Positive pin
78+
- `n` Negative pin
9079
9180
# Parameters:
92-
- `C`: [`F`]
93-
Capacitance
94-
- `v_start`: [`V`]
95-
Initial voltage of capacitor
81+
- `C`: [`F`] Capacitance
82+
- `v_start`: [`V`] Initial voltage of capacitor
9683
"""
9784
function Capacitor(;name, C, v_start=0.0)
9885
@named oneport = OnePort(;v_start=v_start)
@@ -105,27 +92,20 @@ function Capacitor(;name, C, v_start=0.0)
10592
end
10693

10794
"""
108-
```julia
109-
function Inductor(; name, L)
110-
```
95+
Inductor(; name, L)
11196
11297
Creates an ideal Inductor.
11398
114-
# States
115-
- `v(t)`: [`V`]
116-
The voltage across the inductor, given by `D(p.i) ~ v / L`
99+
# States:
100+
See [OnePort](@ref)
117101
118-
# Connectors
119-
- `p`
120-
Positive pin
121-
- `n`
122-
Negative pin
102+
# Connectors:
103+
- `p` Positive pin
104+
- `n` Negative pin
123105
124106
# Parameters:
125-
- `L`: [`H`]
126-
Inductance
127-
- `i_start`: [`A`]
128-
Initial current through inductor
107+
- `L`: [`H`] Inductance
108+
- `i_start`: [`A`] Initial current through inductor
129109
"""
130110
function Inductor(;name, L, i_start=0.0)
131111
@named oneport = OnePort(;i_start=i_start)
@@ -138,33 +118,23 @@ function Inductor(;name, L, i_start=0.0)
138118
end
139119

140120
"""
141-
```julia
142-
function IdealOpAmp(; name)
143-
```
121+
IdealOpAmp(; name)
144122
145123
Ideal operational amplifier (norator-nullator pair).
146124
The ideal OpAmp is a two-port. The left port is fixed to `v1 = 0` and `i1 = 0` (nullator).
147125
At the right port both any voltage `v2` and any current `i2` are possible (norator).
148126
149-
# States
150-
- `v1(t)`: [`V`]
151-
Voltage of left port
152-
- `v2(t)`: [`V`]
153-
Voltage of right port
154-
- `i1(t)`: [`A`]
155-
Current of left port
156-
- `i2(t)`: [`A`]
157-
Current of right port
158-
159-
# Connectors
160-
- `p1`
161-
Positive pin (left port)
162-
- `p2`
163-
Positive pin (right port)
164-
- `n1`
165-
Negative pin (left port)
166-
- `n2`
167-
Negative pin (right port)
127+
# States:
128+
- `v1(t)`: [`V`] Voltage of left port
129+
- `v2(t)`: [`V`] Voltage of right port
130+
- `i1(t)`: [`A`] Current of left port
131+
- `i2(t)`: [`A`] Current of right port
132+
133+
# Connectors:
134+
- `p1` Positive pin (left port)
135+
- `p2` Positive pin (right port)
136+
- `n1` Negative pin (left port)
137+
- `n2` Negative pin (right port)
168138
"""
169139
function IdealOpAmp(;name)
170140
@named p1 = Pin()

src/Electrical/Analog/sensors.jl

Lines changed: 39 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
"""
2-
```julia
3-
function CurrentSensor(; name)
4-
```
2+
CurrentSensor(; name)
53
64
Creates a circuit component that measures the current flowing through it. Analogous to
75
an ideal ammeter.
86
9-
# States
10-
- `i(t)`: [`A`]
11-
Current through the sensor
7+
# States:
8+
- `i(t)`: [`A`] Current through the sensor
129
13-
# Connectors
14-
- `p`
15-
Positive pin
16-
- `n`
17-
Negative pin
10+
# Connectors:
11+
- `p` Positive pin
12+
- `n` Negative pin
1813
"""
1914
function CurrentSensor(; name)
2015
@named p = Pin()
@@ -29,19 +24,15 @@ function CurrentSensor(; name)
2924
end
3025

3126
"""
32-
```julia
33-
function PotentialSensor(; name)
34-
```
27+
PotentialSensor(; name)
3528
3629
Creates a circuit component which measures the potential at a pin.
3730
38-
# States
39-
- `phi(t)`: [`V`]
40-
The potential at this point
31+
# States:
32+
- `phi(t)`: [`V`] The measured potential at this point
4133
42-
# Connectors
43-
- `p`
44-
Pin at which potential is to be measured
34+
# Connectors:
35+
- `p` Pin at which potential is to be measured
4536
"""
4637
function PotentialSensor(; name)
4738
@named p = Pin()
@@ -54,22 +45,16 @@ function PotentialSensor(; name)
5445
end
5546

5647
"""
57-
```julia
58-
function VoltageSensor(; name)
59-
```
48+
VoltageSensor(; name)
6049
61-
Creates a circuit component that measures the voltage across it. Analogous to
62-
an ideal voltmeter.
50+
Creates a circuit component that measures the voltage across it. Analogous to an ideal voltmeter.
6351
64-
# States
65-
- `v(t)`: [`V`]
66-
The voltage across this component
52+
# States:
53+
- `v(t)`: [`V`] The voltage difference form positive to negative pin `p.v - n.v`
6754
68-
# Connectors
69-
- `p`
70-
Positive pin
71-
- `n`
72-
Negative pin
55+
# Connectors:
56+
- `p` Positive pin
57+
- `n` Negative pin
7358
"""
7459
function VoltageSensor(; name)
7560
@named p = Pin()
@@ -84,26 +69,21 @@ function VoltageSensor(; name)
8469
end
8570

8671
"""
87-
```julia
88-
function PowerSensor(; name)
89-
```
72+
PowerSensor(; name)
9073
9174
Combines a [`VoltageSensor`](@ref) and a [`CurrentSensor`](@ref) to measure the power being
9275
consumed by a circuit.
9376
94-
# States
95-
- `power(t)`: [`W`]
96-
The power being consumed, given by the product of voltage and current.
97-
98-
# Connectors
99-
- `pc`
100-
Corresponds to the `p` pin of the [`CurrentSensor`](@ref)
101-
- `nc`
102-
Corresponds to the `n` pin of the [`CurrentSensor`](@ref)
103-
- `pv`
104-
Corresponds to the `p` pin of the [`VoltageSensor`](@ref)
105-
- `nv`
106-
Corresponds to the `n` pin of the [`VoltageSensor`](@ref)
77+
# States:
78+
- `power(t)`: [`W`] The power being consumed, given by the product of voltage and current.
79+
- See [VoltageSensor](@ref)
80+
- See [CurrentSensor](@ref)
81+
82+
# Connectors:
83+
- `pc` Corresponds to the `p` pin of the [`CurrentSensor`](@ref)
84+
- `nc` Corresponds to the `n` pin of the [`CurrentSensor`](@ref)
85+
- `pv` Corresponds to the `p` pin of the [`VoltageSensor`](@ref)
86+
- `nv` Corresponds to the `n` pin of the [`VoltageSensor`](@ref)
10787
"""
10888
function PowerSensor(; name)
10989
@named pc = Pin()
@@ -124,27 +104,19 @@ function PowerSensor(; name)
124104
end
125105

126106
"""
127-
```julia
128-
function MultiSensor(; name)
129-
```
107+
MultiSensor(; name)
130108
131109
Combines a [`VoltageSensor`](@ref) and a [`CurrentSensor`](@ref).
132110
133-
# States
134-
- `v(t)`: [`V`]
135-
The voltage across the [`VoltageSensor`](@ref)
136-
- `i(t)`: [`A`]
137-
The current across the [`CurrentSensor`](@ref)
138-
139-
# Connectors
140-
- `pc`
141-
Corresponds to the `p` pin of the [`CurrentSensor`](@ref)
142-
- `nc`
143-
Corresponds to the `n` pin of the [`CurrentSensor`](@ref)
144-
- `pv`
145-
Corresponds to the `p` pin of the [`VoltageSensor`](@ref)
146-
- `nv`
147-
Corresponds to the `n` pin of the [`VoltageSensor`](@ref)
111+
# States:
112+
- `v(t)`: [`V`] The voltage across the [`VoltageSensor`](@ref)
113+
- `i(t)`: [`A`] The current across the [`CurrentSensor`](@ref)
114+
115+
# Connectors:
116+
- `pc` Corresponds to the `p` pin of the [`CurrentSensor`](@ref)
117+
- `nc` Corresponds to the `n` pin of the [`CurrentSensor`](@ref)
118+
- `pv` Corresponds to the `p` pin of the [`VoltageSensor`](@ref)
119+
- `nv` Corresponds to the `n` pin of the [`VoltageSensor`](@ref)
148120
"""
149121
function MultiSensor(; name)
150122
@named pc = Pin()

src/Electrical/Analog/sources.jl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
"""
22
Voltage(;name)
33
4-
Acts as voltage signal.
4+
Acts as an ideal voltage source with no internal resistance.
55
6+
# States:
7+
See [OnePort](@ref)
8+
9+
# Connectors:
10+
- `p` Positive pin
11+
- `n` Negative pin
12+
- `V` [RealInput](@ref) Input for the voltage control signal, i.e. `V ~ p.v - n.v`
613
"""
714
function Voltage(;name)
815
@named oneport = OnePort()
@@ -18,8 +25,15 @@ end
1825
"""
1926
Current(;name)
2027
21-
Acts as current signal.
28+
Acts as an ideal current source with no internal resistance.
29+
30+
# States:
31+
See [OnePort](@ref)
2232
33+
# Connectors:
34+
- `p` Positive pin
35+
- `n` Negative pin
36+
- `I` [RealInput](@ref) Input for the current control signal, i.e. `I ~ p.i
2337
"""
2438
function Current(;name)
2539
@named oneport = OnePort()

0 commit comments

Comments
 (0)