IMO, it's a feature that the most basic sim configurations don't require
a base thread.

On my system (2.8GHz AMD), rtapi_app takes ~1% CPU before the change and
about 6% after.  Admittedly 6% isn't much, but it's worse than 1%.

Perhaps we should write a simulated spindle that can work without
requiring a base thread.

Here's a first stab at this.  I looked at some traces in halscope but
didn't try any simulated rigid tapping.

// ---------------------------------------------------------------------
component sim_spindle "Simulated spindle with index pulse";

pin in float velocity-cmd "Commanded speed, in revolutions per second";
pin out float position-fb "Feedback position, in revolutions";
pin io bit index-enable "Reset position-fb to 0 at the next full rotation";

license "GPL";

function _;
;;
#include <rtapi_math.h>


FUNCTION(_) {
    double old_position = position;
    double new_position = position + speed * fperiod;

    if(index_enable && (floor(old_position) != floor(new_position))) {
        index_enable = false;
        if(speed < 0)
            new_position = new_position - ceil(new_position);
        else
            new_position = new_position - floor(new_position);
    }

    position = new_position;
}
// ---------------------------------------------------------------------

Jeff

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to