June 26, 2019, 06:27:56 PM
Robotforum | Industrial Robots Community

 Data extraction help

veryhot_post Author Topic:  Data extraction help  (Read 6622 times)

0 Members and 1 Guest are viewing this topic.

January 30, 2018, 03:27:33 AM
Read 6622 times
Offline

Bay_Max


Hi team,

I was wondering if anyone could help with extracting data such as cycle times, start time, finish time etc. I have managed to set up a sub program that will store such information and then export to a csv file. My issue is that it only stores one set of figures at a time. My code cannot incrementally add lines to store new data and was wondering if someone out there could point me in the right direction. I have considered using arrays to create new lines to store figures, although all my attempts have failed. I have uploaded images of my code and the extracted csv for reference.

https://photos.google.com/photo/AF1QipOcWvrGPq0XxNFfHqFvqi6O2BLp-PyZF3YxAW1c
https://photos.google.com/photo/AF1QipPq5Q_JiuSuFuFNcQkOGZv8KV31ExxnZvvuT0Lw

TIA

Cheers
« Last Edit: January 30, 2018, 04:02:37 AM by Bay_Max »

Today at 06:27:56 PM
Reply #1

Advertisement

Guest

January 30, 2018, 08:45:26 PM
Reply #1
Offline

kwakisaki

Global Moderator
Hi

I think you'll have to upload your pictures as attachments, as I keep getting url error/not found responses from those links....... :bawling:
I would definitely be looking at using an array with a max size index value and also using parameters to make most of the data temporary and avoiding using too much memory.
ie grab the data, extract, store/transfer and delete.
Not 100% sure how you've structured your code.......it may just be a simple change to an array and then managing the array or just using local variables.

Instead of pictures, could paste the txt of the code in?

January 31, 2018, 12:10:01 AM
Reply #2
Offline

Bay_Max


.PROGRAM z.daily.p.log()
     $aa.p.log.title = "Chassis Number, PAINT TIME, DATE, START TIME, FINISH TIME, Chassis Number"
     .painting_time = painting_time
     .start_time = start_time
     .finish_time = finish_time
     .$current_time = $TIME
     .$date2 = $DATE(2)
     IF VAL(.$current_time) > 8 THEN ; check if it is past 8, if so save date, next day date doesnt change
     .$date1 = $DATE(2)
     END
     IF VAL(.$date1) <> VAL(.$date2) THEN ;compare dates, if different clear data
     FOR .i = 1 TO 1000
     $aa.paint.log[.i] = ""
     END
     paint.log.no = 0
     END
      IF SIG (2171,-2172) THEN ; set state in program
     .$st = $TIME+","
      END
      IF SIG(-2171,2172) THEN ; set state in program
     .$j = $ENCODE($job.call)+","
     .$pt = $ENCODE(.painting_time)+","
     .$d = $DATE(2)+","
     .$ft = $TIME+","
      $aa.paint.log[.paint.log.no]  = .$j+.$pt+.$d+.$st+.$ft
      END
.End

Thanks for your quick reply. I would like to use an array, but i am struggling to find a way to reset the counter on a daily basis. Essentially I want the array counter to reset to 0 at the start of the day and at the end, extract the data. I have tried using encode functions to store dates and using val i am able to compare 2 sets of dates and if they are different, setting the array counter to zero. The problem is every time it would reset.

January 31, 2018, 02:02:39 AM
Reply #3
Offline

Bay_Max


I also tried this with no luck

.PROGRAM z.daily.p.log()
     $aa.p.log.title = "Chassis Number, PAINT TIME, DATE, START TIME, FINISH TIME, Chassis Number"
     .painting_time = painting_time
     .start_time = start_time
     .finish_time = finish_time
     .$current_time = $TIME
     .$date2 = $DATE(2)
     .paint.log.no = .paint.log.no + 1
     .$paint.log.no = .paint.log.no
     IF VAL(.$paint.log.no) <> 1 TO 50
     FOR .i = 1 TO 50
     $aa.paint.log[.i] = ""l
     END
     paint.log.no = 0
     END
      IF SIG (2171,-2172) THEN ; start time
     .$st = $TIME+","
      END
      IF SIG(-2171,2172) THEN ; set state in program
     .$j = $ENCODE($job.call)+","
     .$pt = $ENCODE(.painting_time)+","
     .$d = $DATE(2)+"," ;date
     .$ft = $TIME+"," ;finish time
      $aa.paint.log[.paint.log.no]  = .$j+.$pt+.$d+.$st+.$ft
      END
.End

January 31, 2018, 09:51:58 AM
Reply #4
Offline

kwakisaki

Global Moderator
Quote
reset the counter on a daily basis

What do you mean by daily basis:
- each 24hr period between 00:00 and 23:59.
- each 24hr period between 00:00 and 23:59 of the current day.
- a specific time period (like at the beginning of shift to the end of a shift).


January 31, 2018, 06:54:23 PM
Reply #5
Offline

Bay_Max


Preferably at the start of each day. At 7:00:00.

I just can’t seem to work the logic, and be able to reset the array back to zero.

February 01, 2018, 10:34:12 AM
Reply #6
Offline

kwakisaki

Global Moderator
Hmmmmm......... :hmmm:........I can't quite see your end goal when reading the code so yes, the logic appears a little   ??? to me.
Ok, lets have a closer look at what you have so far and break it down into sections as I read it and see if this can highlight some areas:

Quote
     $aa.p.log.title = "Chassis Number, PAINT TIME, DATE, START TIME, FINISH TIME, Chassis Number"
     .painting_time = painting_time
     .start_time = start_time
     .finish_time = finish_time
     .$current_time = $TIME
     .$date2 = $DATE(2)

Define or refreshing of reals and strings:-
- REALS as time values either integer/decimal?
- STRINGS from the Controllers current time and date.

Quote
      IF VAL(.$current_time) > 8 THEN ; check if it is past 8, if so save date, next day date doesnt change
     .$date1 = $DATE(2)
     END

If the Value of the string is greater than 8, create a new string with the Controllers current date.
With this, if the time was either 08:00 upto 08:59, the value would still be 8.
So this IF would only be executed if the time was 09:00 or greater - upto 23:59

Quote
     IF VAL(.$date1) <> VAL(.$date2) THEN ;compare dates, if different clear data
     FOR .i = 1 TO 1000
     $aa.paint.log[.i] = ""
     END
     paint.log.no = 0
     END

IF the value of one string does not equal the other, create/redefine 1000 elements of a string array with empty strings.
Reset a real variable back to 0.
- If its not the same date - clear the logs with null strings and reset your array element control variable to 0.

Quote
       IF SIG (2171,-2172) THEN ; start time
     .$st = $TIME+","
      END

IF the internal signals are on and off, define string with Controller current time.

Quote
      IF SIG(-2171,2172) THEN ; set state in program
     .$j = $ENCODE($job.call)+","
     .$pt = $ENCODE(.painting_time)+","
     .$d = $DATE(2)+"," ;date
     .$ft = $TIME+"," ;finish time
      $aa.paint.log[.paint.log.no]  = .$j+.$pt+.$d+.$st+.$ft
      END

IF the internal signals are off and on create string elements and then create/redefine the string array element of current value .paint.log.no with the message.

...

So, what I would be looking at is creating a string array for the a log history with a max size, lets say 10 entries containing null strings to start with.

FOR .i = 1 to 10
$log[.i] = " "
END

I would then consider using a 'FIFO' type of structure (first in, first out) - ie array element 1 always being the most recent and 10 being the oldest so I can see a chronological order of events.

  IF ($log[1]==" ") THEN;
    $log[1] = .$current_msg; update log[1] with current string.
  ELSE; element 1 has previous data......carry out FIFO....refresh log array.
    FOR .tmp = 10 TO 2 STEP -1
      $log[.tmp] = $log[.tmp-1]
    END; This will produce a result where element 1 and 2 of array will now be the same
    $log[1] = .$current_msg; update log[1] with current string.
  END

Just the above will create and manage the string array in chronological order, no need to clear the entries again to null unless you want to.
You can then create your 'target string' data based on your signals and update the string in the log and your recent will always be [1].
You would not need to reset the string array to null strings at all.....unless you wanted to.

The main issues I can see are WHEN you are looking at creating these strings and under WHAT conditions - these seem very unclear.
- Could you explain a little more about it?
« Last Edit: February 01, 2018, 10:39:50 AM by kwakisaki »

Today at 06:27:56 PM
Reply #7

Advertisement

Guest

February 01, 2018, 12:23:44 PM
Reply #7
Offline

Bay_Max


that was a great response!

Firstly, I haven’t explained what I am trying to do correctly. I would like to save the painting data for the daily production at the end of a working day, that’s why I was focussed on comparing dates, because at the start of the day, if the dates were different, it would clear the data from yesterday and reset the count back to zero. I have have had a lot of trouble trying to come up with the logic to do so. The issue mainly lies around resetting the array to = 0 are the beginning of each working day.

The if statements related to the input signals are for start and finish times.

February 01, 2018, 08:34:51 PM
Reply #8
Offline

kwakisaki

Global Moderator
Hmmmm.........that's kind of thrown me a little.....as it throws open a whole host of questions......

1. Is this program to be executed as a standalone program at the start and at the end of each cycle.
2. Is this program to be executed as a standalone program at the start of a shift and at the end of the shift.
3. Is this program to be executed as a constant looping background task 'listening for the events' and grabbing data (data logging) when triggered.

Your current program then.........can I assume it is working except for the reset part......ie the other parts such as the start and finish and the actual data you are grabbing is correct
« Last Edit: February 01, 2018, 08:44:41 PM by kwakisaki »

February 01, 2018, 09:42:17 PM
Reply #9
Offline

Bay_Max


.***************************************************************************               
.*=== AS GROUP ===         : ASE_K80000W3L 2016/06/08 14:42               
.*USER IF AS               : UASEK80000W3L 2016/06/08 14:42               
.*USER IF TP               : UTPEK80000W3L 2016/06/08 14:41               
.*ARM CONTROL AS           : AASEK80000W3L 2016/06/08 14:41               
.*USER IF AS MESSAGE FILE  : MASEK800W3LEN 2016/06/08 14:40               
.*USER IF TP MESSAGE FILE  : MTPEK800W3LEN 2016/06/08 14:40               
.*ARM DATA FILE            : ARMEK80000W3L 2016/06/08 14:41               
.*PAINTING EQUIPMENT CONTROL SYSTEM :                
.*KERNEL                   : _KNL102500000 2015/02/23               
.*DRIVER                   : _DRV104200000 2015/01/30               
.*RFS                      : _RFS100800100 2012/07/27               
.*=== SERVO GROUP ===      : SVE_08000004G 2016/03/23 20:44               
.*ARM CONTROL SERVO        : ASVE08000004G 2016/03/23 20:37               
.*SRV DATA FILE            : ASPE08000004G 2016/03/23 20:38               
.*ARM CONTROL SERVO FPGA   : ASFE08000000A 2015/04/01 09:29               
.*               
.*Cpu board type           : 1VA               
.*=== 1ST ===              :               
.*1ST                      : 1ST-ST12               
.*   [Shipment setting data]                
.*There is no Shipment setting data.               
.***************************************************************************               
.NETCONF     192.168.1.60   timesys-   255.255.255.0   192.168.0.1   0.0.0.0   0.0.0.0
.NETCONF2     192.168.2.60   255.255.255.0   0.0.0.0         
.STRINGS               
$aa.p.log.title = "Chassis Number    PAINT TIME    DATE    START TIME    FINISH TIME    Chassis Number"
$aa.paint.log = "trlr.build.8                 42.2         30-Jan-18     12:32:29             13:15:37   "




.END               

This is how I would like my data to come out, although this resets every I run the program and would just like the data to move to the next line each time I run the program

February 01, 2018, 10:25:46 PM
Reply #10
Offline

Bay_Max


See if I am understanding this correctly     

IF ($log[1]==" ") THEN; check if the first log is empty?
        $log[1] = .$current_msg; update log[1] with current string. I'm guessing the current string will house all of the relevant data that I want?
      ELSE; element 1 has previous data......carry out FIFO....refresh log array.
        FOR .tmp = 10 TO 2 STEP -1; the tmp is a temporary name that stores data from 2 to 10 lines?STEP -1 (go back one line?) Does this find which line is empty?
        $log[.tmp] = $log[.tmp-1] ;Not too sure whats happening here?
        END; This will produce a result where element 1 and 2 of array will now be the same
        $log[1] = .$current_msg; update log[1] with current string.
    END

February 02, 2018, 03:34:44 PM
Reply #11
Offline

Kawaguy


Why are you using local variables? I see some local variables that haven't been initialized. I would use just 'paint.log.no' and no  '.paint.log.no'. It's easier for debugging as well.

To check the time or day you can also use the $MID command:

  $d.date = $DATE(3)
  $t.time =$TIME
  $d.day = $MID($d.date,9,2)
  $d.month = $MID($d.date,6,2)
  $d.year = $MID($d.date,3,2)
  $t.hour = $MID($t.time,1,2)
  $t.minute = $MID($t.time,4,2)
  $t.second = $MID($t.time,7,2)
  day = VAL($d.day)
  month = VAL($d.month)
  year = VAL($d.year)
  hour = VAL($t.hour)
  minute = VAL($t.minute)
  second = VAL($t.second)


February 02, 2018, 11:09:43 PM
Reply #12
Offline

Bay_Max


Correct, I am getting all of the relevant data I need, where I am having problems is with the logging of the data. I can’t seem to make a log that will progressively store log entries throughout the day. By the way I don’t need to reset the log everyday, it’s just convenient for me and I thought it would have a lot of memory by resetting the log every day. Is it possible to resetting the array when it reaches say an arbitrary value of say 50?

I use some local variables because I converted them from gobals (from other programs) to locals... but I may have added locals that are unnecessary.

Thanks for those methods for the time and date, now how could I compare the date of the last log entry to the current date? This is how I was planning on resetting my array, although if this is a very complex way, I would much preffer setting a log limit and resetting it when it reaches it. What do you think?

February 03, 2018, 11:02:57 AM
Reply #13
Offline

kwakisaki

Global Moderator
You haven't been able to answer when this is being executed, as this is very important when it comes to refreshing/updating values.....(ie trigger events).
So IMO there are 3 ways you could really resolve this:

1. Have a background task (PC Area) constantly running asynchronously with the main robot program and data logging when triggered.
2. Execute this as a background task (PC Area) as a one shot subroutine each cycle from within the main program.
3. Call this program from within the main program as a one shot subroutine.

- It is possible you are running this as a background task (PC Area), but if you're relatively new to Kawasaki, you may not be aware of this feature...... :justice:
- If not a background task then, as you have 2 signal condition checks in your current program (start/stop), I assume you are calling this program twice in the main program, once at the start (to read the start signals) and once at the end (to read the finish signals).

If it is the latter (calling this program twice at the relevant points in the main program), this would not be the most efficient way of doing it.......but it could certainly be made to work.
The trigger events needed are:

1. Start event - You say this is ok
2. Finish event, obtaining the correct data and creation of message to log - You say this is ok, just need to increment throughout the day
3. Clearing the existing logs for the a new day/shift - You say this is not very important, but would be useful

Have a look below at what I have written.
This is based on my assumption that you are running this program twice in the main program, once at the start (to read the start signals) and once at the end (to read the finish signals).

Code: [Select]
.PROGRAM z.daily.p.log()
;
; Set your definitions
;
  $aa.p.log.title = "CHASSIS NUMBER   PAINT TIME          DATE       START TIME    FINISH TIME"
;
;Start time stamp signals, clear logs/reset count if day is different, else just carry on
;
  IF SIG(2171,-2172) THEN;
    IF VAL($MID($date.end,1,2))<>VAL($MID($DATE(2),1,2)) THEN;
      FOR .tmp = 1 TO (MAXINDEX("$aa.paint.log"))
        $aa.paint.log[.tmp] = " "
      END
      log.no = 1
    END
    $date.st = $DATE(2)
    $tme.begin = $TIME
    UTIMER @paint.tmer = 0; reset timer
  END
;
;Finish time stamp signals and construct data for log entry
;
  IF SIG(-2171,2172) THEN;
    paint = ABS(VAL($ENCODE(UTIMER(@paint.tmer))))
    $tme.end = $TIME
    $date.end = $DATE(2)
    $aa.paint.log[log.no] = $ENCODE($job.call)+"     "+$ENCODE(/F7.2,paint)+"s       "+$date.st+"     "+$tme.begin+"      "+$tme.end
    log.no = log.no+1
  END
.END

To initially use it (first time):
You will have to create your array first......and also set the log.no variable to 1.
You would also need to define $date.end with a different value than $DATE(2).......ie if $date(2) is "03/FEB/2018", then set $date.end as something different.
The $job.call I assume this being set elsewhere so should already exist.

Once you have the array set and defined the $date.end different.
- The $date.end will be in sync after the first run........and will remain the same date until the next days comparison....where it should clear your logs (ONLY IF IT IS A NEW DAY).
- I have used a UTIMER to start a timer.....and grab the UTIMER value when you finish......then reset it again the next time you start......to provide paint time between start signals/finish signals

So, what should happen, each time this program is called:
If the start signals are on and the day is different - clear the logs first, reset the log count, then start the timer.
If the start signals are on and the day is not different - start the timer
if the finish signals are on, create the message, increment the log and set an end date of that operation.

Let me know if this is any good or assists you in achieving your goal - again, this is an assumption based on you calling this program twice...........

Final result on a string save:
Code: [Select]
.***************************************************************************
.*=== AS GROUP ===         : ASE_010100X3D 2015/06/05 17:01
.*USER IF AS               : UASE010100X3D 2015/06/05 17:01
.*USER IF TP               : UTPE010100X3D 2015/06/05 16:56
.*ARM CONTROL AS           : AASE010100X3D 2015/06/05 17:08
.*USER IF AS MESSAGE FILE  : MASE0100X3DEN 2015/06/05 16:54
.*USER IF TP MESSAGE FILE  : MTPE0100X3DEN 2015/06/05 16:51
.*ARM DATA FILE            : ARME010100X3D 2015/06/05 16:56
.*=== SERVO GROUP ===      :
.*ARM CONTROL SERVO        : ASVE08000003C 2014/01/31 15:51
.*SRV DATA FILE            :
.*ARM CONTROL SERVO FPGA   : ASFE080000007 2013/11/29 18:48
.*   [Shipment setting data]
.* default.as
.***************************************************************************
.NETCONF     0.0.0.0,"",0.0.0.0,0.0.0.0,0.0.0.0,0.0.0.0,""
.NETCONF2     0.0.0.0,0.0.0.0,0.0.0.0
.STRINGS
$aa.p.log.title = "CHASSIS NUMBER   PAINT TIME          DATE       START TIME    FINISH TIME"
$aa.paint.log[1] = "trlr.build.8       10.52s       03/FEB/2018     19:48:45      19:48:56"
$aa.paint.log[2] = "trlr.build.8        7.76s       03/FEB/2018     20:05:06      20:05:14"
$aa.paint.log[3] = "trlr.build.8        5.00s       03/FEB/2018     20:05:20      20:05:25"
$aa.paint.log[4] = " "
$aa.paint.log[5] = " "
$date.end = "03/FEB/2018"
$date.st = "03/FEB/2018"
$job.call = "trlr.build.8"
$tme.begin = "20:05:20"
$tme.end = "20:05:25"
.END

The additional strings could be omitted, by changing them to locals........
« Last Edit: February 03, 2018, 11:07:47 AM by kwakisaki »

Today at 06:27:56 PM
Reply #14

Advertisement

Guest

February 04, 2018, 12:59:17 AM
Reply #14
Offline

Bay_Max


Quote
1. Have a background task (PC Area) constantly running asynchronously with the main robot program and data logging when triggered.
2. Execute this as a background task (PC Area) as a one shot subroutine each cycle from within the main program.
3. Call this program from within the main program as a one shot subroutine.

Are you referring to a PC program? If so, yes i know you can run one of these, my only problem is that I have had no experience with structuring pc programs, and am not confident enough to begin altering the programs that are currently in the robot.

Like your 3rd suggestion, I have my program set up in a subroutine and call it from the main program at the beginning and end of the cycles (so your assumption is correct, I call it twice to get the relevant data and use the input signals to determine whether or not to take the time stamps). You're right, it's not the most efficient method of achieving what I want, although it is the only method I could come up with.

Quote
1. Start event - You say this is ok
2. Finish event, obtaining the correct data and creation of message to log - You say this is ok, just need to increment throughout the day
3. Clearing the existing logs for the a new day/shift - You say this is not very important, but would be useful

You've hit the nail on the head! That's exactly what I am trying to achieve, although as you stated, the two issues I have are the resetting of the log (using the array counter) and the array increment. I would like to use a date comparison to achieve this, although I am getting the feeling that the only way I can do this is by having some manual input to insert yesterdays date, unless you know of a alternative method.

Thanks for the code and I will definitely, give it a try when I am at work next.


Quote
To initially use it (first time):
You will have to create your array first......and also set the log.no variable to 1.
You would also need to define $date.end with a different value than $DATE(2).......ie if $date(2) is "03/FEB/2018", then set $date.end as something different.
The $job.call I assume this being set elsewhere so should already exist.

This where I really had issues trying to work out how to do this. I could not think of a way to initially set the array to 1 at the beginning of the shift, without it resetting back to one after every time the program was ran?

Quote
You will have to create your array first......and also set the log.no variable to 1. how would I set it to 1,
 will I have to do this manually? Do I need to use a PROMPT function?

You would also need to define $date.end with a different value than $DATE(2).......ie if $date(2) is "03/FEB/2018", then set $date.end as something different. Like setting the array to 1, how would I define this?
The $job.call I assume this being set elsewhere so should already exist. Yes this will be used to determine which chassis is being selected
« Last Edit: February 04, 2018, 01:06:32 AM by Bay_Max »

February 04, 2018, 11:09:04 AM
Reply #15
Offline

kwakisaki

Global Moderator
Quote
Are you referring to a PC program? If so, yes i know you can run one of these, my only problem is that I have had no experience with structuring pc programs, and am not confident enough to begin altering the programs that are currently in the robot.

That's a very honest comment, I wish other users would stipulate their experience more often, this assists us greatly in terms of coding and suggestions, if anyone posts code to try, it could be feasible it has an impact on the existing system - Many thanks for that.......... :top:

Quote
You're right, it's not the most efficient method of achieving what I want, although it is the only method I could come up with.
May be so......but like I say to anyone, if a program works exactly as intended.....efficient or not....then it's valid....... :bravo:
Kawasaki AS is very flexible in terms of structure, therefore many variations of the same program functions can/do exist.....just like most programming languages.

Anyways, back to your other comments:
Defining variables outside of a program

Once a variable is defined, unless a program changes it during execution......then it can only be changed manually.
Variables are stored in registers NOT the program code (only locals are defined/reside within program code during execution), therefore they are 'grabbed' only when a program command instructs it during execution.
Therefore you can redefine/create ANY variable(s) outside of a program, just by using the built in keyboard in the Teach Pendant, or via a PC using KRTerm/KCWin.

Next time you are 'online' via a PC (when the command prompt > is displayed) or using the keyboard function (when the dollar $ sign is displayed).
Type in LIST/P and press enter.................this will display all programs stored (in alphabetical order).
Type in LIST/L and press enter.................this will display all location variables  (in alphabetical order).
Type in LIST/R and press enter.................this will display all real variables  (in alphabetical order).
Type in LIST/S and press enter.................this will display all string variables  (in alphabetical order).
Type in LIST z.daily.p.log and press enter.................this will display the program code and ALL variables/values associated with the program (great to see everything for a single program).

Depending on the amount of data, pc,or keyboard function being used, you may need to press SPACE or NEXT to advance further down the list.
- To exit the lists, you need to return to the > or $ by pressing ENTER.

The code I posted, uses some of your variables from your program that are manipulated within the program and some that do not exist.
- So we need to set them/define them before the program executes or you will get 'undefined variable' errors and stop the process.

Using the PC or Keyboard from the > or $ BEFORE running the program:
Type in log.no = 1 and press enter..........This is to avoid an undefined variable error should the program be executed out of sequence........as you have not used log.no in your program.
Type in $.aa.paint.log[1]=" " and press enter.
Type in $date.end = "10/JAN/2017" and press enter...........This is to avoid an undefined variable error should the program be executed out of sequence........as you have not used log.no in your program.
« Last Edit: February 04, 2018, 01:35:55 PM by kwakisaki »

February 05, 2018, 04:41:06 AM
Reply #16
Offline

Bay_Max


Quote
Next time you are 'online' via a PC (when the command prompt > is displayed) or using the keyboard function (when the dollar $ sign is displayed).
Type in LIST/P and press enter.................this will display all programs stored (in alphabetical order).
Type in LIST/L and press enter.................this will display all location variables  (in alphabetical order).
Type in LIST/R and press enter.................this will display all real variables  (in alphabetical order).
Type in LIST/S and press enter.................this will display all string variables  (in alphabetical order).
Type in LIST z.daily.p.log and press enter.................this will display the program code and ALL variables/values associated with the program (great to see everything for a single program).

Are all the LIST/P-S just examples of what they will do if I type them in, or will i need to perform all of those queries as a part of the initiating process?

Quote
Type in log.no = 1 and press enter..........This is to avoid an undefined variable error should the program be executed out of sequence........as you have not used log.no in your program.
Type in $.aa.paint.log[1]=" " and press enter.
Type in $date.end = "10/JAN/2017" and press enter...........This is to avoid an undefined variable error should the program be executed out of sequence........as you have not used log.no in your program.

Can I just simply type that once I log into KRTerm?

STEP 1. Open KRTerm
STEP 2. Login to KRTerm
STEP 3. Make Sure main program is primed
STEP 4. Type the following log.no = 1... ENTER
                                       $.aa.paint.log[1]=" "... ENTER
                                       $date.end = "10/JAN/2017"... ENTER

At this point all the unknown variables will be defined and I will be okay to run the first cycle for the day. Is this correct?

February 05, 2018, 06:21:48 AM
Reply #17
Offline

kwakisaki

Global Moderator
Yep, all the 'list' are just examples only.
- Very useful when it comes to listing what's contained in the memory.

Quote
Can I just simply type that once I log into KRTerm?

STEP 1. Open KRTerm
STEP 2. Login to KRTerm
STEP 3. Make Sure main program is primed
STEP 4. Type the following log.no = 1... ENTER
                                       $.aa.paint.log[1]=" "... ENTER
                                       $date.end = "10/JAN/2017"... ENTER

At this point all the unknown variables will be defined and I will be okay to run the first cycle for the day. Is this correct?

Exactly correct......... :top:

You could then use the commands:

LIST/R log.no and enter to confirm defined value.
LIST/S $aa.paint.log[] and enter to display ALL the string array - if more than 1 exists, don't worry about that.
LIST/S $date.end and enter to display that string
TYPE $DATE(2) to display the existing date of the controller.

February 05, 2018, 12:35:11 PM
Reply #18
Offline

Kawaguy


Keep in mind, only global variables can be listed, saved and changed outside the program.
Local variables start with a dot:
  .i = 1 (local real variable .i) can only by used inside a program, it can not be monitored with list/type/save.
  .$data = "abc" is a local string variable, cannot be monitored or saved.
  $.data is an invalid variable name, will give an error.
  POINT .test = here is a local transformation variable.
  POINT .#test = here is a local joint variable


February 05, 2018, 01:05:50 PM
Reply #19
Offline

kwakisaki

Global Moderator
My bad.......I put a typo error in there....
Quote
Type in $.aa.paint.log[1]=" " and press enter.

Should have been $aa.paint.log[1] = " ".............. :icon_redface:

« Last Edit: February 05, 2018, 01:08:52 PM by kwakisaki »

February 05, 2018, 08:57:27 PM
Reply #20
Offline

Bay_Max


Quote
  .i = 1 (local real variable .i) can only by used inside a program, it can not be monitored with list/type/save.
  .$data = "abc" is a local string variable, cannot be monitored or saved.
  $.data is an invalid variable name, will give an error.
  POINT .test = here is a local transformation variable.
  POINT .#test = here is a local joint variable

I knew that having a full stop turned globals into local variables, although I didnt know about the transformation variables. I also didn't know that only global variables could be changed outside of the program really helps, so thanks heaps for the info!!!

Quote
$aa.paint.log[1] = " "

Thanks for that, my robot pendant is getting repaired at the moment, so the robot is not in operation, although as soon as it is in, I will report back to you to let you know how the program is running.


Today at 06:27:56 PM
Reply #21

Advertisement

Guest

February 05, 2018, 09:16:21 PM
Reply #21
Offline

Bay_Max


$aa.p.log.title = "CHASSIS NUMBER   PAINT TIME          DATE       START TIME    FINISH TIME"; list headings of columns for csv file
  IF SIG(2171,-2172) THEN; start of cycle signal
    IF VAL($MID($date.end,1,2))<>VAL($MID($DATE(2),1,2)) THEN; if input date does not equal today's date
      FOR .tmp = 1 TO (MAXINDEX("$aa.paint.log")); for 1 to the maxium array number
        $aa.paint.log[.tmp] = " "; clear their logs
      END
      log.no = 1; then set the array back to 1, but where will log.no go? Its not referenced in an array and I thought it would be
    END
    $date.st = $DATE(2); today's date
    $tme.begin = $TIME; finish time, you've got begin time here though?
    UTIMER @paint.tmer = 0; reset timer
.END

Are my comments correct here?


Should I have the following to allow my array to increment?

.tmp = log.no
.tmp = .tmp + 1
$aa.paint.log[.tmp]
« Last Edit: February 05, 2018, 09:39:11 PM by Bay_Max »

February 05, 2018, 09:42:20 PM
Reply #22
Offline

kwakisaki

Global Moderator
The code you've posted is for the 'start' section of your program.
And gives you 2 possible results if the start signals are on when you execute it:

Result 1:
Clears the current logs upto the max elements stored.
Sets log no to 1.
Creates a date stamp of the start cycle.
Creates a time stamp ($tme.begin) of the start cycle.
Resets the UTIMER to 0.

or

Result 2:
Creates a date stamp of the start cycle.
Creates time stamp ($tme.begin) of the start cycle.
Resets the UTIMER to 0.

Therefore, when it starts either:
Clears logs and starts timer - if date is different.
Starts timer.

Of course, if the start signals are not made.....the complete start cycle is missed.
Then if the stop cycle signals are on, it grabs the timer value, time stamp for the finish and creates the log entry and increments the log count.
In the stop area, it makes a date stamp.
Therefore, the following day will be different.
So when it executes the start cycle again......this enables your logs to be cleared.

The code as it is works...............

Quote
Should I have the following to allow my array to increment?

.tmp = log.no
.tmp = .tmp + 1
$aa.paint.log[.tmp]

Not needed.....your log increments in the stop part of the code.
Quote
IF SIG(-2171,2172) THEN;
    paint = ABS(VAL($ENCODE(UTIMER(@paint.tmer))))
    $tme.end = $TIME
    $date.end = $DATE(2)
    $aa.paint.log[log.no] = $ENCODE($job.call)+"     "+$ENCODE(/F7.2,paint)+"s       "+$date.st+"     "+$tme.begin+"      "+$tme.end
    log.no = log.no+1

  END


Hope that helps.........

p.s you could change the majority of the variables to locals if you require.......except the log variables as these are the only ones you need.....but before you do anything like that, check that it works ok for you.
« Last Edit: February 05, 2018, 09:54:24 PM by kwakisaki »

February 06, 2018, 12:14:45 AM
Reply #23
Offline

Bay_Max


Sorry I just realised I missed half the code  :icon_redface: :waffen100:

I will report back to once I give the code a go .

Cheers
« Last Edit: February 06, 2018, 02:37:43 AM by Bay_Max »

February 06, 2018, 03:42:24 PM
Reply #24
Offline

Kawaguy


What I usually do is the following

  $log[log.no MOD maxlog] = $date(2) + ";" + $time + ";" + .........
  log.no = log.no + 1

with
  maxlog = 5000

With E-Controller it's no problem to store 5000 strings. Maxlog keeps counting up, but the result is modus, so as maxlog becomes 5000, logno MOD 5000 becomes 0, it will overwrite the oldest data. 
 


Share via facebook Share via linkedin Share via pinterest Share via reddit Share via twitter

xx
Tool data and load data for irb6400 M98 S4 motion supervision errors

Started by Kroket on ABB Robot Forum

5 Replies
3019 Views
Last post August 23, 2013, 08:16:12 AM
by Chaos
xx
RDT Data of RDC and Hard Disk inconsistent! Check robot data

Started by Jborron on KUKA Robot Forum

6 Replies
6597 Views
Last post February 04, 2016, 07:30:00 AM
by the leg
xx
RDT Data of RDC and Hard Disk inconsistent! Check robot data!

Started by 9566317 on KUKA Robot Forum

2 Replies
2028 Views
Last post May 19, 2016, 02:04:48 PM
by 9566317
xx
copy Application data and Template data between projects

Started by napol1 on KUKA Robot Forum

4 Replies
1475 Views
Last post October 31, 2016, 08:45:34 AM
by kiiwa