From: Arnaud Miege on
"Kamil " <kamil.chodzynski(a)umons.ac.be> wrote in message <hn364d$56u$1(a)fred.mathworks.com>...
> Hello Arnaud,
>
> I know that I cannot specify an initial conditions for a derivative. Maybe I was not precisely I wanted to put a value which allows to start calculations for example for 5th first iterations.
>
> I am trying to calculate a piston pump with addition pipes, valves etc. My piston pump it is a linear motor, with a cylinder and a membrane. And by changing positions of the linear motor I apply a difference of volume. The simplest equation looks like:
>
> Qin - Qout = Sdh/dt then Qout = Qin - Sdh/dt
>
> where:
>
> Qin = inlet flow
> qout = outlet flow
> S = surface of the piston
> dh/dt - change position of the piston in time (velocity)
> h - position
>
> My control loop is in position therefore I need to put derivative.
>
> My whole system includes many "pieces of equipment" such as pipes, valves, a check valve, a piston pump. Addition pipes I modelled as electrical equivalents (resistor, capacitor and inductance) even more the pipes are segmented and depends on conditions they are divided in smaller pieces. For example for 1 m pipe's length I need about 10 capacitors, 10 resistors and 10 inductances. It creates addition equations and it makes the system more heavier to calculate. Therefore as I have a Simulink Control Design toolbox I wanted to make linearisation of the system and find a transfer function of the system. Unfortunately the linearisation of my system does not go well. It cannot find a right transfer function of my system. I tried an estimation frequency response as well but it does not work either. I received different answers for both methods. I thought that problem is because I mix
simulink
> blocks with Simscape blocks therefore I wanted to avoid algebraic loops and put everything in Simscape environment.
>
> How I know that a transfer function is not correct? I did it in my own way which is similar to estimation frequency response. I put sinusoidal wave to linear motor as position (input signal) and I read a flow rate as an output. I save data and in Matlab thanks to theoretical equation I found magnitude and phase for the system. I am trying to get the same with Simulink but it does not work. Therefore step by step I am trying to find where I made a mistake.
>
> I hope I explain my problem a little bit better.
>
> Thanks
> Kamil

Hmmm, I am not sure i really understand what you want to do. It sounds as if your system is combination of electrical components (e.g. motor) and hydraulic components (e.g. pipes). Why do you need to model hydraulic components as electrical equivalents?

I would use hydraulic blocks from Simscape/SimHydraulics for hydraulic components and electrical blocks from Simscape/SimElectronics for electrical/electronic components. Either way, I don't see why you would need inputs/outputs, other thasn for the controller (which you can do in Simulink). If you are writing Simscape file to model custom components, then use hydraulic or electrical ports, rather than physical signals. Or did I misunderstand what you are trying to do? Maybe it would help if you could post your model on a filesharing site so that we could look at it?

With regards to linearizing your model, it may be due to the choice of operating point, especially if you have non-linearities in the model. The frequency response estimation should work, but you have to be careful as to how you select the input to excite the system. I would try the linearization with Simulink Control Design and if the model is really too non-linear, then look at frequency response estimation. As you mention, you can also excite the system yourself with a chirp signal or equivalent, then take the FFT of the input and outputs, and divide one by the other to get the transfer function. However, that can generate very noisy results.

HTH,

Arnaud
From: Kamil on
Thanks for replay. If it possible I can send all my project to you and you can have closer look. I have many blocks which I have created myself and write as simscape library in electric environments. As I cannot put matrix to the Simscape I use electrical components from Simscape/SimElectronics and I put it in series.

Let me know how you want to do.

>
> Hmmm, I am not sure i really understand what you want to do. It sounds as if your system is combination of electrical components (e.g. motor) and hydraulic components (e.g. pipes). Why do you need to model hydraulic components as electrical equivalents?
>
> I would use hydraulic blocks from Simscape/SimHydraulics for hydraulic components and electrical blocks from Simscape/SimElectronics for electrical/electronic components. Either way, I don't see why you would need inputs/outputs, other thasn for the controller (which you can do in Simulink). If you are writing Simscape file to model custom components, then use hydraulic or electrical ports, rather than physical signals. Or did I misunderstand what you are trying to do? Maybe it would help if you could post your model on a filesharing site so that we could look at it?
>
> With regards to linearizing your model, it may be due to the choice of operating point, especially if you have non-linearities in the model. The frequency response estimation should work, but you have to be careful as to how you select the input to excite the system. I would try the linearization with Simulink Control Design and if the model is really too non-linear, then look at frequency response estimation. As you mention, you can also excite the system yourself with a chirp signal or equivalent, then take the FFT of the input and outputs, and divide one by the other to get the transfer function. However, that can generate very noisy results.
>
> HTH,
>
> Arnaud