Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with BifurcationKit Not Detecting Actual Bifurcation Point #163

Open
Sam-afk-del opened this issue Jul 5, 2024 · 2 comments
Open

Comments

@Sam-afk-del
Copy link

Sam-afk-del commented Jul 5, 2024

I have determined through the ODE solver that my model exhibits bifurcation phenomena near the parameter SCR=2.05. However, when I use BifurcationKit.jl for bifurcation analysis of this parameter, I failed to find the bifurcation point. Could you help me analyze the reason?

using Revise, Plots, Parameters, BifurcationKit, JLD2, ODEInterfaceDiffEq, DifferentialEquations,MATLABDiffEq,MATLAB,ParameterizedFunctions,LinearAlgebra
const BK=BifurcationKit
include("ODE_BEN_0705.jl")

file = jldopen("u0_new.jld2", "r")
u0 = file["u0_new"]
close(file)


par_ODE  = ( AAi=5e6, AAu=5e8, Ihold=5e-3, KpIdc=1.0989, SCR=2.06);
prob_ODE = ODEProblem(ODE_BEN_0705, u0, (0, 0.02), par_ODE, reltol=1e-9, abstol=1e-11)
sol = @time solve(prob_ODE,progress = true)
prob_br = BifurcationProblem(ODE_BEN_0705, u0, par_ODE, (@lens _.SCR))

argspo = (record_from_solution = (x, p) -> begin
		xtt = get_periodic_orbit(p.prob, x, p.p)
		return (norm = norm(xtt[:,end],2),
				min = minimum(xtt[1,:]),
				period = getperiod(p.prob, x, p.p))
	end,
	plot_solution = (x, p; k...) -> begin
		xtt = get_periodic_orbit(p.prob, x, p.p)
		plot!(xtt.t, xtt[28,:]; label = "x", k...)
		plot!(xtt.t, xtt[54,:]; label = "y", k...)
		# plot!(br; subplot = 1, putspecialptlegend = false)
	end)

ls = GMRESKrylovKit(dim = 1000, verbose = 0)
newton_options = NewtonPar(tol = 1e-7, max_iterations = 15, linsolver = ls; verbose = true)
opts_br = ContinuationPar(p_min = 1.8, p_max = 2.1, ds = 1e-2, dsmax = 1.0, dsmin = 5e-4; 
                          detect_bifurcation = 3,
                          n_inversion = 6, nev = 7, max_steps = 250, tol_stability = 1e-5, 
						  plot_every_step = 1,newton_options)

probsh, cish = generate_ci_problem(ShootingProblem(M = 1), prob_br, prob_ODE, sol,  jacobian = BK.AutoDiffDense(),parallel=true,
                                   0.02, abstol = 1e-11, reltol = 1e-9)

br_fold_sh = continuation(probsh, cish, PALC(), opts_br;
    verbosity=2,
    plot=true,
    bothside=true,
	linear_algo = BorderingBLS(solver = newton_options.linsolver, check_precision = false),
	normC = norminf,
    argspo...
)
using Plots
scene = plot(br_fold_sh)

function ODE_BEN_0705(dydt, X, p, t=0)
    # input:Eabc Edc
    # state:uC1R uC2R uC3R uC4R iL1R iL2R iLgR iLcYR iLcDR uCdcY uCdcD iLdcR iLdcI 
    # output: 
    # parameter:
    AAi, AAu, Ihold, KpIdc, SCR = p;
    y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,
    y11,y12,y13,y14,y15,y16,y17,y18,y19,y20,
    y21,y22,y23,y24,y25,y26,y27,y28,y29,y30,
    y31,y32,y33,y34,y35,y36,y37,y38,y39,y40,
    y41,y42,y43,y44,y45,y46,y47,y48,y49,y50,
    y51,y52,y53,y54,y55,y56,y57=X;


    ##
     ##! 
     Sbase_rec=603.73;Ubase1_rec=345*sqrt(2/3);Ubase2_rec=213.4557*sqrt(2/3);
     Ibase1_rec=2/3*Sbase_rec/Ubase1_rec;Ibase2_rec=2/3*Sbase_rec/Ubase2_rec;
     Sbase_inv=591.79;Ubase1_inv=230*sqrt(2/3);Ubase2_inv=209.2288*sqrt(2/3);
     Ibase1_inv=2/3*Sbase_inv/Ubase1_inv;Ibase2_inv=2/3*Sbase_inv/Ubase2_inv;
     Ibase_dc=2;Ubase_dc=500;

     ##! 
     iLcYRa=y1*(Ibase2_rec);iLcYRb=y2*(Ibase2_rec);iLcYRc=(-y1-y2)*(Ibase2_rec);uCYR=y3*(Ubase_dc/2);
     iLdcR=y4*(Ibase_dc);iLdcI=y5*(Ibase_dc);uCdc=y6*(Ubase_dc);
     iLcDRa=y7*(Ibase2_rec);iLcDRb=y8*(Ibase2_rec);iLcDRc=(-y7-y8)*(Ibase2_rec);uCDR=y9*(Ubase_dc/2);
     xpllR=y10;thetaPLLR=y11;
     idcRF=y12;xidcR=y13;
     uC1Ra=y14*(Ubase1_rec);uC1Rb=y15*(Ubase1_rec);uC1Rc=(-y14-y15)*(Ubase1_rec);
     uC2Ra=y16*(Ubase1_rec);uC2Rb=y17*(Ubase1_rec);uC2Rc=(-y16-y17)*(Ubase1_rec);
     uC3Ra=y18*(Ubase1_rec);uC3Rb=y19*(Ubase1_rec);uC3Rc=(-y18-y19)*(Ubase1_rec);
     uC4Ra=y20*(Ubase1_rec);uC4Rb=y21*(Ubase1_rec);uC4Rc=(-y20-y21)*(Ubase1_rec);
     iL1Ra=y22*(Ibase1_rec);iL1Rb=y23*(Ibase1_rec);iL1Rc=(-y22-y23)*(Ibase1_rec);
     iL2Ra=y24*(Ibase1_rec);iL2Rb=y25*(Ibase1_rec);iL2Rc=(-y24-y25)*(Ibase1_rec);
     iLgRa=y26*(Ibase1_rec);iLgRb=y27*(Ibase1_rec);iLgRc=(-y26-y27)*(Ibase1_rec);

     ##! 
     iLcYIa=y28*(Ibase2_inv);iLcYIb=y29*(Ibase2_inv);iLcYIc=(-y28-y29)*(Ibase2_inv);uCYI=y30*(Ubase_dc/2);
     iLcDIa=y31*(Ibase2_inv);iLcDIb=y32*(Ibase2_inv);iLcDIc=(-y31-y32)*(Ibase2_inv);uCDI=y33*(Ubase_dc/2);
     xpllI=y34;thetaPLLI=y35;
     udcIF=y36;xudcI=y37;
     uC1Ia=y38*(Ubase1_inv);uC1Ib=y39*(Ubase1_inv);uC1Ic=(-y38-y39)*(Ubase1_inv);
     uC2Ia=y40*(Ubase1_inv);uC2Ib=y41*(Ubase1_inv);uC2Ic=(-y40-y41)*(Ubase1_inv);
     uC3Ia=y42*(Ubase1_inv);uC3Ib=y43*(Ubase1_inv);uC3Ic=(-y42-y43)*(Ubase1_inv);
     uC4Ia=y44*(Ubase1_inv);uC4Ib=y45*(Ubase1_inv);uC4Ic=(-y44-y45)*(Ubase1_inv);
     iL1Ia=y46*(Ubase1_inv);iL1Ib=y47*(Ubase1_inv);iL1Ic=(-y46-y47)*(Ubase1_inv);
     iL2Ia=y48*(Ubase1_inv);iL2Ib=y49*(Ubase1_inv);iL2Ic=(-y48-y49)*(Ubase1_inv);
     iLg1Ia=y50*(Ibase1_inv);iLg1Ib=y51*(Ibase1_inv);iLg1Ic=(-y50-y51)*(Ibase1_inv);
     iLg2Ia=y52*(Ibase1_inv);iLg2Ib=y53*(Ibase1_inv);iLg2Ic=(-y52-y53)*(Ibase1_inv);
     udcFI=y54*(Ubase_dc);iLdcFI=y55*(Ibase_dc);

     ##! 
     SIN=y56;COS=y57;
    ##

     ##!
     w0=100*pi;
     ###
     C1R=6.685e-6;C2R=74.28e-6;C3R=6.685e-6;C4R=3.342e-6;L1R=0.1364;L2R=0.0136;R1R=29.76;R2R=261.87;R3R=83.32;
     ###
     LgR=0.151;Rg1R=3.737;Rg2R=2160.633;
     Unom1R=345*sqrt(2/3);
     XcpuR=0.18;StR=603.73;UR2=213.4557;
     XcR=UR2^2/StR*XcpuR;LcR=XcR/w0;
     KtR=345/213.4557;
     ###
     RdcR=2.5;RdcI=2.5;LdcR=0.5968;LdcI=0.3968;LdcFI=0.2;Cdc=26e-6;
     CYR=0.01e-6;CDR=0.01e-6;RCY=5000;RCD=5000;
     CdcF=1e-6;
     ###
     C1I=15.04e-6;C2I=167.2e-6;C3I=15.04e-6;C4I=7.522e-6;L1I=0.0606;L2I=0.0061;R1I=13.23;R2I=116.38;R3I=37.03;
     ###
     SCR0=2.5;
     LgI=SCR0/SCR*(36.5e-3);Rg1I=SCR0/SCR*(0.7406);Rg2I=SCR0/SCR*(24.81);
     Unom1I=230*sqrt(2/3);
     XcpuI=0.18;StI=591.79;UI2=209.2288;
     XcI=UI2^2/StI*XcpuI;LcI=XcI/w0;
     KtI=230/209.2288;
     ###
     KpPLLR=10;KiPLLR=50;
    #  KpPLLI=10;KiPLLI=50;
     KpPLLI=80;KiPLLI=100;
     # KpIdc=1.0989;
     KiIdc=1/0.01092;
     Tif=0.0012;Gif=0.5;
     KpUdc=0.9225;KiUdc=1/0.01463;
     Tuf=0.02;Guf=0.002;
    ##
     COS_sub_2_3pi=COS*cos(2/3*pi)+SIN*sin(2/3*pi);
     COS_add_2_3pi=COS*cos(2/3*pi)-SIN*sin(2/3*pi);
     
     ER=Unom1R/345*382.8672;
     ERa=ER*COS;ERb=ER*COS_sub_2_3pi;ERc=ER*COS_add_2_3pi;
     EI=Unom1I/230*215.05;
     EIa=EI*COS;EIb=EI*COS_sub_2_3pi;EIc=EI*COS_add_2_3pi;
     ##! PLL Rec
     SIN_thetaPLLR=SIN*cos(thetaPLLR)+COS*sin(thetaPLLR);
     SIN_thetaPLLR_sub_2_3pi=SIN*cos(thetaPLLR-2/3*pi)+COS*sin(thetaPLLR-2/3*pi);
     SIN_thetaPLLR_add_2_3pi=SIN*cos(thetaPLLR+2/3*pi)+COS*sin(thetaPLLR+2/3*pi);
     uqPLLR=(1/Unom1R)*(-2/3)*(uC4Ra*SIN_thetaPLLR+uC4Rb*SIN_thetaPLLR_sub_2_3pi+uC4Rc*SIN_thetaPLLR_add_2_3pi);
     xpllR_=KiPLLR*uqPLLR;
     thetaPLLR_=KpPLLR*uqPLLR+xpllR;
     ##! PLL Inv
     SIN_thetaPLLI=SIN*cos(thetaPLLI)+COS*sin(thetaPLLI);
     SIN_thetaPLLI_sub_2_3pi=SIN*cos(thetaPLLI-2/3*pi)+COS*sin(thetaPLLI-2/3*pi);
     SIN_thetaPLLI_add_2_3pi=SIN*cos(thetaPLLI+2/3*pi)+COS*sin(thetaPLLI+2/3*pi);
     uqPLLI=(1/Unom1I)*(-2/3)*(uC4Ia*SIN_thetaPLLI+uC4Ib*SIN_thetaPLLI_sub_2_3pi+uC4Ic*SIN_thetaPLLI_add_2_3pi);
     xpllI_=KiPLLI*uqPLLI;
     thetaPLLI_=KpPLLI*uqPLLI+xpllI;
     ##! CC
     IdcOR=1;
     idcRF_=1/Tif*(Gif*iLdcR-idcRF);
     didc=IdcOR-idcRF;
     betaR=KpIdc*didc+xidcR;
     xidcR_=KiIdc*didc;
     AlphaOR=pi-betaR;
     ##! VC
     UdcOI=1;
     udcIF_=1/Tuf*(Guf*udcFI-udcIF);
     dudc=udcIF-UdcOI;
     betaI=KpUdc*dudc+xudcI;
     Smin=0.5*(1+tanh(AAu*(0.6-betaI)));
     Smax=0.5*(1+tanh(AAu*(betaI-1.5)));
     xudcI_=(KiUdc*dudc)*(1-Smax)*(1-Smin)-Smax*100*(xudcI-1.5)-Smin*100*(xudcI-0.6);
     AlphaOIC=pi-betaI;
     
    #  AlphaOI=(2.0)*(t<0.3)+(2.3)*(t>=0.3)*(t<0.6)+(2.45)*(t>=0.6)*(t<1.1)+(AlphaOIC)*(t>=1.1);
     AlphaOI=AlphaOIC;
     ##
 
     ## LCC Rec
     ###YY
     alphaR2=AlphaOR+1/3*pi;
     PhiY1R=thetaPLLR+pi/3;PhiY2R=thetaPLLR;PhiY3R=thetaPLLR-pi/3;PhiY4R=thetaPLLR-2*pi/3;PhiY5R=thetaPLLR-pi;PhiY6R=thetaPLLR-4*pi/3;
     COSalpha1_1YR=COS*cos(PhiY1R-AlphaOR/2)-SIN*sin(PhiY1R-AlphaOR/2);COSalpha2_1YR=COS*cos(PhiY1R-alphaR2/2)-SIN*sin(PhiY1R-alphaR2/2);
     COSalpha1_2YR=COS*cos(PhiY2R-AlphaOR/2)-SIN*sin(PhiY2R-AlphaOR/2);COSalpha2_2YR=COS*cos(PhiY2R-alphaR2/2)-SIN*sin(PhiY2R-alphaR2/2);
     COSalpha1_3YR=COS*cos(PhiY3R-AlphaOR/2)-SIN*sin(PhiY3R-AlphaOR/2);COSalpha2_3YR=COS*cos(PhiY3R-alphaR2/2)-SIN*sin(PhiY3R-alphaR2/2);
     COSalpha1_4YR=COS*cos(PhiY4R-AlphaOR/2)-SIN*sin(PhiY4R-AlphaOR/2);COSalpha2_4YR=COS*cos(PhiY4R-alphaR2/2)-SIN*sin(PhiY4R-alphaR2/2);
     COSalpha1_5YR=COS*cos(PhiY5R-AlphaOR/2)-SIN*sin(PhiY5R-AlphaOR/2);COSalpha2_5YR=COS*cos(PhiY5R-alphaR2/2)-SIN*sin(PhiY5R-alphaR2/2);
     COSalpha1_6YR=COS*cos(PhiY6R-AlphaOR/2)-SIN*sin(PhiY6R-AlphaOR/2);COSalpha2_6YR=COS*cos(PhiY6R-alphaR2/2)-SIN*sin(PhiY6R-alphaR2/2);
     SuY1R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_1YR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_1YR)));
     SuY2R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_2YR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_2YR)));
     SuY3R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_3YR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_3YR)));
     SuY4R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_4YR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_4YR)));
     SuY5R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_5YR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_5YR)));
     SuY6R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_6YR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_6YR)));
     SiY1R=0.5*(1+tanh(AAi*(iLcYRa-Ihold)));SiY3R=0.5*(1+tanh(AAi*(iLcYRb-Ihold)));SiY5R=0.5*(1+tanh(AAi*(iLcYRc-Ihold)));
     SiY4R=0.5*(1+tanh(AAi*(-iLcYRa-Ihold)));Si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i/3;PhiD4R=thetaPLLRD-2*pi/3;PhiD5R=thetaPLLRD-pi;PhiD6R=thetaPLLRD-4*pi/3;
     COSalpha1_1DR=COS*cos(PhiD1R-AlphaOR/2)-SIN*sin(PhiD1R-AlphaOR/2);COSalpha2_1DR=COS*cos(PhiD1R-alphaR2/2)-SIN*sin(PhiD1R-alphaR2/2);
     COSalpha1_2DR=COS*cos(PhiD2R-AlphaOR/2)-SIN*sin(PhiD2R-AlphaOR/2);COSalpha2_2DR=COS*cos(PhiD2R-alphaR2/2)-SIN*sin(PhiD2R-alphaR2/2);
     COSalpha1_3DR=COS*cos(PhiD3R-AlphaOR/2)-SIN*sin(PhiD3R-AlphaOR/2);COSalpha2_3DR=COS*cos(PhiD3R-alphaR2/2)-SIN*sin(PhiD3R-alphaR2/2);
     COSalpha1_4DR=COS*cos(PhiD4R-AlphaOR/2)-SIN*sin(PhiD4R-AlphaOR/2);COSalpha2_4DR=COS*cos(PhiD4R-alphaR2/2)-SIN*sin(PhiD4R-alphaR2/2);
     COSalpha1_5DR=COS*cos(PhiD5R-AlphaOR/2)-SIN*sin(PhiD5R-AlphaOR/2);COSalpha2_5DR=COS*cos(PhiD5R-alphaR2/2)-SIN*sin(PhiD5R-alphaR2/2);
     COSalpha1_6DR=COS*cos(PhiD6R-AlphaOR/2)-SIN*sin(PhiD6R-AlphaOR/2);COSalpha2_6DR=COS*cos(PhiD6R-alphaR2/2)-SIN*sin(PhiD6R-alphaR2/2);
     SuD1R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_1DR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_1DR)));
     SuD2R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_2DR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_2DR)));
     SuD3R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_3DR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_3DR)));
     SuD4R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_4DR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_4DR)));
     SuD5R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_5DR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_5DR)));
     SuD6R=0.5*(1+tanh(AAu*(cos(AlphaOR/2)-COSalpha1_6DR)))-0.5*(1+tanh(AAu*(cos(alphaR2/2)-COSalpha2_6DR)));
     SiD1R=0.5*(1+tanh(AAi*(iLcDRa-Ihold)));SiD3R=0.5*(1+tanh(AAi*(iLcDRb-Ihold)));SiD5R=0.5*(1+tanh(AAi*(iLcDRc-Ihold)));
     SiD4R=0.5*(1+tanh(AAi*(-iLcDRa-Ihold)));SiD6R=0.5*(1+tanh(AAi*(-iLcDRb-Ihold)));SiD2R=0.5*(1+tanh(AAi*(-iLcDRc-Ihold)));
     SD1R=SuD1R*SiD1R+(1-SuD1R*SiD1R)*(SuD1R+SiD1R);SD3R=SuD3R*SiD3R+(1-SuD3R*SiD3R)*(SuD3R+SiD3R);SD5R=SuD5R*SiD5R+(1-SuD5R*SiD5R)*(SuD5R+SiD5R);
     SD4R=SuD4R*SiD4R+(1-SuD4R*SiD4R)*(SuD4R+SiD4R);SD6R=SuD6R*SiD6R+(1-SuD6R*SiD6R)*(SuD6R+SiD6R);SD2R=SuD2R*SiD2R+(1-SuD2R*SiD2R)*(SuD2R+SiD2R);
     SDaR=SD1R-SD4R;SDbR=SD3R-SD6R;SDcR=SD5R-SD2R;SDa2R=SDaR^2;SDb2R=SDbR^2;SDc2R=SDcR^2;
     ###
     uRDa=(uC4Ra-uC4Rc)/KtR/sqrt(3);uRDb=(uC4Rb-uC4Ra)/KtR/sqrt(3);uRDc=(uC4Rc-uC4Rb)/KtR/sqrt(3);
     idcPDR=0.5*(SDaR*iLcDRa+SDbR*iLcDRb+SDcR*iLcDRc);
     iCDR=idcPDR-iLdcR;
     udcRD=uCDR+iCDR*RCD;
     iLcDRa_=-1/(2*LcR)*((-SDa2R)*uRDa+(SDa2R+SDb2R-1)*uRDb+(SDa2R+SDc2R-1)*uRDc)-1/(6*LcR)*(2*SDaR-SDbR-SDcR)*(udcRD);
     iLcDRb_=-1/(2*LcR)*((SDa2R+SDb2R-1)*uRDa+(-SDb2R)*uRDb+(SDb2R+SDc2R-1)*uRDc)-1/(6*LcR)*(2*SDbR-SDaR-SDcR)*(udcRD);
     iLcDRc_=-1/(2*LcR)*((SDa2R+SDc2R-1)*uRDa+(SDb2R+SDc2R-1)*uRDb+(-SDc2R)*uRDc)-1/(6*LcR)*(2*SDcR-SDaR-SDbR)*(udcRD);
     uCDR_=1/CDR*(iCDR);
 
 
 
 
     ## LCC Inv
     ###YY
     alphaI2=AlphaOI+1/3*pi;
     PhiY1I=thetaPLLI+pi/3;PhiY2I=thetaPLLI;PhiY3I=thetaPLLI-pi/3;PhiY4I=thetaPLLI-2*pi/3;PhiY5I=thetaPLLI-pi;PhiY6I=thetaPLLI-4*pi/3;
     COSalpha1_1YI=COS*cos(PhiY1I-AlphaOI/2)-SIN*sin(PhiY1I-AlphaOI/2);COSalpha2_1YI=COS*cos(PhiY1I-alphaI2/2)-SIN*sin(PhiY1I-alphaI2/2);
     COSalpha1_2YI=COS*cos(PhiY2I-AlphaOI/2)-SIN*sin(PhiY2I-AlphaOI/2);COSalpha2_2YI=COS*cos(PhiY2I-alphaI2/2)-SIN*sin(PhiY2I-alphaI2/2);
     COSalpha1_3YI=COS*cos(PhiY3I-AlphaOI/2)-SIN*sin(PhiY3I-AlphaOI/2);COSalpha2_3YI=COS*cos(PhiY3I-alphaI2/2)-SIN*sin(PhiY3I-alphaI2/2);
     COSalpha1_4YI=COS*cos(PhiY4I-AlphaOI/2)-SIN*sin(PhiY4I-AlphaOI/2);COSalpha2_4YI=COS*cos(PhiY4I-alphaI2/2)-SIN*sin(PhiY4I-alphaI2/2);
     COSalpha1_5YI=COS*cos(PhiY5I-AlphaOI/2)-SIN*sin(PhiY5I-AlphaOI/2);COSalpha2_5YI=COS*cos(PhiY5I-alphaI2/2)-SIN*sin(PhiY5I-alphaI2/2);
     COSalpha1_6YI=COS*cos(PhiY6I-AlphaOI/2)-SIN*sin(PhiY6I-AlphaOI/2);COSalpha2_6YI=COS*cos(PhiY6I-alphaI2/2)-SIN*sin(PhiY6I-alphaI2/2);
     SuY1I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_1YI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_1YI)));
     SuY2I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_2YI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_2YI)));
     SuY3I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_3YI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_3YI)));
     SuY4I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_4YI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_4YI)));
     SuY5I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_5YI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_5YI)));
     SuY6I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_6YI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_6YI)));
 
     SiY1I=0.5*(1+tanh(AAi*(iLcYIa-Ihold)));SiY3I=0.5*(1+tanh(AAi*(iLcYIb-Ihold)));SiY5I=0.5*(1+tanh(AAi*(iLcYIc-Ihold)));
     SiY4I=0.5*(1+tanh(AAi*(-iLcYIa-Ihold)));SiY6I=0.5*(1+tanh(AAi*(-iLcYIb-Ihold)));SiY2I=0.5*(1+tanh(AAi*(-iLcYIc-Ihold)));
     SY1I=SuY1I*SiY1I+(1-SuY1I*SiY1I)*(SuY1I+SiY1I);SY3I=SuY3I*SiY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Ib/KtI;uIYc=uC4Ic/KtI;
     idcPYI=0.5*(SYaI*iLcYIa+SYbI*iLcYIb+SYcI*iLcYIc);
     iCYI=idcPYI-iLdcFI;
     udcIY=uCYI+iCYI*RCY;
     iLcYIa_=-1/(2*LcI)*((-SYa2I)*uIYa+(SYa2I+SYb2I-1)*uIYb+(SYa2I+SYc2I-1)*uIYc)-1/(6*LcI)*(2*SYaI-SYbI-SYcI)*(udcIY);
     iLcYIb_=-1/(2*LcI)*((SYa2I+SYb2I-1)*uIYa+(-SYb2I)*uIYb+(SYb2I+SYc2I-1)*uIYc)-1/(6*LcI)*(2*SYbI-SYaI-SYcI)*(udcIY);
     iLcYIc_=-1/(2*LcI)*((SYa2I+SYc2I-1)*uIYa+(SYb2I+SYc2I-1)*uIYb+(-SYc2I)*uIYc)-1/(6*LcI)*(2*SYcI-SYaI-SYbI)*(udcIY);
     uCYI_=1/CYR*(iCYI);
     ###YD
     thetaPLLID=thetaPLLI-pi/6;
     PhiD1I=thetaPLLID+pi/3;PhiD2I=thetaPLLID;PhiD3I=thetaPLLID-pi/3;PhiD4I=thetaPLLID-2*pi/3;PhiD5I=thetaPLLID-pi;PhiD6I=thetaPLLID-4*pi/3;
     COSalpha1_1DI=COS*cos(PhiD1I-AlphaOI/2)-SIN*sin(PhiD1I-AlphaOI/2);COSalpha2_1DI=COS*cos(PhiD1I-alphaI2/2)-SIN*sin(PhiD1I-alphaI2/2);
     COSalpha1_2DI=COS*cos(PhiD2I-AlphaOI/2)-SIN*sin(PhiD2I-AlphaOI/2);COSalpha2_2DI=COS*cos(PhiD2I-alphaI2/2)-SIN*sin(PhiD2I-alphaI2/2);
     COSalpha1_3DI=COS*cos(PhiD3I-AlphaOI/2)-SIN*sin(PhiD3I-AlphaOI/2);COSalpha2_3DI=COS*cos(PhiD3I-alphaI2/2)-SIN*sin(PhiD3I-alphaI2/2);
     COSalpha1_4DI=COS*cos(PhiD4I-AlphaOI/2)-SIN*sin(PhiD4I-AlphaOI/2);COSalpha2_4DI=COS*cos(PhiD4I-alphaI2/2)-SIN*sin(PhiD4I-alphaI2/2);
     COSalpha1_5DI=COS*cos(PhiD5I-AlphaOI/2)-SIN*sin(PhiD5I-AlphaOI/2);COSalpha2_5DI=COS*cos(PhiD5I-alphaI2/2)-SIN*sin(PhiD5I-alphaI2/2);
     COSalpha1_6DI=COS*cos(PhiD6I-AlphaOI/2)-SIN*sin(PhiD6I-AlphaOI/2);COSalpha2_6DI=COS*cos(PhiD6I-alphaI2/2)-SIN*sin(PhiD6I-alphaI2/2);
     SuD1I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_1DI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_1DI)));
     SuD2I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_2DI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_2DI)));
     SuD3I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_3DI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_3DI)));
     SuD4I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_4DI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_4DI)));
     SuD5I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_5DI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_5DI)));
     SuD6I=0.5*(1+tanh(AAu*(cos(AlphaOI/2)-COSalpha1_6DI)))-0.5*(1+tanh(AAu*(cos(alphaI2/2)-COSalpha2_6DI)));
     SiD1I=0.5*(1+tanh(AAi*(iLcDIa-Ihold)));SiD3I=0.5*(1+tanh(AAi*(iLcDIb-Ihold)));SiD5I=0.5*(1+tanh(AAi*(iLcDIc-Ihold)));
     SiD4I=0.5*(1+tanh(AAi*(-iLcDIa-Ihold)));SiD6I=0.5*(1+tanh(AAi*(-iLcDIb-Ihold)));SiD2I=0.5*(1+tanh(AAi*(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I^2;
     ###
     uIDa=(uC4Ia-uC4Ic)/KtI/sqrt(3);uIDb=(uC4Ib-uC4Ia)/KtI/sqrt(3);uIDc=(uC4Ic-uC4Ib)/KtI/sqrt(3);
     idcPDI=0.5*(SDaI*iLcDIa+SDbI*iLcDIb+SDcI*iLcDIc);
     iCDI=idcPDI-iLdcFI;
     udcID=uCDI+iCDI*RCD;
     iLcDIa_=-1/(2*LcI)*((-SDa2I)*uIDa+(SDa2I+SDb2I-1)*uIDb+(SDa2I+SDc2I-1)*uIDc)-1/(6*LcI)*(2*SDaI-SDbI-SDcI)*(udcID);
     iLcDIb_=-1/(2*LcI)*((SDa2I+SDb2I-1)*uIDa+(-SDb2I)*uIDb+(SDb2I+SDc2I-1)*uIDc)-1/(6*LcI)*(2*SDbI-SDaI-SDcI)*(udcID);
     iLcDIc_=-1/(2*LcI)*((SDa2I+SDc2I-1)*uIDa+(SDb2I+SDc2I-1)*uIDb+(-SDc2I)*uIDc)-1/(6*LcI)*(2*SDcI-SDaI-SDbI)*(udcID);
     uCDI_=1/CDR*(iCDI);
     ## DC side ########################################################
     ##
     udcR=udcRY+udcRD;
     udcI=udcIY+udcID;
 
     iLdcR_=1/LdcR*(udcR-uCdc-RdcR*iLdcR);
     iLdcI_=1/LdcI*(uCdc-RdcI*iLdcI-udcFI);
     uCdc_=1/Cdc*(iLdcR-iLdcI);
     ##
     iLdcFI_=1/LdcFI*(udcFI+udcI);
     udcFI_=1/CdcF*(iLdcI-iLdcFI);
     ###################################################################
     ## Filter grid Rec
     iLgRa_=1/(LgR*(1+Rg1R/Rg2R))*(ERa-Rg1R*iLgRa-uC4Ra);iLgRb_=1/(LgR*(1+Rg1R/Rg2R))*(ERb-Rg1R*iLgRb-uC4Rb);iLgRc_=1/(LgR*(1+Rg1R/Rg2R))*(ERc-Rg1R*iLgRc-uC4Rc);
     iRg1Ra=LgR*iLgRa_/Rg2R+iLgRa;iRg1Rb=LgR*iLgRb_/Rg2R+iLgRb;iRg1Rc=LgR*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I*(uC4Ia-uC3Ia);iL2Ib_=1/L2I*(uC4Ib-uC3Ib);iL2Ic_=1/L2I*(uC4Ic-uC3Ic);
     uC3Ia_=1/C3I*iC3Ia;uC3Ib_=1/C3I*iC3Ib;uC3Ic_=1/C3I*iC3Ic;
     ###
     iLcIa=iLcYIa+(iLcDIa-iLcDIb)/sqrt(3);iLcIb=iLcYIb+(iLcDIb-iLcDIc)/sqrt(3);iLcIc=iLcYIc+(iLcDIc-iLcDIa)/sqrt(3);
     uC4Ia_=1/C4I*(iLg2Ia-iC1Ia-iC3Ia-iLcIa/KtI);uC4Ib_=1/C4I*(iLg2Ib-iC1Ib-iC3Ib-iLcIb/KtI);uC4Ic_=1/C4I*(iLg2Ic-iC1Ic-iC3Ic-iLcIc/KtI);
     ##
     
     dydt[1]=iLcYRa_/(Ibase2_rec);dydt[2]=iLcYRb_/(Ibase2_rec);dydt[3]=uCYR_/(Ubase_dc/2);
     dydt[4]=iLdcR_/(Ibase_dc);dydt[5]=iLdcI_/(Ibase_dc);dydt[6]=uCdc_/(Ubase_dc);
     dydt[7]=iLcDRa_/(Ibase2_rec);dydt[8]=iLcDRb_/(Ibase2_rec);dydt[9]=uCDR_/(Ubase_dc/2);
     dydt[10]=xpllR_;dydt[11]=thetaPLLR_;
     dydt[12]=idcRF_;dydt[13]=xidcR_;
     dydt[14]=uC1Ra_/(Ubase1_rec);dydt[15]=uC1Rb_/(Ubase1_rec);
     dydt[16]=uC2Ra_/(Ubase1_rec);dydt[17]=uC2Rb_/(Ubase1_rec);
     dydt[18]=uC3Ra_/(Ubase1_rec);dydt[19]=uC3Rb_/(Ubase1_rec);
     dydt[20]=uC4Ra_/(Ubase1_rec);dydt[21]=uC4Rb_/(Ubase1_rec);
     dydt[22]=iL1Ra_/(Ibase1_rec);dydt[23]=iL1Rb_/(Ibase1_rec);
     dydt[24]=iL2Ra_/(Ibase1_rec);dydt[25]=iL2Rb_/(Ibase1_rec);
     dydt[26]=iLgRa_/(Ibase1_rec);dydt[27]=iLgRb_/(Ibase1_rec);
 
     dydt[28]=iLcYIa_/(Ibase2_inv);dydt[29]=iLcYIb_/(Ibase2_inv);dydt[30]=uCYI_/(Ubase_dc/2);
     dydt[31]=iLcDIa_/(Ibase2_inv);dydt[32]=iLcDIb_/(Ibase2_inv);dydt[33]=uCDI_/(Ubase_dc/2);
     dydt[34]=xpllI_;dydt[35]=thetaPLLI_;
     dydt[36]=udcIF_;dydt[37]=xudcI_;
     dydt[38]=uC1Ia_/(Ubase1_inv);dydt[39]=uC1Ib_/(Ubase1_inv);
     dydt[40]=uC2Ia_/(Ubase1_inv);dydt[41]=uC2Ib_/(Ubase1_inv);
     dydt[42]=uC3Ia_/(Ubase1_inv);dydt[43]=uC3Ib_/(Ubase1_inv);
     dydt[44]=uC4Ia_/(Ubase1_inv);dydt[45]=uC4Ib_/(Ubase1_inv);
     dydt[46]=iL1Ia_/(Ibase1_inv);dydt[47]=iL1Ib_/(Ibase1_inv);
     dydt[48]=iL2Ia_/(Ibase1_inv);dydt[49]=iL2Ib_/(Ibase1_inv);
     dydt[50]=iLg1Ia_/(Ibase1_inv);dydt[51]=iLg1Ib_/(Ibase1_inv);
     dydt[52]=iLg2Ia_/(Ibase1_inv);dydt[53]=iLg2Ib_/(Ibase1_inv);
     dydt[54]=udcFI_/(Ubase_dc);dydt[55]=iLdcFI_/(Ibase_dc);
 
     dydt[56]=y56+w0*y57-y56*(y56^2+y57^2);
     dydt[57]=y57-w0*y56-y57*(y56^2+y57^2);
 
     dydt
 end

Snipaste_2024-07-05_21-33-02

@Sam-afk-del
Copy link
Author

Snipaste_2024-07-05_21-58-24

@rveltz
Copy link
Member

rveltz commented Jul 5, 2024

Hi,

Several remarks:

  • I dont have u0 to test
  • try passing nev to ContinuationPar
  • try using ls = DefaultLS() to start with
  • why dont you use collocation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants