带磁滞的电感线圈建模。
本示例展示了改变 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[7]) # напряжённость поля
B = collect(res[9]) # плотность магнитного потока
Out[0]:
In [ ]:
using Plots
plot(H[100:end,2], B[100:end,2], linewidth=3, xlabel= "H, А/м", ylabel= "B, Т", 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}
# @markdown Коэффициент объемной связи:
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, Т", linewidth=3)
plot!(H1[100:end,2], B1[100:end,2], label = "Изменённые параметры модели", legend=:bottomright, linewidth=3)
Out[0]:
结论:
在本示例中,使用软件控制模拟了具有磁滞现象的电感线圈模型。图表显示了 Giles-Atherton 方程的各个系数对磁滞曲线的影响。