線上影音

Home > ANSYS Simplorer教學  > Simplorer Links Modelica

 

本文始於2018.08,以R19.1示範如何在Twin Builder (Simplorer)內使用Modelica Library. 本文所介紹的功能,需要有Twin Builder license.

  1. What is Modelica?

  2. Simplorer Built-in Modelica

  3. Modelica Hands-on

  4. Modelica Free Resource

  5. Q&A

    5.1 為何在步驟2.2匯入某些MSL,Simplorer會出現錯誤訊息?

    5.2 為何執行2.2步驟時,有時檔案型態中找不到.mo可以匯入?

    5.3 為何執行2.3步驟時,顯示需要在Twin Builder環境下的訊息?

    5.4 同樣是匯入.mo,步驟2.2與2.3有何不同?分別適用於何種時機?

    5.5 對於不熟悉的modelica component,如何查詢其元件的參數定義與使用方式?

  6. Reference

  1. What is Modelica? 

Modelica® is a non-proprietary, object-oriented, equation based language to conveniently model complex physical systems containing, e.g., mechanical, electrical, electronic, hydraulic, thermal, control, electric power or process-oriented subcomponents. [1]

  1. Simplorer Built-in Modelica

2.1 After installing Simplorer, a few Modelica Libraries appear as below 

2.2 Import MSL (Modelica Stand Lib.) into Simplorer 

[Tools] \ [Project Tools] \ [Import Simplorer Models]

Open C:\Program Files\AnsysEM\AnsysEM19.1\Win64\common\Modelica\ThirdParty\MSL\Modelica\package.mo file

Select the modelica models you want to import, and it will take some time to compiler them.

For example, if you just select Electrical\PowerConverters\ACDC to import, after complier process, the import window showed as below

2.3 Import MSL (Modelica Stand Lib.) into Simplorer Modelica Editor 

 [Simplorer Circuit] \ [Add Model...]

or use OpenModelica (a free modelica tool, refer to section 4) to build-up a language based system model to emulate.

  1. Modelica Hands-on 

在Simplorer安裝路徑下,有三個Simplorer links Modelica的範例

C:\Program Files\AnsysEM\AnsysEM19.1\Win64\Examples\Simplorer\Applications\Modelica

Simplorer匯入Modelica (.mo)使用不難(就步驟2.2),關鍵是怎麼產生一個由Modelica所描述的系統模型,而這就需要步驟2.3的Simplorer Modelica Editor或OpenModelica tool。[2][3][4][5]

  1. Modelica Free Resource 

Download and install OpenModelica

Open example

Run Simulation

Plot Result (clutch1.tau, clutch3.tau)

  1. Q&A

5.1 為何在步驟2.2匯入某些MSL,Simplorer會出現錯誤訊息? 

Ans:以匯入Electrical\PowerConverters\ACDC所遇到的錯誤訊息為例

這些都是model內有一些annotation(...)留空的語法造成,這不是Simplorer不兼容此model, 也不是該modelica model有問題,而是此model有內容留待user define,你不能單獨直接使用。進一步理解這問題,讀者可以利用步驟2.3的方式,在Simplorer Modelica Editor的環境下查看Electrical\PowerConverters\ACDC\DiodeBridge2Plus此模型的屬性,就會看到許多需要填入數值的欄位。

也就是說大部分modelica model並無法"單獨直接"匯入Simplorer使用,必須先在Simplorer Modelica Editor或OpenModelica的 程式編輯環境下把model連接與設置完成,確保其為完整可執行的程序後,匯出成一個新的.mo,再由步驟2.2匯入Simplorer。

5.2 為何執行2.2步驟時,有時檔案型態中找不到.mo可以匯入? 

Ans:從[Tools] \ [Options] \ [General Options],把UI介面改成for Twin Builder即可。只有R19.x以後才需要這樣,R19.0沒這問題。

5.3 為何執行2.3步驟時,顯示需要在Twin Builder環境下的訊息? 

Ans:請從[Tools] \ [Options] \ [General Options],把UI介面改成for Twin Builder即可。 只有R19.x以後才需要這樣,R19.0沒這問題。

5.4 同樣是匯入.mo,步驟2.2與2.3有何不同?分別適用於何種時機? 

Ans:

步驟2.2用於匯入一個完整可運行的modelica module\block (.mo),讓該模塊在Simplorer中與其他模塊(ROM\VHDL-AMS\FMI...)一起進行模擬

步驟2.3用於匯入任意modelica model (不論是基礎元件或完整系統),你可以在Simplorer Modelica Editor進行編輯\組合,然後匯出成一新的.mo。

5.5 對於不熟悉的modelica component,如何查詢其元件的參數定義與使用方式? 

Ans:在Twin Builder (Simplorer Modelica Editor 步驟2.3)內,可以直接按右鍵[Document]查詢該原件的使用說明,按右鍵[Modelica Text]查詢其原始碼

在OpenModelica內,可以直接按右鍵[View Document]查詢該原件的使用說明,按右鍵[View Text]查詢其原始碼

  1. Reference 

[1] https://www.modelica.org/

[2] OpenModelica course

[3] OpenModelica user guide

[4] OpenModelica training video1

[5] OpenModelica training video2