LIBRARY
Analog.Basic.Tests.TranslationalEMF
Test circuit for TranslationalEMF driven by a sinusoidal voltage with a mass load.
A sine voltage source (amplitude=1 V, frequency=1 Hz) drives a TranslationalEMF (k=1 N/A). The mechanical flange is connected to a sliding mass (m=1 kg, horizontal, no gravity). The support is grounded via a Fixed component.
With an ideal voltage source and k=1:
vel = v/k = sin(2π·t)
s = (1 − cos(2π·t))/(2π)
a = 2π·cos(2π·t)
f = m·a = 2π·cos(2π·t)
i = −f/k = −2π·cos(2π·t)
Analogous to RotationalEMFTest in the standard library.
Usage
ElectricalComponents.Analog.Basic.Tests.TranslationalEMF()
Behavior
Source
dyad
"""
Test circuit for TranslationalEMF driven by a sinusoidal voltage with a mass load.
A sine voltage source (amplitude=1 V, frequency=1 Hz) drives a TranslationalEMF
(k=1 N/A). The mechanical flange is connected to a sliding mass (m=1 kg,
horizontal, no gravity). The support is grounded via a Fixed component.
With an ideal voltage source and k=1:
- vel = v/k = sin(2π·t)
- s = (1 − cos(2π·t))/(2π)
- a = 2π·cos(2π·t)
- f = m·a = 2π·cos(2π·t)
- i = −f/k = −2π·cos(2π·t)
Analogous to `RotationalEMFTest` in the standard library.
"""
test component TranslationalEMF
"Sine signal: amplitude=1, frequency=1 Hz"
sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 10, "y1": 490, "x2": 110, "y2": 590, "rot": 0}
},
"tags": []
}
}
"Voltage source driven by sine"
voltage_source = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 155, "y1": 485, "x2": 255, "y2": 385, "rot": 0}
},
"tags": []
}
}
"Translational EMF with k=1 N/A"
emf = ElectricalComponents.Analog.Basic.TranslationalEMF(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 220, "y1": 110, "x2": 320, "y2": 210, "rot": 0}
},
"tags": []
}
}
"Electrical ground"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 420, "y1": 490, "x2": 520, "y2": 590, "rot": 0}
},
"tags": []
}
}
"Mechanical ground for EMF support"
fixed = TranslationalComponents.Components.Fixed() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 180, "x2": 140, "y2": 280, "rot": 0}
},
"tags": []
}
}
"Sliding mass (1 kg, horizontal)"
mass = TranslationalComponents.Components.Mass(m = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 440, "y1": 110, "x2": 540, "y2": 210, "rot": 0}
},
"tags": []
}
}
relations
initial emf.s = 0
connect(sine.y, voltage_source.V) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 205, "y": 540}], "E": 2}],
"renderStyle": "standard"
}
}
connect(voltage_source.p, emf.p) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 0, "y": 435}, {"x": 0, "y": 20}, {"x": 270, "y": 20}],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(voltage_source.n, emf.n) {
"Dyad": {
"edges": [
{"S": 1, "M": [], "E": -1},
{"S": -1, "M": [{"x": 335, "y": 305}, {"x": 270, "y": 305}], "E": 2}
],
"junctions": [{"x": 335, "y": 435}],
"renderStyle": "standard"
}
}
connect(emf.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 270, "y": 305}, {"x": 335, "y": 305}], "E": -1},
{"S": -1, "M": [{"x": 470, "y": 435}], "E": 2}
],
"junctions": [{"x": 335, "y": 435}],
"renderStyle": "standard"
}
}
connect(fixed.flange, emf.support) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 90, "y": 160}], "E": 2}],
"renderStyle": "standard"
}
}
connect(emf.flange, mass.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"icons": {"default": "dyad://ElectricalComponents/Example.svg"},
"tests": {
"case1": {"stop": 1, "expect": {"signals": ["emf.v", "emf.i", "emf.s", "emf.vel"]}}
}
}
}
endFlattened Source
dyad
"""
Test circuit for TranslationalEMF driven by a sinusoidal voltage with a mass load.
A sine voltage source (amplitude=1 V, frequency=1 Hz) drives a TranslationalEMF
(k=1 N/A). The mechanical flange is connected to a sliding mass (m=1 kg,
horizontal, no gravity). The support is grounded via a Fixed component.
With an ideal voltage source and k=1:
- vel = v/k = sin(2π·t)
- s = (1 − cos(2π·t))/(2π)
- a = 2π·cos(2π·t)
- f = m·a = 2π·cos(2π·t)
- i = −f/k = −2π·cos(2π·t)
Analogous to `RotationalEMFTest` in the standard library.
"""
test component TranslationalEMF
"Sine signal: amplitude=1, frequency=1 Hz"
sine = BlockComponents.Sources.Sine(amplitude = 1, frequency = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 10, "y1": 490, "x2": 110, "y2": 590, "rot": 0}
},
"tags": []
}
}
"Voltage source driven by sine"
voltage_source = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 155, "y1": 485, "x2": 255, "y2": 385, "rot": 0}
},
"tags": []
}
}
"Translational EMF with k=1 N/A"
emf = ElectricalComponents.Analog.Basic.TranslationalEMF(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 220, "y1": 110, "x2": 320, "y2": 210, "rot": 0}
},
"tags": []
}
}
"Electrical ground"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 420, "y1": 490, "x2": 520, "y2": 590, "rot": 0}
},
"tags": []
}
}
"Mechanical ground for EMF support"
fixed = TranslationalComponents.Components.Fixed() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 40, "y1": 180, "x2": 140, "y2": 280, "rot": 0}
},
"tags": []
}
}
"Sliding mass (1 kg, horizontal)"
mass = TranslationalComponents.Components.Mass(m = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 440, "y1": 110, "x2": 540, "y2": 210, "rot": 0}
},
"tags": []
}
}
relations
initial emf.s = 0
connect(sine.y, voltage_source.V) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 205, "y": 540}], "E": 2}],
"renderStyle": "standard"
}
}
connect(voltage_source.p, emf.p) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 0, "y": 435}, {"x": 0, "y": 20}, {"x": 270, "y": 20}],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(voltage_source.n, emf.n) {
"Dyad": {
"edges": [
{"S": 1, "M": [], "E": -1},
{"S": -1, "M": [{"x": 335, "y": 305}, {"x": 270, "y": 305}], "E": 2}
],
"junctions": [{"x": 335, "y": 435}],
"renderStyle": "standard"
}
}
connect(emf.n, ground.g) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 270, "y": 305}, {"x": 335, "y": 305}], "E": -1},
{"S": -1, "M": [{"x": 470, "y": 435}], "E": 2}
],
"junctions": [{"x": 335, "y": 435}],
"renderStyle": "standard"
}
}
connect(fixed.flange, emf.support) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 90, "y": 160}], "E": 2}],
"renderStyle": "standard"
}
}
connect(emf.flange, mass.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
"Dyad": {
"icons": {"default": "dyad://ElectricalComponents/Example.svg"},
"tests": {
"case1": {"stop": 1, "expect": {"signals": ["emf.v", "emf.i", "emf.s", "emf.vel"]}}
}
}
}
endTest Cases
Test Case case1
julia
pltjulia
pltjulia
pltjulia
pltRelated
Examples
Experiments
Analyses
Tests