Jump to content
OMRON Forums

Determining if a program is running


bradp
 Share

Recommended Posts

To determine if a motion program is running in a C.S. look at Coord[n].Ldata.Status. If all of the four low bits are zero then it is executing. To determine if a PLC program is executing look at Plc[n].Ldata.Status. If all of the four low bits are zero then it is executing.
Link to comment
Share on other sites

  • 1 year later...
  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

This is not exact code but pseudo code used in the IDE Task Manager for checking if PLCs, Motion Programs and Sub Programs running. ------------------------------------------------------------------------------------------------------------------------------------------------- PLCs Tab PLCs Tab -- PLCs and RTPLCs Sys.MaxRtPlc - Tells how many PLCs are RTPLCs. For example if Sys.MaxRtPlc is 5 then Plc 0,1,2,3,4,5 are RTPLCs and rest are PLCs for (int i = 0; i < 32; i++) // 32 Plcs { if( (i) <= Sys.MaxRtPlc ) { if ( plc[i].Ldata.Status == Hex 20 ) RTPLC (i) is Running. else RTPLC (i) is not Running. } else { if ( plc[i].Ldata.Status == Hex 20 ) PLC (i) is Running. else PLC (i) is not Running. } } PLCs Tab -- CPLCs if ( 'librtiplcc.so' is available in ("/var/ftp/usrflash/Project/C Language/CPLCs/rti/" folder)) { if( Useralgo.Rticplc is 1 ) rtiplc.so CPLC is running else rtiplc.so CPLC not running } for (int i = 0; i < 32; i++) // 32 CPLCs { if ( ‘libplcc(i)’ is available in (“/var/ftp/usrflash/Project/C Language/CPLCs/user/”) folder) { if(UserAlgo.BgCplc[i] is 1 ) CPLC (i) is Running. else CPLC (i) is Not Running. } } PLCs Tab -- Application check pp_proj.ini file in '/var/ftp/usrflash/Project/Configuration' folder . Look for LINUX_PROGRAMS section in that file. This section will list all PLC applications. For example. [LINUX_PROGRAMS] program1=/var/ftp/usrflash/Project/C Language/Background Programs/capp1.out program2=/var/ftp/usrflash/Project/C Language/Background Programs/cap21.out for(program[1 .. n] in LINUX_PROGRAMS section) { // example with program1 if( ‘capp1.out’ is available in ‘linux top’ command) { Application ‘capp1.out’ is running. } else { Application ‘capp1.out’ is not running. } } ----------------------------------------------------------------------------------------------------------- Programs Tab ( Displays Motion programs) For( all prog[0..n] till you get prog[i].Number as ‘nan’) { For( all Coord[0..Sys.MaxCoordinates].Program.Number ) { if( prog[i].Number is available in Coord[j].Program.Number and Coord[j].Program.Size > 0 ) { if( coord[j].ldata.Status == hex 20) (Coord[j].Program.Number) is Running. Else (Coord[j].Program.Number) is Not Running. } } } for( all Coord[0.. Sys.MaxCoordinates]) { if( Coord[i].inverse.Size > 0 ) (i) is ‘Inverse Kinematic’; if( Coord[i].Forward.Size > 0 ) (i) is ‘Forward Kinematic’ } ----------------------------------------------------------------------------------------------------------- SubProgram Tab For( all SubProg[0..n] till you get SubProg[i].Number as ‘nan’) { SubProg[i]. Number is Running . }
Link to comment
Share on other sites

Version 1.2 of the Power PMAC firmware, released in Jan 2011, has 2 new status elements that make it easier for the user to determine the status of motion program operation. Coord[x].ProgRunning is 1 if the motion program and/or moves resulting from the program are presently executing. It is 1 even in "feed hold" (H) mode, because execution is still active, but it thinks that no time is elapsing. Coord[x].ProgActive is 1 if the motion program is running, or suspended in a way that execution can resume from that point (as with an S or Q command). These elements are "function" elements, computed only on request from several status bits, and so are not directly accessible from C programs.
Link to comment
Share on other sites

[quote='curtwilson' pid='1773' dateline='1303408319'] These elements are "function" elements, computed only on request from several status bits, and so are not directly accessible from C programs. [/quote] Is it possible to create C API calls for these types of things? Alternatively if it is documented we can create our own C calls from the data structure access. KEJR
Link to comment
Share on other sites

[quote='bradp' pid='206' dateline='1252511542'] To determine if a motion program is running in a C.S. look at Coord[n].Ldata.Status. If all of the four low bits are zero then it is executing. To determine if a PLC program is executing look at Plc[n].Ldata.Status. If all of the four low bits are zero then it is executing. [/quote] We will add C API call to access these elements. As soon as it is available I will post it ! Atul
Link to comment
Share on other sites

  • 2 years later...
[quote='bradp' pid='206' dateline='1252511542'] To determine if a motion program is running in a C.S. look at Coord[n].Ldata.Status. If all of the four low bits are zero then it is executing. To determine if a PLC program is executing look at Plc[n].Ldata.Status. If all of the four low bits are zero then it is executing. [/quote] This no longer works after upgrading 1.6.0.30. Is this a bug or intended and what replaces it :(
Link to comment
Share on other sites

  • 5 months later...
Can I please have an update on this, specifically for the C API. Base on previous comments, at present I am looking at pshm->Coord[x].Ldata.Status However it looks like this bit is set when the Coord system is trying to hold a position. ie. [code] int status = pshm->Coord[1].Ldata.Status & 0x1; return !status; [/code] Are there any other bits that I should be looking at? FYI I am using this bit to determine if I need to send an "abort" command and reissue a motion program Thanks
Link to comment
Share on other sites

I seem to recall an issue with the IDE not correctly finding ALL instances of C programs running. If you start two copies of the same program, it used to find the first one and that was it. It also did not correctly work to kill a C program. I cannot recall the exact behavior but it would not start the applications either, it would start a new copy of the C application. I have not revisited any of this in the latest IDE but the previous version had issues.
Link to comment
Share on other sites

[quote='iclim' pid='7120' dateline='1410483789'] Can I please have an update on this, specifically for the C API. Base on previous comments, at present I am looking at pshm->Coord[x].Ldata.Status However it looks like this bit is set when the Coord system is trying to hold a position. ie. [code] int status = pshm->Coord[1].Ldata.Status & 0x1; return !status; [/code] Are there any other bits that I should be looking at? FYI I am using this bit to determine if I need to send an "abort" command and reissue a motion program Thanks [/quote] I don't have direct C API function but you can make one using GetResponse. Coord[1].Ldata.Status The GetResponse function signature : (You can type the command in editor and then press F1 to see details.) -------------------------------------- int GetResponse (char * pinstr, char * poutstr, size_t outlen, unsigned char EchoMode) Performs a string send to with an expected return from the Pmac Command Processor The input string must have PMAC compatible commands Note: Doesn't handle "gpascii" commands like "$$$" or "reboot" Parameters: *pinstr - ptr to input string outlen - max length of output string EchoMode - PMAC "echo" parameter which determines the format of the response *poutstr - ptr to output string Returns: 0 == OK, - == error number -------------------------------------------------- How to use: #define CHAR_BUF_SIZE 0x100 retval= GetResponse("Coord[1].Ldata.Status",szdata, CHAR_BUF_SIZE, 0) where; int retval; char *szdata; ----------------------- Also please open DemoBox_4X, working example program that installs with IDE and shows how to use this API call. Hope this help. Thanks, Atul
Link to comment
Share on other sites

You want to use Atul's method to check the status of Coord[1].ProgActive. This is a "function" status bit that is computed from several internal status bits. It is 1 if the program is running or suspended so that execution could continue at that point. In this case, you would need to abort the program before you could work with the program buffer.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...