Time Studdies Ugh!
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
22 Feb 2014 05:21 - 22 Feb 2014 05:25 #44053
by Todd Zuercher
Time Studdies Ugh! was created by Todd Zuercher
It has been decreed "Thou shalt keep track."
I need to figure out a way to log the time usage of several of our machines.
I would like to be able to automatically log the total time the machine is milling in a day, and the time that it is powered on/off.
Any suggestions how to make this happen?
I was hoping that without to much difficutlty the machine could build a log file, (say when it it powered down for the day and save it to someplace on our network. In that file I would like to see Something like this:
I need to figure out a way to log the time usage of several of our machines.
I would like to be able to automatically log the total time the machine is milling in a day, and the time that it is powered on/off.
Any suggestions how to make this happen?
I was hoping that without to much difficutlty the machine could build a log file, (say when it it powered down for the day and save it to someplace on our network. In that file I would like to see Something like this:
Milling Time | Power On | Power Off |
HH;MM | Date, Time | Date, Time |
HH;MM | Date, Time | Date, Time |
HH;MM | Date, Time | Date, Time |
HH;MM | Date, Time | Date, Time |
Last edit: 22 Feb 2014 05:25 by Todd Zuercher. Reason: repeated words
Please Log in or Create an account to join the conversation.
22 Feb 2014 13:51 #44063
by dgarrett
Replied by dgarrett on topic Time Studdies Ugh!
As a starting point, the python program:
www.panix.com/~dgarrett/stuff/timelog.py
creates hal pins named:
timelog.start
timelog.stop
The program writes the Begin time, the End time,
the times for each Start and Stop button press,
and the time delta between a start and stop.
To use:
1) start linuxcnc with this hal commnand included in a halfile
2) to watch the log, in a separate terminal (after starting linuxcnc)3) in another separate terminal, simulate the start, stop pins:Note:
1) timelog.py should be in the ini directory
2) if using RIP, source scripts/rip-environment for each terminal
3) an early version of sim_pin is in v2.5.2
4) edit the file to change the name of the log file (/tmp/timelog.txt)
www.panix.com/~dgarrett/stuff/timelog.py
creates hal pins named:
timelog.start
timelog.stop
The program writes the Begin time, the End time,
the times for each Start and Stop button press,
and the time delta between a start and stop.
To use:
1) start linuxcnc with this hal commnand included in a halfile
loadusr timelog.py -W
2) to watch the log, in a separate terminal (after starting linuxcnc)
tail -f /tmp/timelog.txt
sim_pin timelog.start timelog.start
1) timelog.py should be in the ini directory
2) if using RIP, source scripts/rip-environment for each terminal
3) an early version of sim_pin is in v2.5.2
4) edit the file to change the name of the log file (/tmp/timelog.txt)
The following user(s) said Thank You: Todd Zuercher, deanforbes
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
26 Feb 2014 05:45 #44182
by Todd Zuercher
Replied by Todd Zuercher on topic Time Studdies Ugh!
Thank you very, much. Unfortunately I've been way to busy to try it out. It sounds like exactly what we need, can't wait to try it.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
28 Feb 2014 05:18 #44244
by Todd Zuercher
Replied by Todd Zuercher on topic Time Studdies Ugh!
I tried to test it, but after placing the file timelog.py in my config directory where my ini file is,
addingto the hal file and starting LinuCNC, I get the error
custom_postgui.hal:4: execv(timelog.py): No such file or directory
Should there be something else somewhere pointing to the location of the file or did I not put it in the right place?
adding
loadusr timelog.py -W
custom_postgui.hal:4: execv(timelog.py): No such file or directory
Should there be something else somewhere pointing to the location of the file or did I not put it in the right place?
Please Log in or Create an account to join the conversation.
28 Feb 2014 09:04 #44249
by dgarrett
Replied by dgarrett on topic Time Studdies Ugh!
my mistake:
$ man halcmd
...
loadusr [flags] unix-command
...
for loadusr, the unix-command must be in the user PATH or specify with absolute path. So
if you put in in the ini directory, invoke as:
loadusr -W ./timelog.py
$ man halcmd
...
loadusr [flags] unix-command
...
for loadusr, the unix-command must be in the user PATH or specify with absolute path. So
if you put in in the ini directory, invoke as:
loadusr -W ./timelog.py
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
01 Mar 2014 04:19 #44268
by Todd Zuercher
Replied by Todd Zuercher on topic Time Studdies Ugh!
Thanks that fixed it.
Now to work on fine tuning the output of the Log file.
I think I would like to have the power on/off connected to the machine power on/off (F2) rather than just LinuxCNC starting and stopping.
2nd, right now this is what the log file looks like.
How hard would it be to make it look more like this
Now to work on fine tuning the output of the Log file.
I think I would like to have the power on/off connected to the machine power on/off (F2) rather than just LinuxCNC starting and stopping.
2nd, right now this is what the log file looks like.
Begin Fri Feb 28 11:02:09 2014
UNEXPECTED: received stop while waiting for start
Start: Fri Feb 28 11:04:19 2014
Stop: Fri Feb 28 11:04:26 2014 Elapsed: 7.229313
Start: Fri Feb 28 11:04:43 2014
Stop: Fri Feb 28 11:04:43 2014 Elapsed: 0.401248
Start: Fri Feb 28 11:05:05 2014
Stop: Fri Feb 28 11:05:06 2014 Elapsed: 1.103536
Start: Fri Feb 28 11:05:18 2014
Stop: Fri Feb 28 11:05:20 2014 Elapsed: 1.805242
Start: Fri Feb 28 11:17:08 2014
Stop: Fri Feb 28 11:17:10 2014 Elapsed: 1.908865
End: Fri Feb 28 11:19:21 2014 Time since start: 1031.970063
How hard would it be to make it look more like this
Power On Fri Feb 28 11:02:09 2014
Start: Fri Feb 28 11:04:19 2014 Stop: Fri Feb 28 11:04:26 2014 Elapsed: 7.229313
Start: Fri Feb 28 11:04:43 2014 Stop: Fri Feb 28 11:04:43 2014 Elapsed: 0.401248
Start: Fri Feb 28 11:05:05 2014 Stop: Fri Feb 28 11:05:06 2014 Elapsed: 1.103536
Start: Fri Feb 28 11:05:18 2014 Stop: Fri Feb 28 11:05:20 2014 Elapsed: 1.805242
Start: Fri Feb 28 11:17:08 2014 Stop: Fri Feb 28 11:17:10 2014 Elapsed: 1.908865
Power Off: Fri Feb 28 11:19:21 2014 Time since Power On: 1031.970063
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
01 Mar 2014 05:02 #44269
by Todd Zuercher
Replied by Todd Zuercher on topic Time Studdies Ugh!
I don't really know anything about progamming Python code, but I was able to figure out how to make the Start, Stop and Elapsed time go on one line and space it appart a bit like I wanted it.
But I think I will need some help adding an input pin or two to cause the power on/off work right.
But I think I will need some help adding an input pin or two to cause the power on/off work right.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
01 Mar 2014 05:43 #44273
by Todd Zuercher
Replied by Todd Zuercher on topic Time Studdies Ugh!
My next question is: Is is nessisary to have seperate Start and Stop pins? Why can't the program just log the time when start pin goes true, then log when it goes false as the stop time?
Please Log in or Create an account to join the conversation.
Time to create page: 0.078 seconds