I have an external resolver and I didn’t want to utilize two physical inputs to get both speed and position. Is it possible to obtain those two from one resolver in block? When I check the embedded analog devices board used for it, I can see that it can provide both of them via a GUI. Or is there a demo where I can see how to obtain the speed value from position measurement in RTBox?
The current implementation does not allow to read out position and velocity at the same time. While the AD2S1210 supports this mode in principal, it reduces the bandwidth of the device by a factor of 2.
Whether you calculate the speed from the position or the position from speed depends on the requirements of your model. In the first case you need to handle the wrapping of the angle at 2*pi. A simple example is attached. It assumes that the rotating direction is always positive.
Thanks for your answer but this does not help a lot with my problem, to be honest. A real time application is not simplified like this model, position is not always a perfect triangular and in real world motors also rotate counter clockwise…
The idea I had was to implement a C-Code script, but the errors I get from the block (input terminal limit exceeds range [0] etc. even though I accordingly set the number of inputs outputs or similar) are hard to understand and deal with. A similar type of 2PI wrapping is needed there I guess and also at low speeds, a discrete time filter after the derivative block is definitely necessary. I am not hopeful about that approach but also okay with keep on trying if you have any suggestions at that side.
Lastly, is there a way I can sacrifice that bandwidth and obtain a robust output for both position and speed? Maybe my specific application can handle a lower bandwith?
If you want to account for negative speeds, implement the same logic working only for negative speeds. Then use the negative speed if the angle difference from one step to the next is greater than pi, otherwise use the positive speed.
Don’t use a C-Script if you can implement the same functionality using blocks.
The implementation does not depend on position being perfect triangular - it just makes the model work for offline simulation.