dodalem obsluge vfd
This commit is contained in:
74
custom.hal
74
custom.hal
@@ -1,4 +1,76 @@
|
|||||||
# Include your custom HAL commands here
|
# Include your custom HAL commands here
|
||||||
# This file will not be overwritten when you run stepconf again
|
# This file will not be overwritten when you run stepconf again
|
||||||
|
|
||||||
net spindle-on <= spindle.0.on
|
#net spindle-on <= spindle.0.on
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# Vevor D100 VFD Modbus (mb2hal) Integration
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
# Load the mb2hal component
|
||||||
|
loadusr -Wn vfd mb2hal config=vfd_d100.ini
|
||||||
|
|
||||||
|
# Load helper components
|
||||||
|
loadrt scale names=spindle_speed_scale,spindle_feedback_scale
|
||||||
|
loadrt mux2 names=spindle_dir_mux,spindle_run_mux
|
||||||
|
loadrt near names=spindle_at_speed_near
|
||||||
|
|
||||||
|
# Add helper components to the servo thread
|
||||||
|
addf spindle_speed_scale servo-thread
|
||||||
|
addf spindle_feedback_scale servo-thread
|
||||||
|
addf spindle_dir_mux servo-thread
|
||||||
|
addf spindle_run_mux servo-thread
|
||||||
|
addf spindle_at_speed_near servo-thread
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# 1. Spindle Run & Direction Logic
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
# Direction Mux Input Values: 2.0 = Forward Run, 4.0 = Reverse Run
|
||||||
|
setp spindle_dir_mux.in0 2.0
|
||||||
|
setp spindle_dir_mux.in1 4.0
|
||||||
|
|
||||||
|
# Run Mux Input Values: 8.0 = Stop, in1 = value from direction mux
|
||||||
|
setp spindle_run_mux.in0 8.0
|
||||||
|
|
||||||
|
# Connect selection signals
|
||||||
|
net spindle-rev-sig spindle.0.reverse => spindle_dir_mux.sel
|
||||||
|
net spindle-dir-cmd spindle_dir_mux.out => spindle_run_mux.in1
|
||||||
|
|
||||||
|
net spindle-on-sig spindle.0.on => spindle_run_mux.sel
|
||||||
|
net spindle-run-cmd spindle_run_mux.out => vfd.control.00.float
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# 2. Spindle Commanded Speed Scaling
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
# Gain = 4000 / 24000 = 0.16666667
|
||||||
|
setp spindle_speed_scale.gain 0.16666667
|
||||||
|
setp spindle_speed_scale.offset 0.0
|
||||||
|
|
||||||
|
# Connect signals
|
||||||
|
net spindle-speed-cmd spindle.0.speed-out-abs => spindle_speed_scale.in
|
||||||
|
net spindle-speed-scaled spindle_speed_scale.out => vfd.speed.00.float
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# 3. Spindle Speed Feedback (RPM to RPS)
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
# Gain = 1 / 60 = 0.01666667 (converts RPM to RPS)
|
||||||
|
setp spindle_feedback_scale.gain 0.01666667
|
||||||
|
setp spindle_feedback_scale.offset 0.0
|
||||||
|
|
||||||
|
# Connect signals
|
||||||
|
net spindle-rpm-feedback vfd.metrics.rpm.float => spindle_feedback_scale.in
|
||||||
|
net spindle-rps-feedback spindle_feedback_scale.out => spindle.0.speed-in
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# 4. Spindle "At Speed" Detection
|
||||||
|
# =====================================================================
|
||||||
|
|
||||||
|
# Configure allowable difference (e.g., within 5% or 300 RPM)
|
||||||
|
setp spindle_at_speed_near.difference 300.0
|
||||||
|
# We want the speed to be compared on the absolute commanded speed (RPM)
|
||||||
|
net spindle-speed-cmd => spindle_at_speed_near.in1
|
||||||
|
net spindle-rpm-feedback => spindle_at_speed_near.in2
|
||||||
|
net spindle-at-speed spindle_at_speed_near.out => spindle.0.at-speed
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ net tool-number => qtpyvcp_manualtoolchange.number
|
|||||||
net probe-in <= qtpyvcp.probe-led.on
|
net probe-in <= qtpyvcp.probe-led.on
|
||||||
|
|
||||||
# *** Set line below for actual spindle readout from your hal file ***
|
# *** Set line below for actual spindle readout from your hal file ***
|
||||||
# net spindle-rpm-filtered scale_to_rpm.out => qtpyvcp.spindle-encoder-rpm.in
|
net spindle-rpm-feedback => qtpyvcp.spindle-encoder-rpm.in
|
||||||
|
|||||||
96
vfd_d100.ini
Normal file
96
vfd_d100.ini
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
# Configuration file for mb2hal to communicate with Vevor D100 VFD
|
||||||
|
# via Modbus RTU (RS485)
|
||||||
|
#
|
||||||
|
# Load component using:
|
||||||
|
# loadusr -W mb2hal config=vfd_d100.ini
|
||||||
|
|
||||||
|
[MB2HAL_INIT]
|
||||||
|
|
||||||
|
# Debug level: 0 = silent, 1 = errors, 2 = OK messages, 3 = debugging, 4 = max debug
|
||||||
|
INIT_DEBUG=1
|
||||||
|
|
||||||
|
# Set to 1.1 to enable float/int pin options and specific features
|
||||||
|
VERSION=1.1
|
||||||
|
|
||||||
|
# HAL module (component) name. Pins will be prefixed with this name.
|
||||||
|
HAL_MODULE_NAME=vfd
|
||||||
|
|
||||||
|
# Delay between transactions in seconds (helps slower VFDs process requests)
|
||||||
|
SLOWDOWN=0.1
|
||||||
|
|
||||||
|
# Number of transactions defined below
|
||||||
|
TOTAL_TRANSACTIONS=4
|
||||||
|
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# TRANSACTION 00: Write Main Control Register (0200H / 512 dec)
|
||||||
|
# =====================================================================
|
||||||
|
[TRANSACTION_00]
|
||||||
|
LINK_TYPE=serial
|
||||||
|
SERIAL_PORT=/dev/ttyUSB0
|
||||||
|
SERIAL_BAUD=9600
|
||||||
|
SERIAL_BITS=8
|
||||||
|
SERIAL_PARITY=none
|
||||||
|
SERIAL_STOP=1
|
||||||
|
# Delay after transmission in ms (helps with VFD response processing and EMI)
|
||||||
|
SERIAL_DELAY_MS=50
|
||||||
|
MB_SLAVE_ID=1
|
||||||
|
|
||||||
|
MB_TX_CODE=fnct_06_write_single_register
|
||||||
|
FIRST_ELEMENT=512
|
||||||
|
NELEMENTS=1
|
||||||
|
HAL_TX_NAME=control
|
||||||
|
MAX_UPDATE_RATE=2.0
|
||||||
|
MB_RESPONSE_TIMEOUT_MS=1000
|
||||||
|
MB_BYTE_TIMEOUT_MS=1000
|
||||||
|
DEBUG=1
|
||||||
|
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# TRANSACTION 01: Write Given Frequency (0201H / 513 dec)
|
||||||
|
# =====================================================================
|
||||||
|
[TRANSACTION_01]
|
||||||
|
MB_SLAVE_ID=1
|
||||||
|
MB_TX_CODE=fnct_06_write_single_register
|
||||||
|
FIRST_ELEMENT=513
|
||||||
|
NELEMENTS=1
|
||||||
|
HAL_TX_NAME=speed
|
||||||
|
MAX_UPDATE_RATE=2.0
|
||||||
|
MB_RESPONSE_TIMEOUT_MS=1000
|
||||||
|
MB_BYTE_TIMEOUT_MS=1000
|
||||||
|
DEBUG=1
|
||||||
|
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# TRANSACTION 02: Read Main Control Status (0210H / 528 dec)
|
||||||
|
# =====================================================================
|
||||||
|
[TRANSACTION_02]
|
||||||
|
MB_SLAVE_ID=1
|
||||||
|
MB_TX_CODE=fnct_03_read_holding_registers
|
||||||
|
FIRST_ELEMENT=528
|
||||||
|
NELEMENTS=1
|
||||||
|
HAL_TX_NAME=status
|
||||||
|
MAX_UPDATE_RATE=2.0
|
||||||
|
MB_RESPONSE_TIMEOUT_MS=1000
|
||||||
|
MB_BYTE_TIMEOUT_MS=1000
|
||||||
|
DEBUG=1
|
||||||
|
|
||||||
|
|
||||||
|
# =====================================================================
|
||||||
|
# TRANSACTION 03: Read Operating Parameters (0220H - 0223H / 544 - 547 dec)
|
||||||
|
# =====================================================================
|
||||||
|
[TRANSACTION_03]
|
||||||
|
MB_SLAVE_ID=1
|
||||||
|
MB_TX_CODE=fnct_03_read_holding_registers
|
||||||
|
FIRST_ELEMENT=544
|
||||||
|
# Receptors:
|
||||||
|
# 544 (0220H) = Output Frequency (Hz * 10)
|
||||||
|
# 545 (0221H) = Set Frequency (Hz * 10)
|
||||||
|
# 546 (0222H) = Output Current (A * 10)
|
||||||
|
# 547 (0223H) = Output Speed (RPM)
|
||||||
|
PIN_NAMES=freq_out,freq_set,current,rpm
|
||||||
|
HAL_TX_NAME=metrics
|
||||||
|
MAX_UPDATE_RATE=2.0
|
||||||
|
MB_RESPONSE_TIMEOUT_MS=1000
|
||||||
|
MB_BYTE_TIMEOUT_MS=1000
|
||||||
|
DEBUG=1
|
||||||
Reference in New Issue
Block a user