Saving parameters after shut down

More
31 May 2013 14:24 - 31 May 2013 14:26 #35004 by mariusl
I have done some more testing. It would seem that the read on start up is not doing what is expected. The write at shut down works fine. I had to explicitly trigger the read function with an edge detector on the halui.machine.is-on pin.

I dont know if precedence has something to do with what is not happening.

Regards
Marius


www.bluearccnc.com

Last edit: 31 May 2013 14:26 by mariusl.

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

More
31 May 2013 15:06 - 31 May 2013 21:00 #35005 by ArcEye
Hi

The wiki contains incorrect descriptions of the pins - like this F.00 instead of F-00


Sorted out, thanks for the heads up.

I have done some more testing. It would seem that the read on start up is not doing what is expected


I'll be able to look at it later today. Read obviously won't work if the file doesn't exist or it cannot open it for some reason.
I have forgotten most of it already, but a quick scan of the code shows that it should work so long as it was loaded with onstart=1

I'll get back to you

regards
Last edit: 31 May 2013 21:00 by ArcEye.

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

More
31 May 2013 16:32 - 31 May 2013 16:33 #35007 by mariusl
ArcEye
The file is present and can be read as I do with the manual trigger. It does not give any error but the values are all zero when I look at it in HAL. So the comp function as I see it, it is just the read at start up that seems to have a timing issue or something else.

Regards
Marius


www.bluearccnc.com

Last edit: 31 May 2013 16:33 by mariusl.

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

More
31 May 2013 20:58 - 31 May 2013 21:19 #35018 by ArcEye
Hi

Typically I cannot reproduce this

I had a file ~/linuxcnc/param.sav which contained
10.000000
20.000000
30.000000
40.000000
50.000000
60.000000


From a terminal I did

root@INTEL-QUAD:/prog/EMC/Userspace_modules/paramsaver# halrun
halcmd: loadusr ./paramsaver f=6 onstart=1 onexit=1
halcmd: show pin
Component Pins:
Owner Type Dir Value Name
5 float IN 0 paramsaver.invalueF-00
5 float IN 0 paramsaver.invalueF-01
5 float IN 0 paramsaver.invalueF-02
5 float IN 0 paramsaver.invalueF-03
5 float IN 0 paramsaver.invalueF-04
5 float IN 0 paramsaver.invalueF-05
5 float OUT 10 paramsaver.outvalueF-00
5 float OUT 20 paramsaver.outvalueF-01
5 float OUT 30 paramsaver.outvalueF-02
5 float OUT 40 paramsaver.outvalueF-03
5 float OUT 50 paramsaver.outvalueF-04
5 float OUT 60 paramsaver.outvalueF-05
5 bit IN FALSE paramsaver.readtrigger
5 bit IN FALSE paramsaver.writetrigger
halcmd : exit


As you can see the out pins were filled from the file.

When I quit, the file param.sav contained six 0.000000 values, as all the in pins were zero.

So all as expected? I take it you are using the newest version?

I do have to make some changes to restrict the number of pins that can be created and expand the number fields, currently run out at 99.
I will probably restrict to 1000, can't see any possibility that someone would need more than that, unless you have other ideas.
(probably 99 would be enough in reality)

Try the same test as above and see if it sheds any light on why your set up does not work like that

regards
Last edit: 31 May 2013 21:19 by ArcEye.

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

More
01 Jun 2013 03:47 #35061 by mariusl
I am using the latest.
I can read the file under manual control but not when my complete system starts up. All the pins of the component are zero although the file has contents.
I am using the halui.machine.is-on for now to trigger a read and that suits me better for now.

Regards
Marius


www.bluearccnc.com

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

More
01 Jun 2013 23:19 #35103 by ArcEye
Hi

I have tried tests with loading the component with loadusr -W , thinking that might affect timings but makes no difference, the values from file are copied to the pins.

I can only suggest you try loading the component at the start of your main hal file and then reference it later in the custom_postgui.hal file, that should give plenty of time for it to initialize.
But I am not sure if it should actually make any difference.

I have added a debug printout into the file read which is only printed if onstart=1 at the initial read of the file.
See if that prints to stderr and contains the right file name.

Rename the file paramsaver.c and compile with comp --install --userspace paramsaver.c

regards


File Attachment:

File Name: paramsaver.txt
File Size:9 KB
Attachments:

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

More
02 Jun 2013 00:30 #35116 by mariusl
Hi
I load the component right at the start. Well just after my usbio component. I will try your debug print and see what it does.

Regards
Marius


www.bluearccnc.com

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

More
05 Jun 2013 22:49 #35284 by jlviloria
hello,

What a great job, works perfect .... but I have a doubt.

Variables:

paramsaver.writetrigger
paramsaver.readtrigger

what would be the most optimal way so there is no conflict with what you read, what you write.

I tried the following:
net machine-on halui.machine.is-on paramsaver.readtrigger
net machine-on paramsaver.writetrigger

but I work in a variable but in another nop.

I'm trying to use this for my chuck, ID / OD, open / close.

attached my files, I am trying to gmoccapy, which is the GUI I use, with classicladder.
Attachments:

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

More
05 Jun 2013 23:36 #35285 by mariusl
@jl

I used two edge components with a time-on delay of 2 seconds and a time-off delay of 0,

here is my code for that
loadusr -W paramsaver f=10 s=0 b=0 filename=mc200 onstart=0 onexit=0


loadrt edge count=2
addf edge.0 servo-thread
addf edge.1 servo-thread
setp edge.0.in-edge 0  #rising edge
setp edge.0.out-width-ns 2000000000
setp edge.1.in-edge 1 #falling edge
setp edge.1.out-width-ns 2000000000


############### FILE SAVER ###################
net plasmaOn  		edge.0.in 		 edge.1.in 
net file_read 			edge.0.out  		 paramsaver.readtrigger
net file_write 		edge.1.out 		 paramsaver.writetrigger


Regards
Marius


www.bluearccnc.com

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

More
05 Jun 2013 23:42 #35288 by mariusl
And this is how I used it
################# THCCALC ####################
setp thc200.arc-threshold 10

net init_0 					paramsaver.outvalueF-00   		pyvcp.spinbox.0.param_pin
net init_1 					paramsaver.outvalueF-01   		pyvcp.spinbox.1.param_pin
net init_2 					paramsaver.outvalueF-02   		pyvcp.spinbox.2.param_pin
net init_3 					paramsaver.outvalueF-03   		pyvcp.spinbox.3.param_pin
net init_4 					paramsaver.outvalueF-04   		pyvcp.spinbox.4.param_pin
net init_5 					paramsaver.outvalueF-05   		pyvcp.spinbox.5.param_pin
net init_6 					paramsaver.outvalueF-06   		pyvcp.spinbox.6.param_pin


net involt					paramsaver.invalueF-00
net thc-vel-tol 		                paramsaver.invalueF-01
net thc-cor-vel			        paramsaver.invalueF-02
net thc-win					paramsaver.invalueF-03
net thc-min					paramsaver.invalueF-04
net thc-max					paramsaver.invalueF-05
net thc-delay				        paramsaver.invalueF-06


net involt  				        pyvcp.set-volts    					thc200.set-voltage-in


############################# THC connections ##################################
net thc-enable 			        pyvcp.thc-enable 					thcud.enable
#net thc-voltset 		                pyvcp.volts-requested 			thcud.volts-requested
#net thc-req-vel 		                thcud.requested-vel 				motion.requested-vel
#net thc-cur-vel 		                thcud.current-vel 					motion.current-vel
net thc-vel-status 	                pyvcp.vel-status 					thcud.vel-status
net thc-vel-tol 		                pyvcp.vel-tol 						thcud.velocity-tol
net thc-cor-vel 		                pyvcp.thc-velocity => 				thcud.speed
net thc-min				        pyvcp.thc-min					thcud.min-offset
net thc-max				        pyvcp.thc-max					thcud.max-offset


net thc-win 				        pyvcp.thc-window 				thc200.voltage-window
net ArcOK   =>  		                pyvcp.arc-ok
net volt_ok 				        thc200.volts-ok => 				pyvcp.volts-ok
net MoveUp => 			        pyvcp.volts-under
net MoveDown => 		        pyvcp.volts-high
net offset 					thcud.cur-offset => 				pyvcp.offset
net thc-delay				        pyvcp.thc-delay					timedelay.1.on-delay					

I dont know why the forum box dont keep my formatting :(

Regards
Marius


www.bluearccnc.com

The following user(s) said Thank You: ArcEye

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

Time to create page: 0.150 seconds
Powered by Kunena Forum