Organizing Modelica code...

2 posts / 0 new
Last post
janpeter
Offline
Joined: 2010-09-11
Organizing Modelica code...

Hi

 

So far I have had my library of Modelica models in a single file and the content enclosed by package PROCESS_LIB….. end PROCESS_LIB; 

 

Part of of the code is now within a sub-package called package CUSTOMER_LIB…. end CUSTOMER_LIB; 

 

The python-script to administrate this use the following code to compile:

model_name = ‘PROCESS_LIB.CUSTOMER.Batch’

mobile = “PROCESS_LIB_v1’

fmu_model = compile_fmu(model_name,mofile)

 

(And here Batch is customer model that combines different sub-models to run the process in batch mode).

 

This works as expected.

 

Now I would like split this file into two parts.

One general part for PROCESS_LIB and one CUSTOMER_LIB part.

 

How should this be done?

What should be added in the code?

 

I have read about Modelica concepts like MODELICAPATH, WITHIN, IMPORT etc, but I find it difficult to make it work and also wonder if here is some special limitations around the compile_fmu command.

 

I also read in the JModelica manual section 4.2.3 and try to make compile_fmu to search in a folder for a model instead of giving a file for it. Did not work.

 

I also looked at earlier thread http://www.jmodelica.org/5104 and found that my MODELICAPATH did not exist at all. Still I can compile MSL model as described in section 4.2.3. Something wrong in my installation?

 

Would appreciate some input.

 

Jan Peter

 

PS I run JModelica ver 2.0 in Windows 10 as virtual machine on a Mac.

janpeter
Offline
Joined: 2010-09-11
Hi, I have got some better

Hi,

I have got some better insight into structuring Modelica code in the post "Modelica in Action: How to structure models in packges" by Marco Bonvini https://marcobonvini.com/posts/. But there is more to learn here.

I also found it useful to address other directoreis not in the MODELICAPATH explaing here http://www.jmodelica.org/4320

Still I would like to be able to update my MODELICAPATH. As said above the post http://www.jmodelica.org/5104 does not seem relevant for JModelica ver 2.0. 

In Windows 10 (latest update) it is somewhat involved to set the MODELICAPATH and I have looked around "Envirnoment Variables" but cannot find the current MODELICAPATH, see enclosed screenshot. Where is it? and how do I modify it?

Would appreicate some help

Jan Peter

AttachmentSize
Screen Shot 2017-10-10 at 11.36.48.png 41.23 KB
Login or register to post comments