If this derivative is computed from the tables data, you might want to use the C functionwhich gives you the derivative of the tables data against x.
There is also.
Look in the help for the names of these functions for full descriptions.
I am aware of these functions, but they give you the partial derivative with respect to x (and y). What I need is time derivative (dU/dt).
One of the ways could be to use chain rule dU/dt= dU/dx.dx/dt + dU/dy.dy/dt. Here dU/dx and dU/dy can be obtained using the functions you mentioned, but I still need to get dx/dt and dy/dt. So, the question still stands : How to obtain the time derivative.
Maybe you could can do this on a supercomponent sketch: your 2D table output plugged to a derivative block DIF1 and this way you make the derivative an input to your special submodel too...
Or you reproduce what is done by DIF1 in your submodel, you define a dummy state variable in your component and its derivative is computed with a first order lag (tau is the time constant in seconds.
*ddummy = (*table_output - *dummy)/tau;
*ddummy is then your derivative.
In this case it would be useful to exactly know what you would like to do.
Computing a derivative comes always with some imprecision.
For example when using a dummy state variable as in the DIF1 submodel you will introduce a time constant.
The smaller this time constant is, the more precise you are, but then you introduce a high dynamics which may harm your computation time.
Therefore this is better to think about which variables are involved (or may be involved) in your problem.
As an example it might happen that you have a variable which is a displacement and in your computation you need the velocity. A simple solution is then indeed to try to compute a derivative, but very often in LMS Amesim you have access to the velocity (or can compute it rather directly) which you could re-use directly.
Generally speaking this is better to think in term of velocity (or flow rate, current, or other flux variables in Bond-Graph sense) than in term of displacement . Then you can directly use these variables instead of having to make differentiations.
It is even better to compute an integral than to compute a derivative.
If x and y are inputs to the submodel, then you are trying to differentiate an input. As other users indicated,
differentiating these quantities with a first order lag will introduce an undesired dynamics in the model.
Can you indicate what physical quantities x and y represent ? May be a submodel connected to your submodel
can already provide their time derivatives (e.g. provide some velocities if x and y are positions).