模拟具有滞后的电感器。
这个例子显示了改变Giles-Atherton磁滞方程的系数如何影响所得到的B-h曲线。 仿真参数被配置为执行四个完整的交流电循环,初始场强(H)和磁通密度(B)设置为零。
模型图:
定义加载和运行模型的函数:
In [ ]:
function start_model_engee()
try
engee.close("inductor_with_hysteresis", force=true) # 关闭模型
catch err # 如果没有模型关闭和engee。close()不执行,它将在catch之后加载。
m = engee.load("$(@__DIR__)/inductor_with_hysteresis.engee") # 加载模型
end;
try
engee.run(m) # 启动模型
catch err # 如果模型没有加载和engee。run()不执行,catch后最下面的两行将被执行。
m = engee.load("$(@__DIR__)/inductor_with_hysteresis.engee") # 加载模型
engee.run(m) # 启动模型
end
end
Out[0]:
启动模型:
In [ ]:
try
start_model_engee() # 使用上面实现的特殊功能运行仿真
catch err
end;
从simout变量输出仿真结果:
In [ ]:
res = collect(simout)
Out[0]:
将结果写入变量:
In [ ]:
H = collect(res[4]) # 场强
B = collect(res[5]) # 磁通密度
Out[0]:
In [ ]:
using Plots
plot(H[100:end,2], B[100:end,2], linewidth=3, xlabel= "H、车辆", ylabel= "B,T", legend=:bottomright)
Out[0]:
新的反向磁化系数的确定:
非线性电感块参数的输出:
In [ ]:
engee.get_param("inductor_with_hysteresis/Nonlinear Inductor")
Out[0]:
我们使用函数重新定义磁滞方程系数的值 set_param! 隐藏在面具下:
In [ ]:
engee.load("$(@__DIR__)/inductor_with_hysteresis.engee")
# @markdown可逆磁化系数:
c = 0.2 # @param {type:"slider", min:0, max:1, step:0.1}
# @减价量比:
K = 200.0 # @param {type:"slider", min:0, max:1000, step:1}
# @markdown跨域耦合系数:
alpha = 0.0001 # @param {type:"slider", min:0, max:0.001, step:0.0001}
engee.set_param!("inductor_with_hysteresis/Nonlinear Inductor", "c" => c)
engee.set_param!("inductor_with_hysteresis/Nonlinear Inductor", "K" => K)
engee.set_param!("inductor_with_hysteresis/Nonlinear Inductor", "alpha" => alpha)
engee.run("inductor_with_hysteresis")
res1 = collect(simout)
H1 = collect(res1[7])
B1 = collect(res1[9])
engee.close("inductor_with_hysteresis", force = true)
plot(H[100:end,2], B[100:end,2], label = "模型的初始参数", xlabel= "H、车辆", ylabel= "B,T", linewidth=3)
plot!(H1[100:end,2], B1[100:end,2], label = "更改模型参数", legend=:bottomright, linewidth=3)
Out[0]:
结论:
在本例中,使用软件控制对具有滞后的电感器模型进行了仿真。 这些图表显示了Giles-Atherton方程的各个系数如何影响滞后曲线。

