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": 350, "y1": 670, "x2": 450, "y2": 770, "rot": 0}
},
"tags": []
}
}
"Voltage source driven by sine"
voltage_source = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 550, "x2": 550, "y2": 450, "rot": 0}
},
"tags": []
}
}
"Translational EMF with k=1 N/A"
emf = ElectricalComponents.Analog.Basic.TranslationalEMF(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 150, "x2": 550, "y2": 250, "rot": 0}
},
"tags": []
}
}
"Electrical ground"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 820, "y1": 680, "x2": 920, "y2": 780, "rot": 0}
},
"tags": []
}
}
"Mechanical ground for EMF support"
fixed = TranslationalComponents.Components.Fixed() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 230, "y1": 320, "x2": 330, "y2": 420, "rot": 90}
},
"tags": []
}
}
"Sliding mass (1 kg, horizontal)"
mass = TranslationalComponents.Components.Mass(m = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 810, "y1": 270, "x2": 910, "y2": 370, "rot": 0}
},
"tags": []
}
}
relations
initial emf.s = 0
connect(sine.y, voltage_source.V) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 500, "y": 720}], "E": 2}],
"renderStyle": "standard"
}
}
connect(voltage_source.p, emf.p) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 110, "y": 500}, {"x": 110, "y": 80}, {"x": 500, "y": 80}],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(fixed.flange, emf.support) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 370, "y": 370}, {"x": 370, "y": 200}], "E": 2}],
"renderStyle": "standard"
}
}
connect(emf.flange, mass.flange_a) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 770, "y": 200}, {"x": 770, "y": 320}], "E": 2}],
"renderStyle": "standard"
}
}
connect(ground.g, voltage_source.n) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 870, "y": 500}], "E": 2}]
}
}
connect(emf.n, voltage_source.n) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 500, "y": 290}, {"x": 690, "y": 290}, {"x": 690, "y": 500}],
"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": 350, "y1": 670, "x2": 450, "y2": 770, "rot": 0}
},
"tags": []
}
}
"Voltage source driven by sine"
voltage_source = ElectricalComponents.Analog.Sources.VoltageSource() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 550, "x2": 550, "y2": 450, "rot": 0}
},
"tags": []
}
}
"Translational EMF with k=1 N/A"
emf = ElectricalComponents.Analog.Basic.TranslationalEMF(k = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 150, "x2": 550, "y2": 250, "rot": 0}
},
"tags": []
}
}
"Electrical ground"
ground = ElectricalComponents.Analog.Basic.Ground() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 820, "y1": 680, "x2": 920, "y2": 780, "rot": 0}
},
"tags": []
}
}
"Mechanical ground for EMF support"
fixed = TranslationalComponents.Components.Fixed() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 230, "y1": 320, "x2": 330, "y2": 420, "rot": 90}
},
"tags": []
}
}
"Sliding mass (1 kg, horizontal)"
mass = TranslationalComponents.Components.Mass(m = 1) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 810, "y1": 270, "x2": 910, "y2": 370, "rot": 0}
},
"tags": []
}
}
relations
initial emf.s = 0
connect(sine.y, voltage_source.V) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 500, "y": 720}], "E": 2}],
"renderStyle": "standard"
}
}
connect(voltage_source.p, emf.p) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 110, "y": 500}, {"x": 110, "y": 80}, {"x": 500, "y": 80}],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(fixed.flange, emf.support) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 370, "y": 370}, {"x": 370, "y": 200}], "E": 2}],
"renderStyle": "standard"
}
}
connect(emf.flange, mass.flange_a) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 770, "y": 200}, {"x": 770, "y": 320}], "E": 2}],
"renderStyle": "standard"
}
}
connect(ground.g, voltage_source.n) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 870, "y": 500}], "E": 2}]
}
}
connect(emf.n, voltage_source.n) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [{"x": 500, "y": 290}, {"x": 690, "y": 290}, {"x": 690, "y": 500}],
"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