Engee 文档
Notebook

模拟具有滞后的电感器。

这个例子显示了改变Giles-Atherton磁滞方程的系数如何影响所得到的B-h曲线。 仿真参数被配置为执行四个完整的交流电循环,初始场强(H)和磁通密度(B)设置为零。

模型图:

inductor_with_hysteresis--1732692062795.png

定义加载和运行模型的函数:

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]:
start_model_engee (generic function with 1 method)

启动模型:

In [ ]:
try
    start_model_engee() # 使用上面实现的特殊功能运行仿真
    catch err
    end;

simout变量输出仿真结果:

In [ ]:
res = collect(simout)
Out[0]:
10-element Vector{WorkspaceArray}:
 WorkspaceArray{Float64}("inductor_with_hysteresis/SysOutput_1")
 WorkspaceArray{Float64}("Nonlinear Inductor.v")
 WorkspaceArray{Float64}("Nonlinear Inductor.i")
 WorkspaceArray{Float64}("Nonlinear Inductor.H")
 WorkspaceArray{Float64}("Nonlinear Inductor.B")
 WorkspaceArray{Float64}("Nonlinear Inductor.n.v")
 WorkspaceArray{Float64}("Nonlinear Inductor.p.v")
 WorkspaceArray{Float64}("Nonlinear Inductor.M")
 WorkspaceArray{Float64}("Nonlinear Inductor.Phi")
 WorkspaceArray{Float64}("Nonlinear Inductor.power_dissipated")

将结果写入变量:

In [ ]:
H = collect(res[4]) # 场强
B = collect(res[5]) # 磁通密度
Out[0]:
651×2 DataFrame
626 rows omitted
Rowtimevalue
Float64Float64
10.00.0
20.00010.00734923
30.00020.0234542
40.00030.046533
50.00040.076265
60.00050.112378
70.00060.154527
80.00070.202262
90.00080.255024
100.00090.312132
110.0010.37279
120.00110.436089
130.00120.501028
6400.0639-1.24976
6410.064-1.24918
6420.0641-1.24853
6430.0642-1.24783
6440.0643-1.24705
6450.0644-1.24619
6460.0645-1.24525
6470.0646-1.24421
6480.0647-1.24307
6490.0648-1.24181
6500.0649-1.24042
6510.065-1.23889
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]:
Dict{String, Any} with 27 entries:
  "A_effective"          => Dict{String, Any}("unit"=>"m^2", "value"=>"1.6e-05")
  "H_anhysteretic"       => Dict{String, Any}("unit"=>"A/m", "value"=>"1000")
  "effective_gap"        => Dict{String, Any}("unit"=>"m", "value"=>"0.032")
  "c"                    => "0.1"
  "B_vector"             => Dict{String, Any}("unit"=>"T", "value"=>"[0, .81, 1…
  "L"                    => Dict{String, Any}("unit"=>"H", "value"=>"2e-4")
  "parameterization"     => "Magnetic flux density versus magnetic field streng…
  "BlockName"            => "Nonlinear Inductor"
  "start_option"         => "Current"
  "N"                    => "10"
  "dB_dH_0"              => Dict{String, Any}("unit"=>"T*m/A", "value"=>"0.005")
  "interpolation_option" => "Linear"
  "B_start"              => Dict{String, Any}("unit"=>"T", "value"=>"0")
  "H_start"              => Dict{String, Any}("unit"=>"A/m", "value"=>"0")
  "g"                    => Dict{String, Any}("unit"=>"1/Ohm", "value"=>"1e-9")
  "Phi_start"            => Dict{String, Any}("unit"=>"Wb", "value"=>"0")
  "BlockPath"            => "/Physical Modeling/Electrical/Passive/Nonlinear In…
  "Phi_sat"              => Dict{String, Any}("unit"=>"Wb", "value"=>"1.3e-05")
  "alpha"                => "0.0001"
  "i_L_start"            => Dict{String, Any}("unit"=>"A", "value"=>"0")
  "i_vector"             => Dict{String, Any}("unit"=>"A", "value"=>"[0, .64, 1…
  "L_sat"                => Dict{String, Any}("unit"=>"H", "value"=>"1e-4")
  "H_vector"             => Dict{String, Any}("unit"=>"A/m", "value"=>"[0, 200,…
  "BlockType"            => "AcausalElectricPowerSystems.Passive.NonlinearInduc…
  "Phi_vector"           => Dict{String, Any}("unit"=>"Wb", "value"=>"[0, 1.29,…
  ⋮                      => ⋮

我们使用函数重新定义磁滞方程系数的值 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方程的各个系数如何影响滞后曲线。