簡體   English   中英

Modelica 中的計算參數

[英]Computed parameter in Modelica

我有一個模型,其中一個參數應該通過求解非線性方程來找到。 是否有可能在 Modelica 中實現一個這樣的案例? 例如:

parameter Real Rs

應該通過求解方程找到:

(VmaxP*(Isc+I0_diode-2*ImaxP)-ImaxP*I0_diode*Rs)/(VmaxP-Rs*ImaxP)+I0_diode*exp((VmaxP+Rs*ImaxP)/(a*Ns*Vth_diode))*((Rs*(ImaxP-Isc)+VmaxP-a*Ns*Vth_diode)/(a*Ns*Vth_diode))=0;

在上述非線性方程中,只有Rs是未知的。

當使用fixed=false聲明參數時,可以在初始方程部分計算參數。 只需將您的非線性方程放入本節,如果所有其他變量都已知,則將計算Rs

model FixedFalse

  parameter Real Rs(fixed=false);

  // dummy values to let the model simulate
  Real VmaxP=1; Real Isc=1; Real I0_diode=1;
  Real ImaxP=1; Real a = 1; Real Ns = 1; Real Vth_diode = 1;

initial equation 

  (VmaxP*(Isc+I0_diode-2*ImaxP)-ImaxP*I0_diode*Rs)/(VmaxP-Rs*ImaxP)+I0_diode*exp((VmaxP+Rs*ImaxP)/(a*Ns*Vth_diode))*((Rs*(ImaxP-Isc)+VmaxP-a*Ns*Vth_diode)/(a*Ns*Vth_diode))=0;

end FixedFalse;

為防止此參數顯示在參數對話框中,您可以保護它並添加一個非最終參數,例如用於繪圖:

  ...

  final parameter Real Rs = _Rs;

protected 
  parameter Real _Rs(fixed=false);

initial equation 
  // Now use _Rs here
  ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM