How to employ frequency-depend parameter in Xcos diagram?

I am making a mechanical simulation of spring damper system in Xcos.
And I want to employ frequency-depend damping coefficient parameter in it.
Please teach me how to employ such a block.
i.e. Which block to use, and how to set it.
Or such a simulation is unable?

Best regards.

Hello, and welcome to Scilab’s discourse !

You won’t find such a block in Xcos, but in order to build the simulation of such a system, you should first write the differential equation that governs such a system. What is your model of frequency-depend damping ?

S.

Dear mottelet,

Thank you very much for your reply.
I understood there is no such a block in Xcos.
My model is spring-damper mechanical model.
It’s differential equation is:
mx" + c(f)x’ + kx = 0 (1)
I already solved above equation for fixed “c” by Xcos.
This time the damping coefficient “c” has some frequecy dependence.
I already have the frequency curve and its equation of “c”.
So I want to solve above equation (1).
Please advice the method.

Best regards.

Alex

How do you define the instantaneous frequency f with respect to y ?

S.

Do you mean instantaneous frequency f with respect to time?

Alex.

I was just asking how you define f in the above equation. Since x is a function of time, I was supposing that f also does. That’s why I was asking how you define f… The concept of frequency depending damping is easy to define for individual eigenmodes e.g. of the 1D wave equation. In that case each mode n is a scalar oscillator like yours with a given eigenfrequency f_k=\frac{1}{2\pi}\sqrt{k_n/m_n} in that case it is straightforward to define the damping coefficient as a function of f_k.

But in your case (a single oscilator), when c(f)=0 the solution of the ode has the general form

x(t)=a\cos(\omega t)+b\sin(\omega t),

where \omega=\sqrt{k/m} hence you necessarily have f=\frac{\omega}{2\pi}. That’s why I ask you what is your definition of f in the general case.

S.

Dear mottelet,

I am sorry for the differential equation format.
My target differential equation is:
mx" + cx’ + kx = 0 (1)
I measured the “c”(tanδ) of the damper by viscoelasticity measuring equipment such as:
http://www.ubm-rheology.co.jp/product/seihin/rheogel-e.shtml
then I got tanδ of the damper and it has some frequency dependence.
Now I want to solve the differential equation (1) considering the “c” (or tanδ).
Could you understand my needs?
Or if there is mistake in my thinking please correct.

Best regards,

Alex

This type of dynamic mechanical analyzer work by applying an oscillating force to a material. In my humble opinion, your equation should have a right hand side (instead of 0), like this:

mx" + c(f)x’ + kx = F\sin(2\pi f t).

S.

Dear mottelet

As you told, my model is
mx" + c(f)x’ + kx = Po sinωt
I am sorry for confusing you.
Now can you give me answer to my question?

Alex

Do you have an example of c(f) formula ?

S.

Dear mottlelet.

Actually I have tanδ formula. It is:
tanδ = 0.23ln(f) for f = 10 to 1[kHz]

Best regards,

Alex

OK. Here is a simple Xcos diagram:

osc.zcos (3.0 KB)



and the simulation context (where you can change f and other parameters):

Dear mottelet.

Thank you so much for your answer.
Now I can do the same calculation as you.
But my goal is to know the frequency charastaristic of the system.
So I want to give charp waveform viberataion to the sysmtem as:
x = sin(2π・t^3), f = t^3/(2π)
In this case how can I do the simulation?
Maybe I should use the script of Scilab but I do not know well.
Please teach me.

Best regards,

Alex

If you take \sin(2\pi t^3)=\sin(2\pi f t) as right hand side, then f=t^2, right ? In any case, this yields an ill-posed system at t=0 since your damping is proportional to \log(f)=\log(t^2). However, it should be OK by starting with a strictly positive initial time. I think it will be easier for you to play with this small script (compared to a Xcos diagram):

function dXdt=rhs(t,X)
    x = X(1);
    v = X(2);
    m = 1;
    k = 10;
    P0 = 1;
    f = t^2;
    c = 0.23*log(f);
    dXdt = [v; (P0*sin(2*%pi*f*t)-c*v-k*x)/m]
endfunction

tspan = [%eps 5];
X0 = [0;0];
[t,X] = cvode(rhs,tspan,X0);
x = X(1,:);
v = X(2,:);
clf
plot(t,x,t,v)

inter

Dear mottelet san,

Thank you very much for your answer.
I almost understood.
But I am not good at Scilab script very well. So I should study.

Alex

1 Like

The key point is to reformulate the original second order in time ode into a system of two first order odes (most ode solvers deal only with first order systems of odes). Here we state that X_1=x and X_2=x', so that

X_1'=x'=X_2,

and

X_2'=x''=\frac{1}{m}\left( P_0\sin(2\pi f t)-cX_2-kX_1)\right),

from the ode solver point of view, the function rhs(t,X) yields the vector

X'=\left(\begin{array}{c} X_2\\ \frac{1}{m}\left( P_0\sin(2\pi f t)-cX_2-kX_1\right) \end{array} \right)

but, by starting with

x = X(1);
v = X(2);

we recall the convention that has been used (first component of X is the position x, second is its derivative v=x'), and the rest of the code is more readable as we use x and v instead of X(1) and X(2).

S.