主要的梯形图程序如下,由于使用了西门子的专用块,不能导出为SCL代码,只能贴图了。

程序说明:针对富士MEGA变频器(富士的变频器功能码差别不大,简单修改即可支持其他系列变频器),完整实现MODBUS监控,已经整合全部的运行监控数据到背景数据块中,调用该块就能实现自动同步。

同时实现PLC通过MODBUS修改并监控变频器功能码(FUNCTION CODES,不知道翻译对不对。)

步骤一读取运行状态参数

步骤二读取功能码

步骤三向变频器发送运行设定参数

步骤四修改变频器功能码,功能码只定义了部分,可以自行根据富士的RS485通信手册添加,修改。在实际工程上,不建议通过MODBUS修改功能码。

3

DB块定义:




DATA_BLOCK "DB_MODBUS_DATA"
TITLE = DB_MEGA_MODBUS
{ S7_Optimized_Access := 'FALSE' }
AUTHOR : CWYYPROG
VERSION : 0.1
NON_RETAIN
//富士MEGA系列变频器,运行监控的背景数据块
STRUCT
M01 : Word; // Frequency reference (p.u.) (Final command) W02050
M02 : Word; // Torque command (Final command) W02051
M03 : Word; // Torque current command (Final command) W02052
M04 : Word; // Magnetic flux command value W02053
M05 : Word; // Frequency reference (Final command) W02054
M06 : Word; // Output frequency 1 (p.u.) W02055
M07 : Word; // Torque real value W02056
M08 : Word; // Torque current W02057
M09 : Word; // Output frequency W02058
M10 : Word; // Input power W02059
M11 : Word; // Output current effective value W02060
M12 : Word; // Output voltage effective value W02061
M13 : Word; // Operation command (Final command) W02062
M14 : Word; // Operation status W02063
M15 : Word; // General-purpose output terminal information W02064
M16 : Word; // Latest alarm contents W02065
M17 : Word; // Last alarm contents W02066
M18 : Word; // Second last alarm contents W02067
M19 : Word; // Third last alarm contents W02068
M20 : Word; // Cumulative operation time W02069
M21 : Word; // DC link circuit voltage W02070
M22 : Word; // Motor temperature W02071
M23 : Word; // Model code W02072
M24 : Word; // Capacity code W02073
M25 : Word; // ROM version W02074
M26 : Word; // Transmission error transaction code W02075
M27 : Word; // Frequency reference on alarm (p.u.) (Final command) W02076
M28 : Word; // Torque command on alarm (Final command) W02077
M29 : Word; // Torque current command on alarm (Final command) W02078
M30 : Word; // Flux command on alarm (Final command) W02079
M31 : Word; // Frequency reference on alarm (Final command) W02080
M32 : Word; // Output frequency 1 on alarm (p.u.) W02081
M33 : Word; // Torque real value on alarm W02082
M34 : Word; // Torque current on alarm W02083
M35 : Word; // Output frequency on alarm W02084
M36 : Word; // Input power on alarm W02085
M37 : Word; // Output current effective value on alarm W02086
M38 : Word; // Output voltage effective value on alarm W02087
M39 : Word; // Operation command on alarm W02088
M40 : Word; // Operation status on alarm W02089
M41 : Word; // Output terminal information on alarm W02090
M42 : Word; // Cumulative operation time on alarm W02091
M43 : Word; // DC link circuit voltage on alarm W02092
M44 : Word; // Inverter internal air temperature on alarm W02093
M45 : Word; // Heat sink temperature on alarm W02094
M46 : Word; // Life of main circuit capacitor W02095
M47 : Word; // Life of PC board electrolytic capacitor W02096
M48 : Word; // Life of heat sink W02097
M49 : Word; // Input terminal voltage [12] (p.u.) W02098
M50 : Word; // Input terminal current [C1] (p.u.) W02099
M51 : Word; // Input terminal current [22] W02100
M52 : Word; // Input terminal current [32] W02101
M53 : Word; // Input terminal current [C2] W02102
M54 : Word; // Input terminal voltage [V2] (p.u.) W02103
M61 : Word; // Inverter internal air temperature W02110
M62 : Word; // Heat sink temperature W02111
M63 : Word; // Load rate W02112
M64 : Word; // Motor output W02113
M65 : Word; // Motor output on alarm W02114
M66 : Word; // Speed detection W02115
M67 : Word; // Transmission error handling code 2 W02116
M68 : Word; // PID final command W02117
M69 : Word; // Inverter rated current W02118
M70 : Word; // Operation status 2 W02119
M71 : Word; // Input terminal information W02120
M72 : Word; // PID feedback value W02121
M73 : Word; // PID output W02122
M74 : Word; // Operating status 2 W02123
M76 : Word; // Main circuit capacity life (Elapsed time) W02125
M77 : Word; // Main circuit capacity life (Remaining time) W02126
M81 : Word; // Maintenance (Remaining time) (M1) W02178
M85 : Word; // Maintenance (Starting times) (M1) W02182
M86 : Word; // Light alarm contents (Latest) W02183
M87 : Word; // Light alarm contents (Last) W02184
M88 : Word; // Light alarm contents (Second last) W02185
M89 : Word; // Light alarmcontents (Third last) W02186
S01 : Int; // 频率给定(以最高输出为基准) ,变频器运行参数设定,modbus通信起始地址 401794
Static_2 : Word;
Static_1 : Word;
Static_3 : Word;
S05 : Word; // 频率给定(以0.01HZ为单位)
"s06-08" : Bool;
"s06-09" : Bool;
"s06-10" : Bool;
"s06-11" : Bool;
"s06-12" : Bool;
"s06-13" : Bool; // General-purpose input XF(FWD)
"s06-14" : Bool; // General-purpose input XF(REV)
"s06-15" : Bool; // Alarm reset
"S06-00" : Bool; // 正转指令
"S06-01" : Bool; // 反转指令
"s06-02" : Bool; // General-purpose input X1
"s06-03" : Bool;
"s06-04" : Bool;
"s06-05" : Bool;
"s06-06" : Bool; // General-purpose input X5
"s06-07" : Bool;
s07 : Word; // 通用数字输出
s08 : Word; // 加速时间
s09 : Word; // 减速时间
s10 : Word; // 转矩限制1
s11 : Word; // 转矩限制2
s12 : Word; // 通用模拟量输出
s13 : Word; // PID 指令
s14 : Word; // 报警复位
F00 : Word; // Data Protection W00001,向变频器写入的FOUNCTION CODES
F01 : Word; // Frequency command 1 W00002,
F02 : Word; // Operation method W00003,
F03 : Word; // Maximum frequency 1 W00004,
F04 : Word; // Base frequency 1 W00005,
F05 : Word; // Rated voltage at base frequency 1 W00006,
F00_READ : Word; //从变频器读取出来的FOUNCTION CODES
F01_READ : Word;
F02_READ : Word;
F03_READ : Word;
F04_READ : Word;
END_STRUCT;
BEGIN
S05 := 2000;
"S06-00" := TRUE;
F01 := 16#0001;
F02 := 16#0000;
F03 := 16#01F4;
F04 := 16#01F4;

END_DATA_BLOCK

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据