1. 恒张力卷绕基础模型建立
任务定义
建立恒张力卷绕控制的基础数学模型,用于后续转矩补偿算法设计。模型需描述卷径变化、转动惯量变化与张力之间的关系,并给出张力控制所需的转矩指令计算式。
物理模型与数学推导
卷绕系统由收卷轴、料卷和张力检测辊组成。设当前卷径为D(t),料卷总转动惯量为J(D),电机输出转矩为T_m,负载扰动转矩为T_L,角速度为ω(t),料线速度为v(t),张力为F(t)。忽略机械损耗时,动力学方程为:
J(D)·dω/dt = T_m − T_L − F(t)·D(t)/2
其中F(t)·D(t)/2为张力产生的负载转矩。卷径变化率与线速度关系:dD/dt = (v·h)/(π·D),h为料厚。恒张力控制目标为F(t)=F_ref(常数),此时张力转矩项F_ref·D/2随卷径增大而增大,需实时补偿。
定义转矩指令T_cmd由三部分构成:
T_cmd = T_acc + T_ten + T_loss
其中T_acc = J(D)·dω/dt为加速转矩,T_ten = F_ref·D/2为张力转矩,T_loss为摩擦等损耗补偿项。本案例聚焦T_ten的实时计算与卷径/惯量更新逻辑。
代码实现
// winding_model.h
#ifndef WINDING_MODEL_H
#define WINDING_MODEL_H
typedef struct {
float D; // 当前卷径 (m)
float D_core; // 卷芯直径 (m)
float h; // 料厚 (m)
float rho; // 材料密度 (kg/m^3)
float width; // 料宽 (m)
float J_motor; // 电机+传动惯量 (kg·m^2)
float F_ref; // 张力设定值 (N)
float v_line; // 线速度 (m/s)
float T_ten; // 张力转矩指令 (N·m)
float J_total; // 总惯量 (kg·m^2)
} WindingCtx;
void winding_init(WindingCtx *ctx);
void winding_update_diameter(WindingCtx *ctx, float dt);
void winding_update_inertia(WindingCtx *ctx);
float winding_tension_torque(WindingCtx *ctx);
#endif
// winding_model.c
#include "winding_model.h"
#include <math.h>
void winding_init(WindingCtx *ctx) {
ctx->D = 0.10f; // 初始卷径 100mm
ctx->D_core = 0.05f; // 卷芯 50mm
ctx->h = 0.0001f; // 料厚 0.1mm
ctx->rho = 900.0f; // 密度 900 kg/m^3
ctx->width = 0.2f; // 料宽 200mm
ctx->J_motor = 0.002f; // 电机惯量
ctx->F_ref = 50.0f; // 张力 50N
ctx->v_line = 2.0f; // 线速度 2m/s
ctx->T_ten = 0.0f;
ctx->J_total = 0.0f;
}
void winding_update_diameter(WindingCtx *ctx, float dt) {
// 卷径变化率 dD/dt = v*h/(π*D)
float dD_dt = (ctx->v_line * ctx->h) / (M_PI * ctx->D);
ctx->D += dD_dt * dt;
if (ctx->D < ctx->D_core) ctx->D = ctx->D_core;
}
void winding_update_inertia(WindingCtx *ctx) {
// 料卷惯量 = 1/2 * m * (R^2 + r_core^2)
float R = ctx->D / 2.0f;
float r_core = ctx->D_core / 2.0f;
float volume = M_PI * (R*R - r_core*r_core) * ctx->width;
float mass = volume * ctx->rho;
float J_roll = 0.5f * mass * (R*R + r_core*r_core);
ctx->J_total = J_roll + ctx->J_motor;
}
float winding_tension_torque(WindingCtx *ctx) {
ctx->T_ten = ctx->F_ref * ctx->D / 2.0f;
return ctx->T_ten;
}
// main.c
#include <stdio.h>
#include "winding_model.h"
int main() {
WindingCtx ctx;
winding_init(&ctx);
float dt = 0.1f; // 控制周期 100ms
printf("时间(s) 卷径(mm) 总惯量(kg·m^2) 张力转矩(N·m)\n");
for (int i = 0; i <= 50; i++) {
winding_update_diameter(&ctx, dt);
winding_update_inertia(&ctx);
float T = winding_tension_torque(&ctx);
if (i % 10 == 0) {
printf("%6.1f %8.2f %12.5f %10.4f\n",
i*dt, ctx.D*1000, ctx.J_total, T);
}
}
return 0;
}
编译与运行
gcc -o winding_model main.c winding_model.c -lm
./winding_model
验证方法
运行程序后观察输出:卷径从100mm逐渐增大,总惯量随卷径增大而增大,张力转矩T_ten = F_ref·D/2随卷径线性增大。在t=5.0s时,卷径应约为100.6mm(由dD/dt≈0.637mm/s推算),张力转矩约为2.515N·m。若输出符合上述趋势且数值在合理范围,则模型建立正确。
预期输出(前几行)
时间(s) 卷径(mm) 总惯量(kg·m^2) 张力转矩(N·m)
0.0 100.00 0.00200 2.5000
10.0 106.37 0.00241 2.6593
20.0 112.74 0.00289 2.8185
30.0 119.11 0.00344 2.9778
40.0 125.48 0.00407 3.1370
50.0 131.85 0.00478 3.2963
判定标准
满足以下条件即通过验证:
- 程序可编译运行,无报错;
- 卷径随时间单调增大,且增量符合dD/dt公式;
- 总惯量随卷径增大而增大;
- 张力转矩严格等于F_ref·D/2,数值随卷径线性增长。