PowerSensor
IconPowerSensor
Combines a VoltageSensor
and a CurrentSensor
to measure the power being consumed by a circuit.
Usage
PowerSensor()
Connectors
pc
- (Pin
)nc
- (Pin
)pv
- (Pin
)nv
- (Pin
)power
- This connector represents a real signal as an output from a component (RealOutput
)
Behavior
\[ \begin{equation} \left[ \begin{array}{c} \mathtt{power}\left( t \right) = \mathtt{current\_sensor.i}\left( t \right) \mathtt{voltage\_sensor.v}\left( t \right) \\ \mathrm{connect}\left( pv, voltage_{sensor_{+}p} \right) \\ \mathrm{connect}\left( voltage_{sensor_{+}n}, nv \right) \\ \mathrm{connect}\left( pc, current_{sensor_{+}p} \right) \\ \mathrm{connect}\left( current_{sensor_{+}n}, nc \right) \\ \mathtt{voltage\_sensor.p.i}\left( t \right) = 0 \\ \mathtt{voltage\_sensor.n.i}\left( t \right) = 0 \\ \mathtt{voltage\_sensor.v}\left( t \right) = \mathtt{voltage\_sensor.p.v}\left( t \right) - \mathtt{voltage\_sensor.n.v}\left( t \right) \\ \mathtt{current\_sensor.p.v}\left( t \right) = \mathtt{current\_sensor.n.v}\left( t \right) \\ \mathtt{current\_sensor.p.i}\left( t \right) = \mathtt{current\_sensor.i}\left( t \right) \\ \mathtt{current\_sensor.n.i}\left( t \right) = - \mathtt{current\_sensor.i}\left( t \right) \\ \end{array} \right] \end{equation} \]
Source
# Combines a `VoltageSensor` and a `CurrentSensor` to measure the power being
# consumed by a circuit.
component PowerSensor
pc = Pin() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "pos", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
}
}]
nc = Pin() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "neg", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
}
}]
pv = Pin() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "pos", "x1": 450, "y1": -50, "x2": 550, "y2": 50}}
}
}]
nv = Pin() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "neg", "x1": 450, "y1": 950, "x2": 550, "y2": 1050}}
}
}]
voltage_sensor = VoltageSensor()
current_sensor = CurrentSensor()
# Instantaneous power
power = RealOutput() [{
"JuliaSim": {
"placement": {"icon": {"x1": 150, "y1": 950, "x2": 250, "y2": 1050, "rot": 90}}
}
}]
relations
connect(pv, voltage_sensor.p)
connect(voltage_sensor.n, nv)
connect(pc, current_sensor.p)
connect(current_sensor.n, nc)
power = voltage_sensor.v*current_sensor.i
metadata {
"JuliaSim": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "P", "x": 500, "y": 713, "rot": 0}
],
"icons": {"default": "jsml://ElectricalComponents/PowerSensor.svg"}
}
}
end
Flattened Source
# Combines a `VoltageSensor` and a `CurrentSensor` to measure the power being # consumed by a circuit. component PowerSensor pc = Pin() [{ "JuliaSim": { "placement": {"icon": {"iconName": "pos", "x1": -50, "y1": 450, "x2": 50, "y2": 550}} } }] nc = Pin() [{ "JuliaSim": { "placement": {"icon": {"iconName": "neg", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}} } }] pv = Pin() [{ "JuliaSim": { "placement": {"icon": {"iconName": "pos", "x1": 450, "y1": -50, "x2": 550, "y2": 50}} } }] nv = Pin() [{ "JuliaSim": { "placement": {"icon": {"iconName": "neg", "x1": 450, "y1": 950, "x2": 550, "y2": 1050}} } }] voltage_sensor = VoltageSensor() current_sensor = CurrentSensor() # Instantaneous power power = RealOutput() [{ "JuliaSim": { "placement": {"icon": {"x1": 150, "y1": 950, "x2": 250, "y2": 1050, "rot": 90}} } }] relations connect(pv, voltage_sensor.p) connect(voltage_sensor.n, nv) connect(pc, current_sensor.p) connect(current_sensor.n, nc) power = voltage_sensor.v*current_sensor.i metadata { "JuliaSim": { "labels": [ {"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}, {"label": "P", "x": 500, "y": 713, "rot": 0} ], "icons": {"default": "jsml://ElectricalComponents/PowerSensor.svg"} } } end
Test Cases
Related
- Examples
- Experiments
- Analyses
- Tests