---
url: /dyad/stable/stdlib/ElectricalComponents/components/Analog.Basic.Gyrator.md
description: Dyad Analog.Basic.Gyrator docs.  Gyrator two-port element.
---

# `Analog.Basic.Gyrator` {#Analog.Basic.Gyrator}

Gyrator two-port element.

A gyrator couples the voltage of one port to the current of the other via gyration conductances:

$$i_1 =  G_2 \cdot v_2$$

$$i_2 = -G_1 \cdot v_1$$

Corresponds to `Modelica.Electrical.Analog.Basic.Gyrator`.

This component extends from [`ElectricalComponents.Analog.Interfaces.TwoPort`](../types/Analog.Interfaces.TwoPort.md)

## Usage {#Usage}

`ElectricalComponents.Analog.Basic.Gyrator(G1=1, G2=1)`

## Parameters: {#Parameters:}

| Name |                    Description | Units | Default value |
| ----:| ------------------------------:| -----:| -------------:|
| `G1` |   Primary gyration conductance |     S |             1 |
| `G2` | Secondary gyration conductance |     S |             1 |

## Connectors {#Connectors}

* `p1` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](/stdlib/Dyad/connectors/Pin#Pin))

* `n1` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](/stdlib/Dyad/connectors/Pin#Pin))

* `p2` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](/stdlib/Dyad/connectors/Pin#Pin))

* `n2` - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. ([`Pin`](/stdlib/Dyad/connectors/Pin#Pin))

## Variables {#Variables}

| Name |                                     Description | Units |
| ----:| -----------------------------------------------:| -----:|
| `v1` |          Voltage drop of port 1 (= p1.v - n1.v) |     V |
| `v2` |          Voltage drop of port 2 (= p2.v - n2.v) |     V |
| `i1` | Current flowing from pos. to neg. pin of port 1 |     A |
| `i2` | Current flowing from pos. to neg. pin of port 2 |     A |

## Behavior {#Behavior}

$$ \begin{align}
\mathtt{v1}\left( t \right) &=  - \mathtt{n1.v}\left( t \right) + \mathtt{p1.v}\left( t \right) \\
\mathtt{v2}\left( t \right) &=  - \mathtt{n2.v}\left( t \right) + \mathtt{p2.v}\left( t \right) \\
\mathtt{i1}\left( t \right) &= \mathtt{p1.i}\left( t \right) \\
\mathtt{i2}\left( t \right) &= \mathtt{p2.i}\left( t \right) \\
0 &= \mathtt{n1.i}\left( t \right) + \mathtt{p1.i}\left( t \right) \\
0 &= \mathtt{n2.i}\left( t \right) + \mathtt{p2.i}\left( t \right) \\
\mathtt{i1}\left( t \right) &= \mathtt{G2} ~ \mathtt{v2}\left( t \right) \\
\mathtt{i2}\left( t \right) &=  - \mathtt{G1} ~ \mathtt{v1}\left( t \right)
\end{align}
$$

## Source {#Source}

````dyad
"""
Gyrator two-port element.

A gyrator couples the voltage of one port to the current of the other
via gyration conductances:
```math
i_1 =  G_2 \cdot v_2
```
```math
i_2 = -G_1 \cdot v_1
```

Corresponds to `Modelica.Electrical.Analog.Basic.Gyrator`.
"""
component Gyrator
  extends ElectricalComponents.Analog.Interfaces.TwoPort
  "Primary gyration conductance"
  parameter G1::Conductance = 1
  "Secondary gyration conductance"
  parameter G2::Conductance = 1
relations
  i1 = G2 * v2
  i2 = -G1 * v1
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1200, "rot": 0}],
    "icons": {"default": "dyad://ElectricalComponents/Gyrator.svg"}
  }
}
end
````

````dyad
"""
Gyrator two-port element.

A gyrator couples the voltage of one port to the current of the other
via gyration conductances:
```math
i_1 =  G_2 \cdot v_2
```
```math
i_2 = -G_1 \cdot v_1
```

Corresponds to `Modelica.Electrical.Analog.Basic.Gyrator`.
"""
component Gyrator
  "Positive electrical pin of port 1"
  p1 = Pin() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": -40, "x2": 60, "y2": 60, "rot": 0}
      },
      "tags": []
    }
  }
  "Negative electrical pin of port 1"
  n1 = Pin() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -40, "y1": 940, "x2": 60, "y2": 1040, "rot": 0}
      },
      "tags": []
    }
  }
  "Positive electrical pin of port 2"
  p2 = Pin() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": -40, "x2": 1060, "y2": 60, "rot": 0}
      },
      "tags": []
    }
  }
  "Negative electrical pin of port 2"
  n2 = Pin() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 960, "y1": 950, "x2": 1060, "y2": 1050, "rot": 0}
      },
      "tags": []
    }
  }
  "Voltage drop of port 1 (= p1.v - n1.v)"
  variable v1::Voltage
  "Voltage drop of port 2 (= p2.v - n2.v)"
  variable v2::Voltage
  "Current flowing from pos. to neg. pin of port 1"
  variable i1::Current
  "Current flowing from pos. to neg. pin of port 2"
  variable i2::Current
  "Primary gyration conductance"
  parameter G1::Conductance = 1
  "Secondary gyration conductance"
  parameter G2::Conductance = 1
relations
  v1 = p1.v - n1.v
  v2 = p2.v - n2.v
  i1 = p1.i
  i2 = p2.i
  0 = p1.i + n1.i
  0 = p2.i + n2.i
  i1 = G2 * v2
  i2 = -G1 * v1
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1200, "rot": 0}],
    "icons": {"default": "dyad://ElectricalComponents/Gyrator.svg"}
  }
}
end
````

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`Constant`](Analog.Basic.Gyrator.md)

  * [`Ground`](Analog.Basic.Gyrator.md)

  * [`Gyrator`](Analog.Basic.Gyrator.md)

  * [`Gyrator`](Analog.Basic.Gyrator.md)

  * [`VoltageSource`](Analog.Basic.Gyrator.md)
