Solved : THCAD with toma_thc config help needed

More
14 Feb 2019 08:13 #126437 by rodw
The correct way is to deploy a hal file that lives in /lib/hallib with the linuxcnc distribution
github.com/LinuxCNC/linuxcnc/tree/master/lib/hallib
Lets call it plasmalib.hal for now
Users should not change plasmalib.hal. If a hal pin that is configured in this file needs reassignment, then users should create a new hal file that unlinks the pins and reassigns them. By keeping these changes in a totally seperate hal file, it will become very easy to support users. This is how Dewey set up the stuff I'm working with and it works well.
The following user(s) said Thank You: tommylight

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

More
14 Feb 2019 23:34 #126504 by tommylight
It seems to work just fine from what i can test in hal !
Thank you Phill & Co.
Here are some screenshots of it while testing, had to modify it just a bit as it was keeping both outputs high after reaching the above or below set value and they wound not go off. Now they do, they just neede to be declared as 2 separate if/else. Attached is the corrected comp, in case someone wants to give it a try.
ToDo: add PyVCP panel for it and wire it in hal !






component torchud "Torch Up Down";

description 
"""
torch up down by voltage calculated from encoder velocity
""";
 
license "GPLv2 or greater";

option singleton yes;

// Input Pins
pin in bit   enable         "enable up/down";
pin in float encoder_in     "connect to encoder.nn.velocity";
pin in float voltage_offset "to set 0 volts";
pin in float voltage_scale  "to set correct voltage";
pin in float setpoint       "setpoint voltage";
pin in float tolerance      "deviation from setpoint before up/down";

// Output Pins
pin out float arc_voltage   "calculated arc voltage";
pin out bit   move_up       "arc voltage is too low";
pin out bit   move_down     "arc voltage is too high";

function _;

;;

#include "rtapi_math.h"

FUNCTION(_) {
    arc_voltage = (encoder_in - voltage_offset) * voltage_scale;
    if(arc_voltage < 0){arc_voltage = 0;}
    if(enable && arc_voltage > setpoint + tolerance){
        move_down = 1;
    }else{
        move_down = 0;
    }
    if(enable && arc_voltage < setpoint - tolerance){
        move_up = 1;
    }else{
        move_up =0;
    }
}
The following user(s) said Thank You: phillc54

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

More
15 Feb 2019 02:32 - 15 Feb 2019 02:34 #126514 by tommylight
Added provisions to send an ARCOK signal if the voltage is within set limits and they can be adjusted separately. Wired the THCAD to the 7i77 encoder input, got the scale and offset roughly correct and everything is looking OK so far. More testing is in order.
Here is the comp
component torchud "Torch Up Down";

description 
"""
torch up down by voltage calculated from encoder velocity
""";
 
license "GPLv2 or greater";

option singleton yes;

// Input Pins
pin in bit   enable         "enable up/down";
pin in float encoder_in     "connect to encoder.nn.velocity";
pin in float voltage_offset "to set 0 volts";
pin in float voltage_scale  "to set correct voltage";
pin in float setpoint       "setpoint voltage";
pin in float tolerance      "deviation from setpoint before up/down";
pin in float arc_ok_min     "min voltage to generate arc ok signal";
pin in float arc_ok_max     "max voltage to genarate arc ok signal";

// Output Pins
pin out float arc_voltage   "calculated arc voltage";
pin out bit   move_up       "arc voltage is too low";
pin out bit   move_down     "arc voltage is too high";
pin out bit   arc_ok        "signal that arc volatage is ok";

function _;

;;

#include "rtapi_math.h"

FUNCTION(_) {
    arc_voltage = (encoder_in - voltage_offset) * voltage_scale;
    if(arc_voltage < 0){arc_voltage = 0;}
    if(arc_voltage > arc_ok_min && arc_voltage < arc_ok_max){
		arc_ok = 1;
	}else{
		arc_ok = 0;
	}
    if(enable && arc_voltage > setpoint + tolerance){
        move_down = 1;
    }else{
        move_down = 0;
    }
    if(enable && arc_voltage < setpoint - tolerance){
        move_up = 1;
    }else{
        move_up =0;
    }
}
Last edit: 15 Feb 2019 02:34 by tommylight.
The following user(s) said Thank You: phillc54

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

More
15 Feb 2019 02:52 #126515 by phillc54
OOPS, Yes, I should have turned move_down off when turning move_up on and vice versa.

Cheers, Phill
The following user(s) said Thank You: tommylight

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

More
15 Feb 2019 03:01 #126516 by rodw
Tommy, Phill great work to get this far. Really looking forward to see the final result! When you have LinuxCNC who needs external hardware anyway?
The following user(s) said Thank You: phillc54

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

More
15 Feb 2019 03:08 #126517 by tommylight
Good morning Australia ! Still dark here, 4AM.
Now you can also give it a try and see how it behaves.
Thank you all, off to bed if i can fall asleep at all !
The following user(s) said Thank You: phillc54, rodw

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

More
17 Feb 2019 00:27 #126637 by tommylight
Working on Phill's config, got it to work to a certain point and noticed some fuzzy stuff going on. Reporting at it's original thread, if i can find it. :)
The following user(s) said Thank You: rodw

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

More
17 Feb 2019 21:05 #126694 by tommylight
Added some more configs for full servo systems with Mesa cards, and some with THCAD from Mesa. More to come.
forum.linuxcnc.org/plasma-laser/34978-th...-configs-with-how-to

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

Time to create page: 0.190 seconds
Powered by Kunena Forum