脚本不能在SciLab 6.0.0中运行

时间:2017-10-24 17:43:13

标签: scilab

以下脚本在SciLab 5.5.2中运行良好。在6.0.0中,它在执行csim()函数时崩溃(第21行)。

对于此测试集x0 = [1 1.5 .25 .125];

错误读作;

 lsode--  caution... t (=r1) and h (=r2) are
     such that t + h = t at next step
      (h = step).  integration continues
      where r1 is :   0.0000000000000D+00   and r2 :   0.0000000000000D+00      
lsode--  at t (=r1) with step h (=r2), 
     corrector does not converge 
      with abs(h) = hmin   
      where r1 is :   0.0000000000000D+00   and r2 :   0.0000000000000D+00      
Repeated convergence failures (perhaps bad jacobian supplied or wrong choice of jacobian type or tolerances).
at line     6 of function optimbase_checkstatus  ( C:\Program Files\scilab-6.0.0\modules\optimization\macros\optimbase\optimbase_checkcostfun.sci line 121 )
at line    14 of function optimbase_checkcostfun ( C:\Program Files\scilab-6.0.0\modules\optimization\macros\optimbase\optimbase_checkcostfun.sci line 33 )
at line     7 of function neldermead_startup     ( C:\Program Files\scilab-6.0.0\modules\optimization\macros\neldermead\neldermead_search.sci line 951 )
at line    23 of function neldermead_search      ( C:\Program Files\scilab-6.0.0\modules\optimization\macros\neldermead\neldermead_search.sci line 65 )
at line   129 of executed file C:\Users\wensrl\Documents\SciLab\Reference Documentation\pidOptimizer.sce

optimbase_checkcostfun:无法使用“[f,index] = costf(x0,1)”评估成本函数:ode:lsode exit with state -5。

执行csim函数时会发生此错误。

我搜索了版本5.5.2和6.0.0之间的csim()函数的更改,但没有找到任何更改。我有什么解决方案吗?

函数[J,index] = costf(x0,index)

global J C oL cL itae OS Ms y u t wgts iteration cost

[lhs, rhs] = argn(0)
if rhs < 1 then
    error("x0 is required")
end

kc    = x0(1);
ti    = x0(2);
td    = x0(3);
alpha = x0(4);

// stdDeltaV PID formula
pidFormula = kc * (1 + (1/(ti * %s)) + ...
             ((td * %s)/(alpha * td * %s + 1)))

// pidFormula = pidCTRL(1, pidParam)

C = syslin('c', pidFormula)

oL = Pd * C
cL = oL /. 1

[y] = csim(u', t, cL)

for i = 1:totalTelements
    e(i) = abs(y(i) - u(i)) * dt
end

itae         = sum(e)
OS           = max(y) - 1
[Se, Re, Te] = sensi(Pd, C);
Ms           = norm (Se, %inf);

J = wgts(1) * itae  +  wgts(2) * OS  +  wgts(3) * Ms;

endfunction可写

0 个答案:

没有答案