Skip to content
MultiSensor.md

MultiSensor

Provides combined voltage and current measurements from an electrical circuit.

This component extends a PowerSensor to offer voltage, current and power readings as real-valued outputs. The output v represents the measured voltage, the output i represents the measured current and the output power represents power. v and i outputs are directly sourced from internal voltage_sensor and current_sensor subcomponents, which are part of the inherited PowerSensor. The defining equations from the relations block are:

v = \text{voltage_sensor.v} i = \text{current_sensor.i} power = \text{voltage_sensor.v*current_sensor.i} This component extends from [`PowerSensor`](https://help.juliahub.com/dyad/dev/stdlib/ElectricalComponents/components/PowerSensor.html) ## Usage `MultiSensor()` ## Connectors * `pc` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](@ref)) * `nc` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](@ref)) * `pv` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](@ref)) * `nv` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](@ref)) * `power` - This connector represents a real signal as an output from a component ([`RealOutput`](@ref)) * `i` - This connector represents a real signal as an output from a component ([`RealOutput`](@ref)) * `v` - This connector represents a real signal as an output from a component ([`RealOutput`](@ref)) ## Behavior

@example behavior using ElectricalComponents #hide using ModelingToolkit #hide @named sys = MultiSensor() #hide full_equations(sys) #hide


## Source

@raw html <pre><code class="language-dyad hljs"><span class="hljs-comment"># Provides combined voltage and current measurements from an electrical circuit.

{#}

This component extends a PowerSensor to offer voltage, current and power

readings as real-valued outputs. The output v represents the measured

voltage, the output i represents the measured current and the output power

represents power. v and i outputs are directly sourced from internal

voltage_sensor and current_sensor subcomponents, which are part of the

inherited PowerSensor. The defining equations from the relations block are:

```math

v = \text{voltage_sensor.v} {#v-\text{voltage_sensor.v}}

```

```math

i = \text{current_sensor.i} {#i-\text{current_sensor.i}}

```

```math

power = \text{voltage_sensor.v_current*sensor.i}</span> {#power-\text{voltagesensor.vcurrentsensor.i}/span}

<span class="hljs-keyword">component</span> MultiSensor &nbsp;&nbsp;<span class="hljs-keyword">extends</span> <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/ElectricalComponents/components/PowerSensor.html">PowerSensor</a></span&gt; &nbsp;&nbsp;<span class="hljs-comment"># Output signal representing the measured current</span> &nbsp;&nbsp;<span class="hljs-symbol">i</span> = <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/connectors/RealOutput.html">RealOutput</a></span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"x1": 650, "y1": 950, "x2": 750, "y2": 1050, "rot": 90}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Output signal representing the measured voltage</span> &nbsp;&nbsp;<span class="hljs-symbol">v</span> = <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/connectors/RealOutput.html">RealOutput</a></span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"x1": 850, "y1": 950, "x2": 950, "y2": 1050, "rot": 90}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] <span class="hljs-keyword">relations</span> &nbsp;&nbsp;i = current_sensor.i &nbsp;&nbsp;v = voltage_sensor.v <span class="hljs-keyword">metadata</span> { &nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;"labels": [ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": ":instance", "x": 500, "y": 1100, "rot": 0}, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": "M", "x": 500, "y": 713, "rot": 0} &nbsp;&nbsp;&nbsp;&nbsp;], &nbsp;&nbsp;&nbsp;&nbsp;"icons": {"default": "dyad://ElectricalComponents/FourPinSensor.svg"} &nbsp;&nbsp;} } <span class="hljs-keyword">end</span></code></pre>

@raw html

<details> <summary>Flattened Source</summary>

@raw html <pre><code class="language-dyad hljs"><span class="hljs-comment"># Provides combined voltage and current measurements from an electrical circuit.

This component extends a PowerSensor to offer voltage, current and power

readings as real-valued outputs. The output v represents the measured

voltage, the output i represents the measured current and the output power

represents power. v and i outputs are directly sourced from internal

voltage_sensor and current_sensor subcomponents, which are part of the

inherited PowerSensor. The defining equations from the relations block are:

```math

v = \text{voltage_sensor.v} {#v-\text{voltage_sensor.v}-2}

```

```math

i = \text{current_sensor.i} {#i-\text{current_sensor.i}-2}

```

```math

power = \text{voltage_sensor.v_current*sensor.i}</span> {#power-\text{voltagesensor.vcurrentsensor.i}/span-2}

<span class="hljs-keyword">component</span> MultiSensor &nbsp;&nbsp;<span class="hljs-comment"># Positive pin for current measurement path</span> &nbsp;&nbsp;<span class="hljs-symbol">pc</span> = <span>Pin</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"iconName": "pos", "x1": -50, "y1": 450, "x2": 50, "y2": 550}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Negative pin for current measurement path</span> &nbsp;&nbsp;<span class="hljs-symbol">nc</span> = <span>Pin</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"iconName": "neg", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Positive pin for voltage measurement</span> &nbsp;&nbsp;<span class="hljs-symbol">pv</span> = <span>Pin</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"iconName": "pos", "x1": 450, "y1": -50, "x2": 550, "y2": 50}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Negative pin for voltage measurement</span> &nbsp;&nbsp;<span class="hljs-symbol">nv</span> = <span>Pin</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"iconName": "neg", "x1": 450, "y1": 950, "x2": 550, "y2": 1050}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Internal subcomponent to measure voltage</span> &nbsp;&nbsp;<span class="hljs-symbol">voltage_sensor</span> = <span>VoltageSensor</span>() &nbsp;&nbsp;<span class="hljs-comment"># Internal subcomponent to measure current</span> &nbsp;&nbsp;<span class="hljs-symbol">current_sensor</span> = <span>CurrentSensor</span>() &nbsp;&nbsp;<span class="hljs-comment"># Output signal representing the calculated instantaneous power</span> &nbsp;&nbsp;<span class="hljs-symbol">power</span> = <span>RealOutput</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"x1": 150, "y1": 950, "x2": 250, "y2": 1050, "rot": 90}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Output signal representing the measured current</span> &nbsp;&nbsp;<span class="hljs-symbol">i</span> = <span>RealOutput</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"x1": 650, "y1": 950, "x2": 750, "y2": 1050, "rot": 90}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] &nbsp;&nbsp;<span class="hljs-comment"># Output signal representing the measured voltage</span> &nbsp;&nbsp;<span class="hljs-symbol">v</span> = <span>RealOutput</span>() [{ &nbsp;&nbsp;&nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"placement": {"icon": {"x1": 850, "y1": 950, "x2": 950, "y2": 1050, "rot": 90}} &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;}] <span class="hljs-keyword">relations</span> &nbsp;&nbsp;<span class="hljs-built_in">connect</span>(pv, voltage_sensor.p) &nbsp;&nbsp;<span class="hljs-built_in">connect</span>(voltage_sensor.n, nv) &nbsp;&nbsp;<span class="hljs-built_in">connect</span>(pc, current_sensor.p) &nbsp;&nbsp;<span class="hljs-built_in">connect</span>(current_sensor.n, nc) &nbsp;&nbsp;power = voltage_sensor.v * current_sensor.i &nbsp;&nbsp;i = current_sensor.i &nbsp;&nbsp;v = voltage_sensor.v <span class="hljs-keyword">metadata</span> { &nbsp;&nbsp;"Dyad": { &nbsp;&nbsp;&nbsp;&nbsp;"labels": [ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": ":instance", "x": 500, "y": 1100, "rot": 0}, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{"label": "M", "x": 500, "y": 713, "rot": 0} &nbsp;&nbsp;&nbsp;&nbsp;], &nbsp;&nbsp;&nbsp;&nbsp;"icons": {"default": "dyad://ElectricalComponents/FourPinSensor.svg"} &nbsp;&nbsp;} } <span class="hljs-keyword">end</span></code></pre>

@raw html </details>

@raw html

<br></br>


## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}
- Examples
  
- Experiments
  
- Analyses
  
- Tests
  - [`MultiSensorTest`](/stdlib/ElectricalComponents/tests/MultiSensorTest#MultiSensorTest)