"""Lumped thermal + phase-transformation model of Flexinol LT (70 C) SMA wire. Data-sheet inputs (Dynalloy Flexinol technical data, LT wire): diameter, resistance per metre, heating pull force, cooling deformation (bias) force, current for ~1 s contraction, cooling time. Model, per unit length of wire: m' c_eff(T) dT/dt = I^2 R' - h pi d (T - T_amb) c_eff adds the latent heat of transformation inside the transformation band. Nothing is fitted. h comes from the Churchill-Chu natural-convection correlation for a thin horizontal cylinder, and the zero-stress transformation temperatures are shifted up by the bias stress (Clausius-Clapeyron, ~8 MPa/K). Heating and cooling times are therefore predictions that can be checked against the data sheet (~1 s heat, 1.1-2.0 s cool). """ import numpy as np from scipy.optimize import brentq RHO = 6450.0 # kg/m^3 NiTi density CP = 837.0 # J/kg.K specific heat (0.2 cal/g.C) LATENT = 24.2e3 # J/kg latent heat of transformation BIAS_STRESS = 71.0 # MPa data-sheet bias force / wire area (same for all sizes) CC = 8.0 # MPa/K Clausius-Clapeyron slope (typical 6-13) SHIFT = BIAS_STRESS / CC AS, AF = 68.0 + SHIFT, 78.0 + SHIFT # C austenite start/finish under load MS, MF = 52.0 + SHIFT, 42.0 + SHIFT # C martensite start/finish under load T_AMB = 28.0 # C Malaysian room temperature G = 9.81 # name: (d [m], R' [ohm/m], pull [gf], bias [gf], I_rec [A], t_cool [s]) WIRES = { "0.10 mm": (0.10e-3, 126.0, 143.0, 57.0, 0.200, 1.1), "0.13 mm": (0.13e-3, 75.0, 223.0, 89.0, 0.320, 1.6), "0.15 mm": (0.15e-3, 55.0, 321.0, 128.0, 0.410, 2.0), } def _step(T, xi, I, d, Rm, h, dt, t_amb): """Advance temperature T and martensite fraction xi by dt.""" m = RHO * np.pi * d**2 / 4.0 q = I**2 * Rm - h * np.pi * d * (T - t_amb) heating = q > 0 c = CP if heating and AS <= T <= AF and xi > 0: c += LATENT / (AF - AS) if (not heating) and MF <= T <= MS and xi < 1: c += LATENT / (MS - MF) T = T + q / (m * c) * dt if heating and T > AS: xi = min(xi, np.clip((AF - T) / (AF - AS), 0, 1)) if (not heating) and T < MS: xi = max(xi, np.clip((MS - T) / (MS - MF), 0, 1)) return T, xi def simulate(current_fn, d, Rm, h, t_end, dt=1e-3, t_amb=T_AMB): """Return t, T, strain_fraction (0 = relaxed, 1 = fully contracted).""" n = int(t_end / dt) t = np.arange(n) * dt T = np.empty(n); xi = np.empty(n) Tc, x = t_amb, 1.0 for i in range(n): Tc, x = _step(Tc, x, current_fn(t[i]), d, Rm, h, dt, t_amb) T[i], xi[i] = Tc, x return t, T, 1.0 - xi def cooling_time(h, d, Rm, t_amb=T_AMB): """Time from fully contracted (just above Af) to fully relaxed (Mf).""" Tc, x, t, dt = AF + 2.0, 0.0, 0.0, 1e-3 while x < 0.999 and t < 60: Tc, x = _step(Tc, x, 0.0, d, Rm, h, dt, t_amb) t += dt return t def h_natural(d, T_wire=75.0, t_amb=T_AMB): """Churchill-Chu natural convection, horizontal cylinder, air at film temp.""" Tf = 0.5 * (T_wire + t_amb) + 273.15 k, nu, alpha, Pr = 0.0282, 1.85e-5, 2.6e-5, 0.71 Ra = G * (1 / Tf) * (T_wire - t_amb) * d**3 / (nu * alpha) Nu = (0.6 + 0.387 * Ra**(1 / 6) / (1 + (0.559 / Pr)**(9 / 16))**(8 / 27))**2 return Nu * k / d def heating_time(I, d, Rm, h, t_amb=T_AMB, t_max=20.0): """Time from ambient to full contraction at constant current (inf if never).""" Tc, x, t, dt = t_amb, 1.0, 0.0, 1e-3 while x > 0.001 and t < t_max: Tc, x = _step(Tc, x, I, d, Rm, h, dt, t_amb) t += dt return t if t < t_max else np.inf def fitted(): """dict name -> dict of wire parameters including fitted h.""" out = {} for name, (d, Rm, pull, bias, Irec, tc) in WIRES.items(): h = h_natural(d) out[name] = dict(d=d, Rm=Rm, pull_N=pull * G / 1000, bias_N=bias * G / 1000, I_rec=Irec, t_cool=tc, h=h) return out