开源改变世界!!

派克 AC10 VFD mb2hal 配置 #491

推推 grbl 2年前 (2023-01-29) 163次浏览
关闭
chaotix- 打开了这个问题 2018 年 8 月 24 日 · 5 条评论
关闭

派克 AC10 VFD mb2hal 配置#491

chaotix- 打开了这个问题 2018 年 8 月 24 日 · 5 条评论

注释

派克 AC10 VFD mb2hal 配置 #491
贡献者

我最近通过 mb2hal 将我的 Parker AC10 VFD 连接到 LinuxCNC。

是否有兴趣记录让所有部分协同工作所必需的内容?它将包含 VFD 的必要设置、mb2hal.ini、HAL 配置和 PYVCP-XML 文件(以显示当前速度和全速 LED 指示灯)。

我应该创建一个拉取请求吗?如果是的话,它应该去哪里?在 src/hal/user_comps/mb2hal/examples 或 docs/src/???

或者我应该把它放在这里的问题中,然后有人会把它包括在内吗?

派克 AC10 VFD mb2hal 配置 #491

是的,人们对进行一些演练非常感兴趣——我目前也在尝试通过 modbus 控制带有 linuxcnc 的 parker ac10……

派克 AC10 VFD mb2hal 配置 #491
贡献者作者

这里只是一个快速总结:

  1. 您需要 LinuxCNC > 2.7.14(例如下一个版本)、master 分支或需要自己使用 PR mb2hal 编译 mb2hal:添加 fnct_06_write_single_register  #487mb2hal:在事务错误 #489上调用 modbus_flush() 。

  2. 配置 AC10,使您的主轴正常工作。然后将F203设为10,即可通过ModBus控制。使用寄存器 0x​​2000 启动/停止和设置方向,使用寄存器 0x​​010d (F113) 设置速度,使用寄存器 0x​​1000+ 读取当前状态(更多信息参见手册)。

您可以使用附加的配置文件来开始。当我试图显示主轴的当前功率和平均功率时,它们比必要的更复杂。但我不认为从 VFD 检索到的值是正确的并且太高了。因此,您可以去除应该将 HAL 配置缩小一半的功率计算。

请注意,需要在 AC10 配置寄存器(F111 和 F112)和 custom.hal 文件中设置主轴的最小和最大频率。当然,我不保证这不会烧毁你的房子或引起地震。我只能说它对我来说很好用。

Github 不允许我附加 .ini 和 .hal 文件,因此您需要复制并粘贴它们。

我希望,它有所帮助。

mb2hal.ini文件

[MB2HAL_INIT]

#OPTIONAL: Debug level of init and INI file parsing.
# 0 = silent.
# 1 = error messages (default).
# 2 = OK confirmation messages.
# 3 = debugging messages.

INIT_DEBUG=3

#OPTIONAL: HAL module (component) name. Defaults to "mb2hal".

HAL_MODULE_NAME=spindle-vfd

#OPTIONAL: Insert a delay of "FLOAT seconds" between transactions in order
#to not to have a lot of logging and facilitate the debugging.
#Useful when using DEBUG=3 (NOT INIT_DEBUG=3)
#It affects ALL transactions.
#Use "0.0" for normal activity.

SLOWDOWN=0.0

#REQUIRED: The number of total Modbus transactions. There is no maximum.

TOTAL_TRANSACTIONS=4

#One transaction section is required per transaction, starting at 00 and counting up sequentially.
#If there is a new link (not transaction), you must provide the REQUIRED parameters 1st time.
#Warning: Any OPTIONAL parameter not specified are copied from the previous transaction.

[TRANSACTION_00]
LINK_TYPE=serial
SERIAL_PORT=/dev/ttyUSB0
SERIAL_BAUD=9600

#Data bits. One of 5,6,7,8.
SERIAL_BITS=8

#Data parity. One of: even, odd, none.
SERIAL_PARITY=none

#Stop bits. One of 1, 2.
SERIAL_STOP=2

#Serial port delay between for this transaction only.
#In ms. Defaults to 0.
SERIAL_DELAY_MS=150

MB_SLAVE_ID=1

FIRST_ELEMENT=4096
NELEMENTS=8

#REQUIRED: Modbus transaction function code (see www.modbus.org specifications).
#    fnct_02_read_discrete_inputs     (02 = 0x02)
#    fnct_03_read_holding_registers   (03 = 0x03)
#    fnct_04_read_input_registers     (04 = 0x04)
#    fnct_06_write_single_register    (06 = 0x06)
#    fnct_15_write_multiple_coils     (15 = 0x0F)
#    fnct_16_write_multiple_registers (16 = 0x10)

#fnct_02_read_discrete_inputs: creates boolean output HAL pins.
#fnct_03_read_holding_registers: creates a floating point output HAL pins.
#                           also creates a u32 output HAL pins.
#fnct_04_read_input_registers: creates a floating point output HAL pins.
#                         also creates a u32 output HAL pins.
#fnct_15_write_multiple_coils: creates boolean input HAL pins.
#fnct_16_write_multiple_registers: creates a floating point input HAL pins.

#The pins are named based on component name, transaction number and order number.
#Example: mb2hal.00.01 (transaction=00, second register=01 (00 is the first one))

MB_TX_CODE=fnct_03_read_holding_registers

#OPTIONAL: Response timeout for this transaction. In INTEGER ms. Defaults to 500 ms.
#This is how much to wait for 1st byte before raise an error.

MB_RESPONSE_TIMEOUT_MS=500

#OPTIONAL: Byte timeout for this transaction. In INTEGER ms. Defaults to 500 ms.
#This is how much to wait from byte to byte before raise an error.

MB_BYTE_TIMEOUT_MS=500

#OPTIONAL: Instead of giving the transaction number, use a name.
#Example: mb2hal.00.01 could become mb2hal.plcin.01
#The name must not exceed 32 characters.
#NOTE: when using names be careful that you dont end up with two transactions
#usign the same name.

HAL_TX_NAME=info

#OPTIONAL: Maximum update rate in HZ. Defaults to 0.0 (0.0 = as soon as available = infinit).
#NOTE: This is a maximum rate and the actual rate may be lower.
#If you want to calculate it in ms use (1000 / required_ms).
#Example: 100 ms = MAX_UPDATE_RATE=10.0, because 1000.0 ms / 100.0 ms = 10.0 Hz

MAX_UPDATE_RATE=2.0

#OPTIONAL: Debug level for this transaction only.
#See INIT_DEBUG parameter above.

DEBUG=1

#While DEBUGGING transactions note the returned "ret[]" value correspond to:
#/* Modbus protocol exceptions */
#ILLEGAL_FUNCTION        -0x01 the FUNCTION code received in the query is not allowed or invalid.
#ILLEGAL_DATA_ADDRESS    -0x02 the DATA ADDRESS received in the query is not an allowable address for the slave or is invalid.
#ILLEGAL_DATA_VALUE      -0x03 a VALUE contained in the data query field is not an allowable value or is invalid.
#SLAVE_DEVICE_FAILURE    -0x04 SLAVE (or MASTER) device unrecoverable FAILUER while attemping to perform the requested action.
#SERVER_FAILURE          -0x04 (see above).
#ACKNOWLEDGE             -0x05 This response is returned to PREVENT A TIMEOUT in the master.
#                              A long duration of time is required to process the request in the slave.
#SLAVE_DEVICE_BUSY       -0x06 The slave (or server) is BUSY. Retrasmit the request later.
#SERVER_BUSY             -0x06 (see above).
#NEGATIVE_ACKNOWLEDGE    -0x07 Unsuccessful programming request using function code 13 or 14.
#MEMORY_PARITY_ERROR     -0x08 SLAVE parity error in MEMORY.
#GATEWAY_PROBLEM_PATH    -0x0A (-10) Gateway path(s) not available.
#GATEWAY_PROBLEM_TARGET  -0x0B (-11) The target device failed to repond (generated by master, not slave).
#/* Program or connection */
#COMM_TIME_OUT           -0x0C (-12)
#PORT_SOCKET_FAILURE     -0x0D (-13)
#SELECT_FAILURE          -0x0E (-14)
#TOO_MANY_DATAS          -0x0F (-15)
#INVALID_CRC             -0x10 (-16)
#INVALID_EXCEPTION_CODE  -0x11 (-17)

[TRANSACTION_01]
MB_TX_CODE=fnct_03_read_holding_registers
FIRST_ELEMENT=4119
HAL_TX_NAME=info2
PIN_NAMES=rpm

[TRANSACTION_02]
MB_TX_CODE=fnct_06_write_single_register
FIRST_ELEMENT=8192
HAL_TX_NAME=runmode
PIN_NAMES=command

[TRANSACTION_03]
MB_TX_CODE=fnct_06_write_single_register
FIRST_ELEMENT=269
HAL_TX_NAME=frequency
PIN_NAMES=hz

自定义文件

# Include your customized HAL commands here
# This file will not be overwritten when you run stepconf again

loadusr -Wn spindle-vfd mb2hal config=mb2hal.ini

loadrt mux4 names=mux4.runmode
loadrt mult2 names=mult2.freq,mult2.power-in,mult2.power-out,mult2.power-mean
loadrt limit1 names=limit1.freq
loadrt comp names=comp.status-ok
loadrt and2 names=and2.estop-in
loadrt estop_latch
loadrt near names=near.speed
loadrt sum2 names=sum2.count,sum2.power
loadrt conv_bit_u32 names=cbu.running
loadrt conv_u32_float names=cuf.running
loadrt invert names=invert.count

addf mux4.runmode servo-thread
addf mult2.freq servo-thread
addf mult2.power-in servo-thread
addf mult2.power-out servo-thread
addf mult2.power-mean servo-thread
addf limit1.freq servo-thread
addf comp.status-ok servo-thread
addf and2.estop-in servo-thread
addf estop-latch.0 servo-thread
addf near.speed servo-thread
addf sum2.count servo-thread
addf sum2.power servo-thread
addf cbu.running servo-thread
addf cuf.running servo-thread
addf invert.count servo-thread

# Choose command: Forward/Reverse/Stop
setp mux4.runmode.in0 3         # Dec. stop
setp mux4.runmode.in1 2         # Reverse
setp mux4.runmode.in2 3         # Dec. stop
setp mux4.runmode.in3 1         # Forward
net spindle-on motion.spindle-on => mux4.runmode.sel0
net spindle-fwd motion.spindle-forward => mux4.runmode.sel1
net spindle-runmode mux4.runmode.out => spindle-vfd.runmode.command

# Calculate frequency from desired speed
net spindle-speed motion.spindle-speed-out-abs => mult2.freq.in0
setp mult2.freq.in1 1.666667    # 100 / 120 * motor poles
net spindle-speed-raw mult2.freq.out => limit1.freq.in

# Limit speed output
setp limit1.freq.min 10000      # Min. Frequency * 100
setp limit1.freq.max 40000      # Max. Frequency * 100
net spindle-speed-cmd limit1.freq.out => spindle-vfd.frequency.hz

# Check spindle status for faults
net spindle-status-raw spindle-vfd.info.05.float => comp.status-ok.in0
setp comp.status-ok.in1 25603   # 0x6403 MSB: Drive Ratio (1 * 100), LSB: Status. < 3 = OK

# Trigger estop when vfd reports a fault or estop is pressed in GUI
net estop-ioc-in iocontrol.0.user-enable-out => and2.estop-in.in0
net estop-vfd-in comp.status-ok.out => and2.estop-in.in1

net spindle-status-ok and2.estop-in.out => estop-latch.0.ok-in
net estop-out estop-latch.0.ok-out => iocontrol.0.emc-enable-in
net estop-reset iocontrol.0.user-request-enable => estop-latch.0.reset

# Set motion.spindle-at-speed
net spindle-speed near.speed.in1
net spindle-speed-in spindle-vfd.info2.rpm.float => near.speed.in2
setp near.speed.scale 1.05
net spindle-at-speed near.speed.out => motion.spindle-at-speed

# temperature in °C
net vfd-temp spindle-vfd.info.07.int

# voltage * current * 0.01 = power in W
net spindle-vfd-voltage spindle-vfd.info.01.float => mult2.power-in.in0
net spindle-vfd-current spindle-vfd.info.02.float => mult2.power-in.in1
net spindle-vfd-power mult2.power-in.out => mult2.power-out.in0
setp mult2.power-out.in1 0.01
net vfd-power mult2.power-out.out

# Increment counter when spindle is running
setp sum2.count.in1 0
net spindle-on cbu.running.in
net vfd-power-run-u cbu.running.out => cuf.running.in
net vfd-power-run cuf.running.out => sum2.count.in0
net vfd-power-count sum2.count.out => sum2.count.in1

# Add Power measurements
setp sum2.power.in1 0
net vfd-power sum2.power.in0
net vfd-power-sum sum2.power.out => sum2.power.in1

# Mean power = power-sum / power-count
net vfd-power-count invert.count.in
net count-inverted invert.count.out => mult2.power-mean.in0
net vfd-power-sum mult2.power-mean.in1
net vfd-power-mean mult2.power-mean.out

自定义面板.xml

<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
        <labelframe text="Parker AC10 VFD">
                <font>("Helvetica",12)</font>
                <table>
                        <tablerow/>
                                <tablespan columns="2" />
                                <tablesticky sticky="nsew" />
                                <label>
                                        <text>" "</text>
                                        <font>("Helvetica",2)</font>
                                </label>
                        <tablerow/>
                                <tablesticky sticky="w" />
                                <label>
                                        <text>"Power (current):"</text>
                                </label>
                                <tablesticky sticky="e" />
                                <number>
                                        <halpin>"vfd-power-cur"</halpin>
                                        <format>".0f W"</format>
                                </number>
                        <tablerow/>
                                <tablesticky sticky="w" />
                                <label>
                                        <text>"Power (mean):"</text>
                                </label>
                                <tablesticky sticky="e" />
                                <number>
                                        <halpin>"vfd-power-mean"</halpin>
                                        <format>".0f W"</format>
                                </number>
                        <tablerow/>
                                <tablesticky sticky="w" />
                                <label>
                                        <text>"Spindle at speed:"</text>
                                </label>
                                <tablesticky sticky="e" />
                                <led>
                                        <halpin>"spindle-at-speed"</halpin>
                                        <size>"10"</size>
                                        <on_color>"green"</on_color>
                                        <off_color>"red"</off_color>
                                </led>
                        <tablerow/>
                                <label>
                                        <text>" "</text>
                                </label>
                </table>
                <table>
                        <tablesticky sticky="nsew" />
                        <tablerow/>
                        <tablesticky sticky="nsew" />
                        <label>
                                <text>"Spindle Speed (RPM)"</text>
                                <font>("Helvetica",10)</font>
                        </label>
                        <tablerow/>
                        <tablesticky sticky="nsew" />
                        <label>
                                <text>" "</text>
                                <font>("Helvetica",2)</font>
                        </label>
                        <tablerow/>
                        <tablesticky sticky="nsew" />
                        <bar>
                                <halpin>"spindle-speed-in"</halpin>
                                <max_>24000</max_>
                        </bar>
                </table>
        </labelframe>
</pyvcp>

custom_postgui.hal

# Include your customized HAL commands here
# The commands in this file are run after the AXIS GUI (including PyVCP panel) starts

net vfd-power-mean pyvcp.vfd-power-mean
net vfd-power pyvcp.vfd-power-cur
net spindle-at-speed pyvcp.spindle-at-speed
net spindle-speed-in pyvcp.spindle-speed-in
派克 AC10 VFD mb2hal 配置 #491
超级放克58 评论了 2018 年 9 月 4 日 通过电子邮件
派克 AC10 VFD mb2hal 配置 #491
合作者

也许这属于维基?把它留在这里作为一个开放的问题看起来很糟糕……

派克 AC10 VFD mb2hal 配置 #491
贡献者作者

我在http://wiki.linuxcnc.org/cgi-bin/wiki.pl?VFD_Parker_AC10添加了一个 wiki 页面。