It is currently Fri May 25, 2018 2:58 am



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Fuel_Pump_Task question
PostPosted: Mon Jun 03, 2013 11:17 pm 
Offline
User avatar

Joined: Thu May 30, 2013 1:11 am
Posts: 54
Gents,

I've been spending a bit of time going over the code trying to get a big picture look at what is going on. And I need a bit of clarification on the Fuel_Pump_Task:

Code:
void Fuel_Pump_Task(void)
{
    task_open();                // standard OS entry - NOTE: no non-static local variables!
    task_wait(1);

    Set_Pin(FUEL_PUMP_PIN, 1);  // Prime fuel system, Fuel Pump ON
    task_wait(Fuel_Pump_Prime_Time); //          // allow others tasks to run during pump prime time

    for (;;) {
        if (RPM == 0)
            Set_Pin(FUEL_PUMP_PIN, 0);  // turn pump off if engine not turning
        else
            Set_Pin(FUEL_PUMP_PIN, 1);  // Engine is turning so turn Fuel Pump ON

        task_wait(500);         // allow others tasks to run then come back to see what the pump should be doing
    }
    task_close();
}


So if I am reading this correctly, during system startup, this task is initialized as a COCOOS task. It first turns on the pump and then waits some amount defined in the memory map (loaded via TS I assume, ...) Then it enters an infinite loop checking for zero RPM when it turns off the pump. Between each run through the for loop, it waits (task_wait(500)) for 500 somethings. Then checks one more time and keeps doing this until the task is terminated.

The two part question I have is this: 1) Is the "500" 500 ms or some other time base? Where can I find that definition of how long each OS tick is? And, 2) There are other parts of the code that regularly checks the RPM (Engine10_Task for example). Is there a reason having a separate task for the fuel pump is better than just having the check for zero rpm occur where we read the RPM and then turn off the pump if necessary?

My gut says that because we are using a RTOS, it is clearer to use a separate (but slow running) task just for the fuel pump instead of mixing that control code up with the read code from Engine10_Task. And, it won't really hurt anything if the fuel pump stays on an additional 450 ms (assuming length of os_tick here...) after the engine stops turning.

Am I on the right path here?

Clint


Top
 Profile  
 
 Post subject: Re: Fuel_Pump_Task question
PostPosted: Tue Jun 04, 2013 1:03 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
I'm confused about the need for the "for" loop in the task.

There are only two conditions to be tested... well maybe 3: RPM=0 and RPM>0 ... and key turned on.

If key was just turned on, the system needs primed.

If RPM=0, run the pump for a period of time to prime the system. Once that time has expired, and RPM is still 0, pump is off. I could see a situation where a fuel pressure sensor is installed and if that sensor drops below some value the pump is turned on, but otherwise if the engine isn't running, and the system has been primed, the pump should be off... with perhaps a re-prime occurring every 10 seconds or so, just in case.

If RPM>0, pump should be on, period. Though having a motorcycle, I can see some instances where even if the engine is running, one doesn't want the pump on... as in the bike's been lain over and tires are no longer on the ground... but then, I'd rather a tilt switch physically interrupt the fuel pump power.

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: Fuel_Pump_Task question
PostPosted: Tue Jun 04, 2013 7:36 am 
Offline
User avatar

Joined: Sat May 11, 2013 9:45 am
Posts: 729
Location: PA, USA
abecedarian wrote:
I'm confused about the need for the "for" loop in the task.

There are only two conditions to be tested... well maybe 3: RPM=0 and RPM>0 ... and key turned on.

If key was just turned on, the system needs primed.

If RPM=0, run the pump for a period of time to prime the system. Once that time has expired, and RPM is still 0, pump is off. I could see a situation where a fuel pressure sensor is installed and if that sensor drops below some value the pump is turned on, but otherwise if the engine isn't running, and the system has been primed, the pump should be off... with perhaps a re-prime occurring every 10 seconds or so, just in case.

If RPM>0, pump should be on, period. Though having a motorcycle, I can see some instances where even if the engine is running, one doesn't want the pump on... as in the bike's been lain over and tires are no longer on the ground... but then, I'd rather a tilt switch physically interrupt the fuel pump power.


Without the loop the task would complete and that would be that.....so it you say turn on the key and allow the pump to time out if would shut down never to return.

The alternative is to make the pump task part of some other task but that's not ideal because the pump timeout is unique to the pump and user configurable. This is the power of an OS...everything can done in a way that makes sense for the particular task vs needing to compromise or add times running everywhere tripping interrupts.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Theme designed by stylerbb.net © 2008
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All times are UTC - 5 hours [ DST ]