2013-08-23 37 views
2

this question中,我問過如何在啓動時將自定義軟件包添加到MODELICAPATH中,但答案中有一些含糊不清的地方。基於問題的答案,我可以使用Dymola/Modelica中的openModelFile和openModel命令有什麼區別?

openModel("path\to\file.mo") 

openModelFile("Fully.Qualified.Model.Name") 

我想知道這些命令的區別,如果在所有,以及何時使用一個或另一個。

編輯:如果您回答請在Modelica文檔中提供源代碼。我不知道如何瀏覽文檔以找到這些命令,所以這可能是一個很大的障礙。

+0

這些命令是Dymola特定的,所以應該編輯這個問題來反映(並且肯定沒有openmodelica標籤)。 –

回答

3

乍得,

對於有關「內置」的Dymola的命令,請注意,您可以通過使用document(...)功能得到一些基本的文檔有疑問(顯然,help太行人和elucidate是太自命不凡了?)。該命令可以從Dymola的「Simulation」選項卡底部的命令行調用。它將一個函數名字符串作爲參數。因此,要回答你的問題:

document("openModel"); 

    function openModel "open a Modelica-file" 
    input String path "File-path to open"; 
    input Boolean mustRead := true "If false we can skip reading the file"; 
    output Boolean result "true if successful"; 

    "Opens a Modelica-file and pops up a window with the model in it" 
    end openModel; 

document("openModelFile"); 

    function openModelFile "open a Modelica-model from a file" 
    input String model "Model to open"; 
    input String path := "" "File-path to open (can be the empty string)"; 
    input String version := "" "Version to open (can be the empty string)"; 
    output Boolean result "true if successful"; 

    "Opens a Modelica-file and pops up a window with the given model in it" 
    end openModelFile; 

可悲的是,我不認爲文檔相當這裏捕獲的差異。事實上,如果你仔細想想,我會爭辯說這些名字真的很落後。 openModel文件作爲參數並打開包含在該文件中的定義(通常是package,但不一定)。另一方面,openModelFile需要模型名稱作爲參數,並在模型瀏覽器中打開該模型(搜索MODELICAPATH,如有必要,查找並打開模型)。

我希望有幫助。

+1

完美!你剛剛教我如何釣魚。 – Chad

+0

...除了給我我的第一條魚。 – Chad

+0

雖然'闡明()'不(但)?在Dymola中做任何事情,'help()'是獲得額外幫助的工作命令。另請參閱此答案:http://stackoverflow.com/a/17399473 – matth

相關問題