sum2 gain settings to select two values

More
13 Oct 2016 05:55 - 13 Oct 2016 05:55 #81596 by auto-mation-assist
I have been trying to change the gain settings on both gain inputs of the sum2 function from within hal from the output of a mux2 function. Setp will set it to one of the two values I need for each input but I need to switch each gain input between two values from within hal. Is this possible if the mux2 output can somehow be converted to a float number? If not is there alternative that would give the same result?
Last edit: 13 Oct 2016 05:55 by auto-mation-assist.

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

More
13 Oct 2016 14:02 #81605 by PCW
mux2 does use floating point inputs and outputs

mux_generic can use either and can even do conversions
The following user(s) said Thank You: auto-mation-assist

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

More
13 Oct 2016 16:49 #81617 by auto-mation-assist
sum2 was the source of my problem. The problem was that the below listed items in sum2 are parameters and can only be set by using "setp" in the hal file and can only input a number. To work around this problem I have modified my sum2 function and changed the three parameters to input pins, and then re-compiled linuxcnc. This fixes my problem but makes updating linuxcnc a little harder due to the customized sum2 having to replace the supplied one before compiling. I think that making these changes makes the sum2 function much more useful.

sum2.N.gain0 float rw (default: 1.0)
sum2.N.gain1 float rw (default: 1.0)
sum2.N.offset float rw

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

More
15 Oct 2016 18:40 #81671 by andypugh
If you want to do mutiplication then the "scale" function is likely to work better than a modified "sum2"

The "gain" parameters of "sum2" are mainly intended to make subtraction possible, and maybe to handle unit conversion.
The following user(s) said Thank You: auto-mation-assist

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

Time to create page: 0.064 seconds
Powered by Kunena Forum