1

I am studding automatic and have a matlab/SIMULINK model of nonlinear vibration. I am trying to resolve the same problem using python instead.

Here we have a schema. The black frame is a part that I have already. I also have a Model tłumnika MR (eng. Magnetorheological Damper). Just I don't know how to connect it together? enter image description here

There are welcome any suggestion how to resolve this including modifying model.


Code for part 1 (black frame) [just pseudo code ]

def rms(v):  # ROOT MEAN SQRT
    return np.sqrt(np.mean(np.square(v))) 

def transmissibility(_in, _out):
    # Transmissibility (T) = output/input
    return rms(_out) / rms(_in)

def q(ss, t, Ampituda, freqs):
    y2 = []
    for f in freqs:
        u = Ampituda * np.sin(2 * np.pi * f * t)  # wektor wejscia
        t1, y1, x1 = signal.lsim(ss, u, t)  # wyliczenie modelu w dziedzinie czasu
        y2.append(transmissibility(u, y1))
    return y2

vec_c = np.arange(1000, 6000 , 1000)
for c in vec_c:
    A = [[0, 1], [-(k/m), -(c/m)]]
    B = [[-c/m], [(k/m) - (c/m)**2]]
    C = [1, 0]
    D = 0
    ss = signal.StateSpace(A,B,C,D)  # State Space model
    y2 = q(ss, t, Ampituda, freqs)
    plt.plot(freqs, y2, label=r'$c = {} \frac{}{} $'.format(c, "{Ns}", "{m}"), linewidth=2.0)
    plt.legend()

Code for MR (Model tłumnika MR) [copy paste example]

from scipy import signal
import numpy as np

def I(to_intagrate, dt, y0=0):
    i = [y0]
    for v in to_intagrate:
        i.append(i[-1] + v * dt)
    del i[0]
    return i


def MR(v, i, dt):
    """ @v -- prędkość (z' -w')  wektor przyśpieszeń
        @i -- natężenie prądu w amperach
        return Siła generowan przez tłumnik w N

        Slajd 18
        http://home.agh.edu.pl/~jastrzeb/images/SSD/SSD_2DOF_v1.pdf
    """
    b1 = 3415.7
    b2 = 93.324
    b3 = 74.487
    F0 = b1 * (i**2) + b2 * i + b3

    b4 = 2534.1
    b5 = 19.55
    b6 = 643.1
    C1 = b4 * (i**2) + b5*i + b6

    beta = 50
    p1 = 4
    p2 = 0.2

    x = I(v, dt)

    Ft = []
    for x1, v1 in zip(x, v):
        part1 = F0 * np.tanh( beta * (v1 + (p1 * x1)))
        part2 = C1 * (v1 + (p2 * x1))
        Ft.append(part1 + part2)
    return Ft, x

import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (20, 16)
plt.rcParams['font.size'] = 18


for f in [2, 5]:  # wybrane częstotliwości
#     f = 5
    i = 0.2
    # x_sin wektor wartości x dla wymuszenia sinusoidalnego 201 pkt
    # na każdy okres sinusa. Rozpoczęcie pkt pracy w -0.2
    x_sin = np.linspace(-np.pi/2, (np.pi * f) - np.pi/2, num=201 * f)
    u = np.sin(x_sin) * 0.2  # przeskalowanie przyśpieszenia

    dt = 1/(f*201)

    ft, x = MR(u, i, dt)  # sila
    plt.plot(u, ft, label='Freq = {}Hz, I={}A'.format(f, i))

    plt.legend()
plt.grid()
plt.show()
S.R
  • 2,411
  • 1
  • 22
  • 33
  • 1
    https://en.wikipedia.org/wiki/Nonlinear_control , http://www.moorepants.info/blog/npendulum.html , http://www.physics.nyu.edu/pine/pymanual/html/chap9/chap9_scipy.html – ralf htp Jan 14 '18 at 14:52
  • 1
    https://stackoverflow.com/questions/8739227/how-to-solve-a-pair-of-nonlinear-equations-using-python – ralf htp Jan 14 '18 at 14:56

0 Answers0