I forgot to cancel SPEED INCREASE/DECREASE at the and of the pseudocode. Sorry!

On Sun, Aug 8, 2010 at 1:51 PM, Igor Chudov <ichu...@gmail.com> wrote:
> Guys, I am just thinking, perhaps what I am trying to accomplish
> (speed change via varidrive), could be best accomplished via an M100
> command (shell script). Shell or perl scripts have access to hal,
> right? I would write something like (in pseudocode)
>
> $desired_speed = ARGV[0]
> $delta = max( 5, $desired_speed/10 )
>
> if spindle-running then
>  sleep 1 # get it up to speed
> else
>  release-brake
>  sleep 0.5 # wait for brake
>  start-spindle
>  sleep 1    # wait for spindle
> fi
>
>
> my $i = 0
>
> if( $desired_speed <= 0 || $desired_speed > 4200 ) {
>  ERROR( "BAD DESIRED SPEED";
> }
>
> if( $actual_speed < $desired_speed - $delta ) {
>  start_speed_increase;
> } elsif( $actual_speed > $desired_sped + $delta ) {
>  start_speed_decrease;
> } else {
>  MSG( "You are at a good speed already within tolerance" );
> }
>
> $t0 = time;
>
> while( time-$t0 < $max_time
>         && !close_enough( $actual_speed, $desired_speed_delta ) ) {
>  sleep 0.01
> }
>
> if( !close_enough( $actual_speed, $desired_speed_delta ) ) {
>  ERROR( "FAILED TO REACH SPEED" );
> }
>
> # Reached speed, success!
>
> And then, I could use the M100 comand top set speed via varidrive, and
> the S command to just set the VFD output.
>
> i
>
> On Sun, Aug 8, 2010 at 1:18 PM, Andy Pugh <a...@andypugh.fsnet.co.uk> wrote:
>> On 8 August 2010 19:08, Jon Elson <el...@pico-systems.com> wrote:
>>
>>> There is a spindle-at-speed function that could be used to decide when
>>> the speed control logic has finished.
>>
>> I believe that is an input, used to feed-hold until the drive
>> indicates that the spindle is at the correct speed.
>>
>> --
>> atp
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by
>>
>> Make an app they can't live without
>> Enter the BlackBerry Developer Challenge
>> http://p.sf.net/sfu/RIM-dev2dev
>> _______________________________________________
>> Emc-users mailing list
>> Emc-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/emc-users
>>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to