PID data saving

More
22 Feb 2012 11:30 #17930 by Fremder
PID data saving was created by Fremder
Hi everybody,

PID and Co its a long way ...

to "analytic" the f.error for optimizing i'll make a txt-file with the actual-data

now i go to Hal-Skop and put:

P1 = axis.0.f-error
P2 = position
P3 = time
...
then i can save the data from Halscope. its verry good...

but when i shift the millions options from PID-F1-F2 and Acceleration(Linear/Grade) its a lot of manuel "tippings" :-)

what can i do to save the data - like this output: (i can make 1000 samples and 16 cchannels...) but i think
in the first line of the save datafile its now writing:
Sampling period is 999914 nSec
then comes the datas ...
gives a way to write in the first LINE of the save-data-file:
Sampling period is 999914 nSec P=1 I=0.5 D=0.5 F1=0.01 F2=0.01 AC1=200...

thanks for help :-)
ritsch

Please Log in or Create an account to join the conversation.

More
22 Feb 2012 22:33 #17953 by andypugh
Replied by andypugh on topic Re:PID data saving
I think I know what you are trying to do, but I don't really understand the question.

You could try asking the question in German too, if it is easier for you. (I don't speak German, but some folk here do)

Please Log in or Create an account to join the conversation.

More
23 Feb 2012 09:39 - 23 Feb 2012 17:26 #17958 by Fremder
Replied by Fremder on topic Re:PID data saving
hi andy,

actual i import the Data-File from the HalScope to vb.net ...
.
What can i do for REPORTing data from my PID out from LinuxCnc to a ascii-file.
.
ich möchte die PIDwerte und dazu die f.error mit aktueller position in abspeichern.
Besteht die Möglichkeit eine art "Reportfile" mit Daten zu füllen ?
Grundsätzlich geht es ja mit Halscope. nur hier muss ich die aktuellen PIDs als kanal festlegen.
und die ändern sich ja während des jeweiligen durchgangs (zb. G01 X100 ... G01 X0) nicht.
=======
Die Daten selbst ziehe ich mir in vb.net rein und kann
besser VORHER und NACHER vergleichen ...
=======
Nun die Frage:
Soll ich einfach mit HalScop weitermachen ? ;-)
oder gibts ne relativ einfache möglichkeit verschiedene Daten zu speichern ?

ich würde zuuuu gerne aus nem g-code alles ein bisserl automatisieren.

besten dank
ritsch

hier is my look ... RED its the f.error ...

its verry nice to view > bevor / after <

PS: ich finde den MAX_ACCELERATION > Pin bzw. einen verweis darauf nicht.
Attachments:
Last edit: 23 Feb 2012 17:26 by Fremder.

Please Log in or Create an account to join the conversation.

More
24 Feb 2012 01:10 #17996 by andypugh
Replied by andypugh on topic Re:PID data saving
Fremder wrote:

What can i do for REPORTing data from my PID out from LinuxCnc to a ascii-file.


You want to log data that isn't in Halscope?
You might be able to use hal_sampler:
www.linuxcnc.org/docview/html/man/man1/halsampler.1.html
www.linuxcnc.org/docview/html/man/man1/halstreamer.1.html

Is that the sort of thing you mean?

Please Log in or Create an account to join the conversation.

More
24 Feb 2012 08:00 - 24 Feb 2012 11:33 #18007 by Fremder
Replied by Fremder on topic Re:PID data saving
oh thank you - its verry good.

;-)
but for my FIRST can you help me to start the Halsampler ?

OPTIONS
-c CHAN # ??
# sorry i to doof: i found no connection for <sample>:
PINS: -> AXIS -> 0: Name = axis.0.active <<< its this the CHAN ??
only in the COMPONENTS i see a ID :-(

instructs halsampler to read from FIFO CHAN. FIFOs are
numbered from zero, and the default value is zero,
so this option is not needed unless multiple FIFOs have been created.

-n COUNT # its the max lines to write
instructs halsampler to read COUNT samples from the FIFO, then exit.
If -n is not specified, halsampler will read continuously until it is killed.

-t
instructs halsampler to tag each line by printing the sample number in the first column.

FILENAME
instructs halsampler to write to FILENAME instead of to stdout.
==========
i have no idea,
- insert "loadrt halsampler" in the hal-file from linuxcnc ?
- make with "Terminal" ... ?
Exsample:
to write the PID and Max_Accelator

thanks again

i found this: - its this, its the code from halsampler
psha.org.ru/cgit/psha/emc2.git/plain/src...onents/sampler_usr.c
Sometimes i have a veeeeery verrry bad feel for my writing her ....

:-)
cooool - its working fine *g*
In the Halfile:
loadrt sampler depth=600 cfg=FFF '
characters are:
F, f (float pin)
B, b (bit pin)
S, s (s32 pin)
U, u (u32 pin)
# so its 3 FFF pins !

verry good :-)
...
what i must do TO START the reporting with halsampler ?
i make this: loadusr halsampler -n 2000 haltest.txt
but the data its: 3 time 0.00000 0.00000 .00000
and when i make without -n 2000 :-) in a minute its 100ret MB datas *g*

can i make a pin to start and end the samples ?

YES i can : setp sampler.0.enable 1 (or 0) *g*
now i make start and end in the Mxxx and its wonderfull :-)
Last edit: 24 Feb 2012 11:33 by Fremder.

Please Log in or Create an account to join the conversation.

More
27 Feb 2012 14:59 - 27 Feb 2012 16:12 #18141 by Fremder
Replied by Fremder on topic Re:PID data saving
ok its 50% wonderful *g*

what i must do to RESET the halsampler btw. the fifo ...

i would like this:
Time to report ~ 1 sec.
Datas PINS -> 5

currently i make this:

====== custSampler.Hal

loadrt sampler depth=2000 cfg=FFF
net Xpos => sampler.0.pin.0
net Ypos => sampler.0.pin.1
net XYvel => sampler.0.pin.2
addf sampler.0 servo-thread
setp sampler.0.enable 0


========== Hal/sampler ON like M171 from gcode
/#!/bin/bash
# Aufzeichnung AN
dateiname=$1
# halcmd loadusr halsampler -t -n 12000 Pid$dateiname
halcmd loadusr halsampler -t -n 60000 Pid$dateiname
halcmd setp sampler.0.sample-num 0
halcmd setp sampler.0.curr-depth 200
halcmd setp sampler.0.enable 1
exit 0

========== Hal/sampler OFF - like M172
/#!/bin/bash
# Aufzeichnung AN
halcmd setp sampler.0.enable 0
halcmd unloadusr halsampler
# cp /home/core7/Desktop/emc2/configs/sim/axis/xxxsem.txt /home/core7/Desktop/emc2/configs/sim/axis/PID$dateiname
exit 0
=============
the first time its a good finish in the output-file ...

but what i must calculate at:

> loadrt sampler depth=2000 cfg=FFF
the depth from the sampler

-> FirstInFirstOut ... -> allways ?
# when i "stop" its allway "old-data" inside there :-(

# its ? come overload when more then 2000 ?

and
> halcmd loadusr halsampler -t -n 60000 Pid$dateiname
the Count for Fifo from Halsampler
..
i can't reset to 0
what i must do :-)

thanks for helping
Last edit: 27 Feb 2012 16:12 by Fremder.

Please Log in or Create an account to join the conversation.

More
27 Feb 2012 16:59 #18156 by ArcEye
Replied by ArcEye on topic Re:PID data saving
Hi

I am not any kind of expert in these components. I have just read the man pages and looked at some of the code.

the depth from the sampler.........
-> FirstInFirstOut ... -> allways ?
# when i "stop" its allway "old-data" inside there.............
# its ? come overload when more then 2000 ?

So far as I can work out, the 'depth' of the sampler FIFO buffer is a matter of experimentation until you hit upon a size that allows the halsampler component to read and direct to file without any overruns.
The overruns occur when the head catches up with the tail, in this circular buffer.

Because the sampler is running on a much faster thread than halsampler, the buffer size (depth) may have to be considerably bigger.

You could even start with sampler.depth and halsampler.count set at the same number, where you essentially have a linear buffer and cannot overrun.
Then reduce the size of sampler.depth until overruns occur.

There is a pin sampler.overruns which you could monitor to find an optimum depth which keeps overruns at 0

halcmd setp sampler.0.curr-depth 200

I did note this in your .hal which I don't understand
sampler.curr-depth is an OUT pin, but even if you were able to set it , it would start up thinking that 200 samples had already been used?

> halcmd loadusr halsampler -t -n 60000 Pid$dateiname
the Count for Fifo from Halsampler

This will presumably be resolved when you have the FIFO depth correct. 60,000 samples is a lot, must take up a bit of disk space.

Hope something is of use, not really sure if it gets to the root of what the question is

regards

Please Log in or Create an account to join the conversation.

More
27 Feb 2012 17:34 #18159 by Fremder
Replied by Fremder on topic Re:PID data saving

Because the sampler is running on a much faster thread than halsampler, the buffer size (depth) may have to be considerably bigger.

You could even start with sampler.depth and halsampler.count set at the same number, where you essentially have a linear buffer and cannot overrun.
Then reduce the size of sampler.depth until overruns occur.

There is a pin sampler.overruns which you could monitor to find an optimum depth which keeps overruns at 0


hi,

the alignment form sampler to halsampler to fifo its not so easy :-)

now i understand it "like this":

SAMPLER its running in servo-thread with 1000000
when i startet the halsampler
with: halcmd loadusr halsampler -t -n 1500 PidXXXX

and i make a time in the gcode exactly: M04 P1.5
then comes
0 .... to 1496 in the first ... file PidXXXX
the next start:
begins with 1497 to 1503 then com "overrun"
and make with 1 ... to 1492 ...
====================================
i see the timing its not 100% -> 8 ns

for me its 1 Sec importend

i make a link to "overrun" and halcmd setp sampler.0.enable 0

yes ... i save the different "steps" in new files and can import allways from <number> 0 to 1000 and the others goes to waste :-)

ok - i thinking bevor your answer SAMPLER its slower then halsampler ...

verry thanks ... now i must home :-)

Please Log in or Create an account to join the conversation.

Time to create page: 0.205 seconds
Powered by Kunena Forum