Skip to content
LIBRARY
Examples.PreLoad.md

Examples.PreLoad

Preload of a spool using ElastoGap models.

Replicates the structure of Modelica.Mechanics.Translational.Examples.PreLoad.

A spool is driven by a sinusoidal force inside a housing. The spool makes contact with spring-loaded plates through ElastoGap elements (inner contacts). The spring plates are themselves constrained by outer ElastoGap contacts against the housing/fixed reference.

The model demonstrates how preload forces (from the compressed spring) interact with contact forces at the inner and outer ElastoGap interfaces.

Note: MSL uses a one-flange Force source. Here we use the two-flange Force with flange_b connected to a Fixed ground. Each ElastoGap heat_port is connected to a FixedTemperature boundary since Dyad has no conditional connectors.

Usage

TranslationalComponents.Examples.PreLoad()

Behavior

[connect(outercontact_a+flange_a,fixedle+flange)connect(outercontact_a+flange_b,springplate_a+flange_a)connect(springplate_a+flange_b,spring+flangea)connect(spring+flangeb,springplate_b+flange_a)connect(springplate_b+flange_b,outercontact_b+flange_a)connect(outercontact_b+flange_b,housing+flangeb)connect(housing+flangea,fixedle+flange)connect(springplate_a+flange_b,rod1+flangea)connect(rod2+flangeb,springplate_b+flange_a)connect(innercontact_a+flange_a,rod3+flangea)connect(innercontact_a+flange_b,rod1+flangeb)connect(rod2+flangea,innercontact_b+flange_a)connect(rod4+flangeb,innercontact_b+flange_b)connect(rod3+flangeb,rod4+flangea)connect(spool+flangea,rod4+flangea)connect(friction+flangea,fixedle+flange)connect(friction+flangeb,rod3+flangea)connect(sineforce+y,force+f)connect(force+flangeb,spool+flangea)connect(force+flangea,forceground+flange)connect(outercontact_a+heat_port,thermal1+port)connect(outercontact_b+heat_port,thermal2+port)connect(innercontact_a+heat_port,thermal3+port)connect(innercontact_b+heat_port,thermal4+port)fixedle.flange.s(t)=fixedle.s0housing.flangea.s(t)=12housing.L+housing.s(t)housing.flangeb.s(t)=housing.L2+housing.s(t)0=housing.flangeb.f(t)+housing.flangea.f(t)outercontact_a.s_rel(t)=outercontact_a.flange_a.s(t)+outercontact_a.flange_b.s(t)outercontact_a.v_rel(t)=doutercontact_a.s_rel(t)dtoutercontact_a.flange_b.f(t)=outercontact_a.f(t)outercontact_a.flange_a.f(t)=outercontact_a.f(t)outercontact_a.ratio(t)=outercontact_a.s_rel0+outercontact_a.s_rel(t)outercontact_a.s_refoutercontact_a.f_c(t)=ifelse(outercontact_a.s_rel(t)<outercontact_a.s_rel0,(|outercontact_a.ratio(t)|)outercontact_a.noutercontact_a.f_ref,0)outercontact_a.f_d2(t)=ifelse(outercontact_a.s_rel(t)<outercontact_a.s_rel0,outercontact_a.doutercontact_a.v_rel(t),0)outercontact_a.f_d(t)=ifelse(outercontact_a.s_rel(t)<outercontact_a.s_rel0,min(max(outercontact_a.f_d2(t),outercontact_a.f_c(t)),outercontact_a.f_c(t)),0)outercontact_a.f(t)=outercontact_a.f_d(t)+outercontact_a.f_c(t)outercontact_a.lossPower(t)=outercontact_a.f_d(t)outercontact_a.v_rel(t)outercontact_a.heat_port.Q_flow(t)=outercontact_a.lossPower(t)outercontact_b.s_rel(t)=outercontact_b.flange_b.s(t)outercontact_b.flange_a.s(t)outercontact_b.v_rel(t)=doutercontact_b.s_rel(t)dtoutercontact_b.flange_b.f(t)=outercontact_b.f(t)outercontact_b.flange_a.f(t)=outercontact_b.f(t)outercontact_b.ratio(t)=outercontact_b.s_rel0+outercontact_b.s_rel(t)outercontact_b.s_refoutercontact_b.f_c(t)=ifelse(outercontact_b.s_rel(t)<outercontact_b.s_rel0,(|outercontact_b.ratio(t)|)outercontact_b.noutercontact_b.f_ref,0)outercontact_b.f_d2(t)=ifelse(outercontact_b.s_rel(t)<outercontact_b.s_rel0,outercontact_b.doutercontact_b.v_rel(t),0)outercontact_b.f_d(t)=ifelse(outercontact_b.s_rel(t)<outercontact_b.s_rel0,min(max(outercontact_b.f_d2(t),outercontact_b.f_c(t)),outercontact_b.f_c(t)),0)outercontact_b.f(t)=outercontact_b.f_d(t)+outercontact_b.f_c(t)outercontact_b.lossPower(t)=outercontact_b.f_d(t)outercontact_b.v_rel(t)outercontact_b.heat_port.Q_flow(t)=outercontact_b.lossPower(t)springplate_a.flange_a.s(t)=12springplate_a.L+springplate_a.s(t)springplate_a.flange_b.s(t)=springplate_a.L2+springplate_a.s(t)springplate_a.v(t)=dspringplate_a.s(t)dtspringplate_a.a(t)=dspringplate_a.v(t)dt(springplate_a.a(t)+springplate_a.gsin(springplate_a.theta))springplate_a.m=springplate_a.flange_a.f(t)+springplate_a.flange_b.f(t)springplate_b.flange_a.s(t)=12springplate_b.L+springplate_b.s(t)springplate_b.flange_b.s(t)=springplate_b.L2+springplate_b.s(t)springplate_b.v(t)=dspringplate_b.s(t)dtspringplate_b.a(t)=dspringplate_b.v(t)dt(springplate_b.a(t)+springplate_b.gsin(springplate_b.theta))springplate_b.m=springplate_b.flange_b.f(t)+springplate_b.flange_a.f(t)spring.srel(t)=spring.flangeb.s(t)spring.flangea.s(t)spring.flangeb.f(t)=spring.f(t)spring.flangea.f(t)=spring.f(t)spring.f(t)=spring.c(spring.srel0+spring.srel(t))rod1.flangea.s(t)=12rod1.L+rod1.s(t)rod1.flangeb.s(t)=rod1.L2+rod1.s(t)0=rod1.flangea.f(t)+rod1.flangeb.f(t)rod2.flangea.s(t)=12rod2.L+rod2.s(t)rod2.flangeb.s(t)=rod2.L2+rod2.s(t)0=rod2.flangea.f(t)+rod2.flangeb.f(t)rod3.flangea.s(t)=12rod3.L+rod3.s(t)rod3.flangeb.s(t)=rod3.L2+rod3.s(t)0=rod3.flangea.f(t)+rod3.flangeb.f(t)rod4.flangea.s(t)=12rod4.L+rod4.s(t)rod4.flangeb.s(t)=rod4.L2+rod4.s(t)0=rod4.flangea.f(t)+rod4.flangeb.f(t)innercontact_a.s_rel(t)=innercontact_a.flange_a.s(t)+innercontact_a.flange_b.s(t)innercontact_a.v_rel(t)=dinnercontact_a.s_rel(t)dtinnercontact_a.flange_b.f(t)=innercontact_a.f(t)innercontact_a.flange_a.f(t)=innercontact_a.f(t)innercontact_a.ratio(t)=innercontact_a.s_rel0+innercontact_a.s_rel(t)innercontact_a.s_refinnercontact_a.f_c(t)=ifelse(innercontact_a.s_rel(t)<innercontact_a.s_rel0,(|innercontact_a.ratio(t)|)innercontact_a.ninnercontact_a.f_ref,0)innercontact_a.f_d2(t)=ifelse(innercontact_a.s_rel(t)<innercontact_a.s_rel0,innercontact_a.dinnercontact_a.v_rel(t),0)innercontact_a.f_d(t)=ifelse(innercontact_a.s_rel(t)<innercontact_a.s_rel0,min(max(innercontact_a.f_d2(t),innercontact_a.f_c(t)),innercontact_a.f_c(t)),0)innercontact_a.f(t)=innercontact_a.f_c(t)+innercontact_a.f_d(t)innercontact_a.lossPower(t)=innercontact_a.v_rel(t)innercontact_a.f_d(t)innercontact_a.heat_port.Q_flow(t)=innercontact_a.lossPower(t)innercontact_b.s_rel(t)=innercontact_b.flange_a.s(t)+innercontact_b.flange_b.s(t)innercontact_b.v_rel(t)=dinnercontact_b.s_rel(t)dtinnercontact_b.flange_b.f(t)=innercontact_b.f(t)innercontact_b.flange_a.f(t)=innercontact_b.f(t)innercontact_b.ratio(t)=innercontact_b.s_rel0+innercontact_b.s_rel(t)innercontact_b.s_refinnercontact_b.f_c(t)=ifelse(innercontact_b.s_rel(t)<innercontact_b.s_rel0,(|innercontact_b.ratio(t)|)innercontact_b.ninnercontact_b.f_ref,0)innercontact_b.f_d2(t)=ifelse(innercontact_b.s_rel(t)<innercontact_b.s_rel0,innercontact_b.dinnercontact_b.v_rel(t),0)innercontact_b.f_d(t)=ifelse(innercontact_b.s_rel(t)<innercontact_b.s_rel0,min(max(innercontact_b.f_d2(t),innercontact_b.f_c(t)),innercontact_b.f_c(t)),0)innercontact_b.f(t)=innercontact_b.f_d(t)+innercontact_b.f_c(t)innercontact_b.lossPower(t)=innercontact_b.f_d(t)innercontact_b.v_rel(t)innercontact_b.heat_port.Q_flow(t)=innercontact_b.lossPower(t)friction.srel(t)=friction.flangea.s(t)+friction.flangeb.s(t)friction.vrel(t)=dfriction.srel(t)dtfriction.flangeb.f(t)=friction.f(t)friction.flangea.f(t)=friction.f(t)friction.f(t)=friction.dfriction.vrel(t)friction.lossPower(t)=friction.vrel(t)friction.f(t)spool.flangea.s(t)=12spool.L+spool.s(t)spool.flangeb.s(t)=spool.L2+spool.s(t)spool.v(t)=dspool.s(t)dtspool.a(t)=dspool.v(t)dt(spool.a(t)+spool.gsin(spool.theta))spool.m=spool.flangea.f(t)+spool.flangeb.f(t)sineforce.y(t)=sineforce.offset+sineforce.amplitudeifelse(tsineforce.start_time,sin(sineforce.phase+6.283185307179586sineforce.frequency(sineforce.start_time+t)),sin(sineforce.phase))force.flangea.f(t)=force.f(t)force.flangeb.f(t)=force.f(t)forceground.flange.s(t)=forceground.s0thermal1.port.T(t)=thermal1.Tthermal2.port.T(t)=thermal2.Tthermal3.port.T(t)=thermal3.Tthermal4.port.T(t)=thermal4.T]

Source

dyad
"""
Preload of a spool using ElastoGap models.

Replicates the structure of Modelica.Mechanics.Translational.Examples.PreLoad.

A spool is driven by a sinusoidal force inside a housing. The spool makes
contact with spring-loaded plates through ElastoGap elements (inner contacts).
The spring plates are themselves constrained by outer ElastoGap contacts
against the housing/fixed reference.

The model demonstrates how preload forces (from the compressed spring)
interact with contact forces at the inner and outer ElastoGap interfaces.

Note: MSL uses a one-flange Force source. Here we use the two-flange Force
with flange_b connected to a Fixed ground. Each ElastoGap heat_port is
connected to a FixedTemperature boundary since Dyad has no conditional
connectors.
"""
example component PreLoad
  "Left fixed reference"
  fixed_le = TranslationalComponents.Components.Fixed(s0 = -0.0955) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 780, "x2": 530, "y2": 880, "rot": 0}
      },
      "tags": []
    }
  }
  "Housing rod"
  housing = TranslationalComponents.Components.Rod(L = 0.0305) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 675, "x2": 670, "y2": 775, "rot": 0}
      },
      "tags": []
    }
  }
  "Outer contact A (left)"
  outer_contact_a = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.0015) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 1300, "x2": 250, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Outer contact B (right)"
  outer_contact_b = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.0015) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 700, "y1": 1370, "x2": 800, "y2": 1470, "rot": 0}
      },
      "tags": []
    }
  }
  "Spring plate A (left)"
  spring_plate_a = TranslationalComponents.Components.Mass(m = 10e-3, L = 0.002, s = initial -0.093, v = initial 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 1300, "x2": 390, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Spring plate B (right)"
  spring_plate_b = TranslationalComponents.Components.Mass(m = 10e-3, L = 0.002, s = initial -0.06925, v = initial 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 1300, "x2": 670, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Main spring between plates"
  spring = TranslationalComponents.Components.Spring(c = 20e3, s_rel0 = 0.025) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 1300, "x2": 530, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod from springPlateA to inner contact area"
  rod1 = TranslationalComponents.Components.Rod(L = 0.007) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 1180, "x2": 530, "y2": 1280, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod from inner contact area to springPlateB"
  rod2 = TranslationalComponents.Components.Rod(L = 0.007) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 980, "x2": 530, "y2": 1080, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod for inner spool area (left side)"
  rod3 = TranslationalComponents.Components.Rod(L = 0.00575) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 555, "x2": 530, "y2": 655, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod for inner spool area (right side)"
  rod4 = TranslationalComponents.Components.Rod(L = 0.00575) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 555, "x2": 670, "y2": 655, "rot": 0}
      },
      "tags": []
    }
  }
  "Inner contact A"
  inner_contact_a = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.001) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 1080, "x2": 390, "y2": 1180, "rot": 0}
      },
      "tags": []
    }
  }
  "Inner contact B"
  inner_contact_b = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.001) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 700, "y1": 1130, "x2": 800, "y2": 1230, "rot": 0}
      },
      "tags": []
    }
  }
  "Friction (modelled as damper)"
  friction = TranslationalComponents.Components.Damper(d = 2500) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 555, "x2": 390, "y2": 655, "rot": 0}
      },
      "tags": []
    }
  }
  "Spool"
  spool = TranslationalComponents.Components.Mass(L = 0.19, m = 0.150, s = initial 0.01475, v = initial 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 490, "y1": 210, "x2": 590, "y2": 310, "rot": 0}
      },
      "tags": []
    }
  }
  "Sinusoidal driving force signal"
  sine_force = BlockComponents.Sources.Sine(amplitude = 150, frequency = 0.01) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 20, "x2": 150, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "Force source (two-flange)"
  force = TranslationalComponents.Sources.Force() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 70, "x2": 300, "y2": 170, "rot": 0}
      },
      "tags": []
    }
  }
  "Ground for force source"
  force_ground = TranslationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 740, "y1": 180, "x2": 840, "y2": 280, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for outer contact A"
  thermal1 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 1350, "x2": 120, "y2": 1450, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for outer contact B"
  thermal2 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 1420, "x2": 670, "y2": 1520, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for inner contact A"
  thermal3 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 145, "y1": 1130, "x2": 245, "y2": 1230, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for inner contact B"
  thermal4 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 1180, "x2": 670, "y2": 1280, "rot": 0}
      },
      "tags": []
    }
  }
relations
  # Outer spring-plate chain
  connect(outer_contact_a.flange_a, fixed_le.flange) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 135, "y": 1350}, {"x": 135, "y": 725}], "E": -1},
        {"S": -1, "M": [], "E": 2}
      ],
      "junctions": [{"x": 480, "y": 725}],
      "renderStyle": "standard"
    }
  }
  connect(outer_contact_a.flange_b, spring_plate_a.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring_plate_a.flange_b, spring.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring.flange_b, spring_plate_b.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring_plate_b.flange_b, outer_contact_b.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 685, "y": 1350}, {"x": 685, "y": 1420}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(outer_contact_b.flange_b, housing.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 815, "y": 1420}, {"x": 815, "y": 725}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(housing.flange_a, fixed_le.flange) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 480, "y": 725}],
      "renderStyle": "standard"
    }
  }
  # Rods connecting spring plates to inner contact area
  connect(spring_plate_a.flange_b, rod1.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [{"x": 405, "y": 1230}], "E": 2}],
      "junctions": [{"x": 405, "y": 1350}],
      "renderStyle": "standard"
    }
  }
  connect(rod2.flange_b, spring_plate_b.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 555, "y": 1030}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 555, "y": 1350}],
      "renderStyle": "standard"
    }
  }
  # Inner contact area
  connect(inner_contact_a.flange_a, rod3.flange_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 265, "y": 1130}, {"x": 265, "y": 505}, {"x": 405, "y": 505}],
          "E": -1
        },
        {"S": -1, "M": [], "E": 2}
      ],
      "junctions": [{"x": 405, "y": 605}],
      "renderStyle": "standard"
    }
  }
  connect(inner_contact_a.flange_b, rod1.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 545, "y": 1130}, {"x": 545, "y": 1230}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(rod2.flange_a, inner_contact_b.flange_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 415, "y": 1030},
            {"x": 415, "y": 930},
            {"x": 685, "y": 930},
            {"x": 685, "y": 1180}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(rod4.flange_b, inner_contact_b.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 825, "y": 605}, {"x": 825, "y": 1180}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # Inner rods and spool
  connect(rod3.flange_b, rod4.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spool.flange_a, rod4.flange_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 422.5, "y": 260}, {"x": 422.5, "y": 405}], "E": -1},
        {"S": -1, "M": [{"x": 415, "y": 505}, {"x": 545, "y": 505}], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 415, "y": 405}, {"x": 545, "y": 605}],
      "renderStyle": "standard"
    }
  }
  # Friction from fixed reference
  connect(friction.flange_a, fixed_le.flange) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 275, "y": 605}], "E": -1},
        {"S": -1, "M": [], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 275, "y": 725}, {"x": 480, "y": 725}],
      "renderStyle": "standard"
    }
  }
  connect(friction.flange_b, rod3.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  # Force source
  connect(sine_force.y, force.f) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 350, "y": 70}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(force.flange_b, spool.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 275, "y": 120}, {"x": 275, "y": 260}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(force.flange_a, force_ground.flange) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 790, "y": 120}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # Thermal connections
  connect(outer_contact_a.heat_port, thermal1.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(outer_contact_b.heat_port, thermal2.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(inner_contact_a.heat_port, thermal3.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(inner_contact_b.heat_port, thermal4.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 100,
        "atol": {
          "spool.s": 0.001,
          "friction.v_rel": 0.001,
          "inner_contact_a.s_rel": 0.001,
          "inner_contact_b.s_rel": 0.001,
          "outer_contact_a.v_rel": 0.001,
          "outer_contact_b.s_rel": 0.001,
          "outer_contact_b.v_rel": 0.001
        },
        "expect": {
          "final": {"spool.s": 0.01475},
          "signals": [
            "spool.s",
            "friction.v_rel",
            "inner_contact_a.s_rel",
            "inner_contact_b.s_rel",
            "outer_contact_a.v_rel",
            "outer_contact_b.s_rel",
            "outer_contact_b.v_rel"
          ]
        }
      }
    }
  }
}
end
Flattened Source
dyad
"""
Preload of a spool using ElastoGap models.

Replicates the structure of Modelica.Mechanics.Translational.Examples.PreLoad.

A spool is driven by a sinusoidal force inside a housing. The spool makes
contact with spring-loaded plates through ElastoGap elements (inner contacts).
The spring plates are themselves constrained by outer ElastoGap contacts
against the housing/fixed reference.

The model demonstrates how preload forces (from the compressed spring)
interact with contact forces at the inner and outer ElastoGap interfaces.

Note: MSL uses a one-flange Force source. Here we use the two-flange Force
with flange_b connected to a Fixed ground. Each ElastoGap heat_port is
connected to a FixedTemperature boundary since Dyad has no conditional
connectors.
"""
example component PreLoad
  "Left fixed reference"
  fixed_le = TranslationalComponents.Components.Fixed(s0 = -0.0955) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 780, "x2": 530, "y2": 880, "rot": 0}
      },
      "tags": []
    }
  }
  "Housing rod"
  housing = TranslationalComponents.Components.Rod(L = 0.0305) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 675, "x2": 670, "y2": 775, "rot": 0}
      },
      "tags": []
    }
  }
  "Outer contact A (left)"
  outer_contact_a = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.0015) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 150, "y1": 1300, "x2": 250, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Outer contact B (right)"
  outer_contact_b = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.0015) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 700, "y1": 1370, "x2": 800, "y2": 1470, "rot": 0}
      },
      "tags": []
    }
  }
  "Spring plate A (left)"
  spring_plate_a = TranslationalComponents.Components.Mass(m = 10e-3, L = 0.002, s = initial -0.093, v = initial 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 1300, "x2": 390, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Spring plate B (right)"
  spring_plate_b = TranslationalComponents.Components.Mass(m = 10e-3, L = 0.002, s = initial -0.06925, v = initial 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 1300, "x2": 670, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Main spring between plates"
  spring = TranslationalComponents.Components.Spring(c = 20e3, s_rel0 = 0.025) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 1300, "x2": 530, "y2": 1400, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod from springPlateA to inner contact area"
  rod1 = TranslationalComponents.Components.Rod(L = 0.007) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 1180, "x2": 530, "y2": 1280, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod from inner contact area to springPlateB"
  rod2 = TranslationalComponents.Components.Rod(L = 0.007) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 980, "x2": 530, "y2": 1080, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod for inner spool area (left side)"
  rod3 = TranslationalComponents.Components.Rod(L = 0.00575) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 430, "y1": 555, "x2": 530, "y2": 655, "rot": 0}
      },
      "tags": []
    }
  }
  "Rod for inner spool area (right side)"
  rod4 = TranslationalComponents.Components.Rod(L = 0.00575) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 555, "x2": 670, "y2": 655, "rot": 0}
      },
      "tags": []
    }
  }
  "Inner contact A"
  inner_contact_a = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.001) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 1080, "x2": 390, "y2": 1180, "rot": 0}
      },
      "tags": []
    }
  }
  "Inner contact B"
  inner_contact_b = TranslationalComponents.Components.ElastoGap(c = 1000e3, d = 250, s_rel0 = 0.001) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 700, "y1": 1130, "x2": 800, "y2": 1230, "rot": 0}
      },
      "tags": []
    }
  }
  "Friction (modelled as damper)"
  friction = TranslationalComponents.Components.Damper(d = 2500) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 290, "y1": 555, "x2": 390, "y2": 655, "rot": 0}
      },
      "tags": []
    }
  }
  "Spool"
  spool = TranslationalComponents.Components.Mass(L = 0.19, m = 0.150, s = initial 0.01475, v = initial 0) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 490, "y1": 210, "x2": 590, "y2": 310, "rot": 0}
      },
      "tags": []
    }
  }
  "Sinusoidal driving force signal"
  sine_force = BlockComponents.Sources.Sine(amplitude = 150, frequency = 0.01) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 20, "x2": 150, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  "Force source (two-flange)"
  force = TranslationalComponents.Sources.Force() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 70, "x2": 300, "y2": 170, "rot": 0}
      },
      "tags": []
    }
  }
  "Ground for force source"
  force_ground = TranslationalComponents.Components.Fixed() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 740, "y1": 180, "x2": 840, "y2": 280, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for outer contact A"
  thermal1 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 1350, "x2": 120, "y2": 1450, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for outer contact B"
  thermal2 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 1420, "x2": 670, "y2": 1520, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for inner contact A"
  thermal3 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 145, "y1": 1130, "x2": 245, "y2": 1230, "rot": 0}
      },
      "tags": []
    }
  }
  "Thermal boundary for inner contact B"
  thermal4 = ThermalComponents.Sources.FixedTemperature(T = 293.15) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 570, "y1": 1180, "x2": 670, "y2": 1280, "rot": 0}
      },
      "tags": []
    }
  }
relations
  # Outer spring-plate chain
  connect(outer_contact_a.flange_a, fixed_le.flange) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 135, "y": 1350}, {"x": 135, "y": 725}], "E": -1},
        {"S": -1, "M": [], "E": 2}
      ],
      "junctions": [{"x": 480, "y": 725}],
      "renderStyle": "standard"
    }
  }
  connect(outer_contact_a.flange_b, spring_plate_a.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring_plate_a.flange_b, spring.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring.flange_b, spring_plate_b.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spring_plate_b.flange_b, outer_contact_b.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 685, "y": 1350}, {"x": 685, "y": 1420}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(outer_contact_b.flange_b, housing.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 815, "y": 1420}, {"x": 815, "y": 725}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(housing.flange_a, fixed_le.flange) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 480, "y": 725}],
      "renderStyle": "standard"
    }
  }
  # Rods connecting spring plates to inner contact area
  connect(spring_plate_a.flange_b, rod1.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [{"x": 405, "y": 1230}], "E": 2}],
      "junctions": [{"x": 405, "y": 1350}],
      "renderStyle": "standard"
    }
  }
  connect(rod2.flange_b, spring_plate_b.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 555, "y": 1030}], "E": -1}, {"S": -1, "M": [], "E": 2}],
      "junctions": [{"x": 555, "y": 1350}],
      "renderStyle": "standard"
    }
  }
  # Inner contact area
  connect(inner_contact_a.flange_a, rod3.flange_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 265, "y": 1130}, {"x": 265, "y": 505}, {"x": 405, "y": 505}],
          "E": -1
        },
        {"S": -1, "M": [], "E": 2}
      ],
      "junctions": [{"x": 405, "y": 605}],
      "renderStyle": "standard"
    }
  }
  connect(inner_contact_a.flange_b, rod1.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 545, "y": 1130}, {"x": 545, "y": 1230}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(rod2.flange_a, inner_contact_b.flange_a) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 415, "y": 1030},
            {"x": 415, "y": 930},
            {"x": 685, "y": 930},
            {"x": 685, "y": 1180}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(rod4.flange_b, inner_contact_b.flange_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 825, "y": 605}, {"x": 825, "y": 1180}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # Inner rods and spool
  connect(rod3.flange_b, rod4.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(spool.flange_a, rod4.flange_a) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 422.5, "y": 260}, {"x": 422.5, "y": 405}], "E": -1},
        {"S": -1, "M": [{"x": 415, "y": 505}, {"x": 545, "y": 505}], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 415, "y": 405}, {"x": 545, "y": 605}],
      "renderStyle": "standard"
    }
  }
  # Friction from fixed reference
  connect(friction.flange_a, fixed_le.flange) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [{"x": 275, "y": 605}], "E": -1},
        {"S": -1, "M": [], "E": -2},
        {"S": -2, "M": [], "E": 2}
      ],
      "junctions": [{"x": 275, "y": 725}, {"x": 480, "y": 725}],
      "renderStyle": "standard"
    }
  }
  connect(friction.flange_b, rod3.flange_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  # Force source
  connect(sine_force.y, force.f) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 350, "y": 70}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(force.flange_b, spool.flange_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 275, "y": 120}, {"x": 275, "y": 260}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(force.flange_a, force_ground.flange) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 790, "y": 120}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  # Thermal connections
  connect(outer_contact_a.heat_port, thermal1.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(outer_contact_b.heat_port, thermal2.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(inner_contact_a.heat_port, thermal3.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(inner_contact_b.heat_port, thermal4.port) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {
  "Dyad": {
    "icons": {"default": "dyad://TranslationalComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 100,
        "atol": {
          "spool.s": 0.001,
          "friction.v_rel": 0.001,
          "inner_contact_a.s_rel": 0.001,
          "inner_contact_b.s_rel": 0.001,
          "outer_contact_a.v_rel": 0.001,
          "outer_contact_b.s_rel": 0.001,
          "outer_contact_b.v_rel": 0.001
        },
        "expect": {
          "final": {"spool.s": 0.01475},
          "signals": [
            "spool.s",
            "friction.v_rel",
            "inner_contact_a.s_rel",
            "inner_contact_b.s_rel",
            "outer_contact_a.v_rel",
            "outer_contact_b.s_rel",
            "outer_contact_b.v_rel"
          ]
        }
      }
    }
  }
}
end


Test Cases

Test Case case1

julia
plt

julia
plt

julia
plt

julia
plt

julia
plt

julia
plt

julia
plt

  • Examples

  • Experiments

  • Analyses