Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

file paths

I am trying to make a .data file be tied to a custom supercomponent.

Seems the only places amesim looks for the file path is:

1) in the top level drive where the .ame file is stored

2) the folder of the .ame file.

 

Is this correct?

 

I want to share this supercomponent through a repository, but everyone file path is different and the component can not find the .data file.

21 REPLIES

Re: file paths

When referencing a data file, Amesim will only look for the path explicitly set in the parameter value:

  • if the parameter is: file.data or somehting like ./data/file.data it's implicit that it's a relative path and Amesim will look for it next to the ame file or in the referenced folder
  • if the parameter value is: c:\data\file.data it's interpreted as an absolute path

There are a few things you can do with text global parameters (text gp) which could help:

  • define a text gp root which is exposed in your supercomponent (hence can be modified by the users), for example root value could be c:\data\
  • define another text gp file which value is file.data, not necessarily exposed
  • you can concatenate text gp for example, file_path is another text gp and its value is ${root}${file}
  • finally there a couple of automatic text gp always available:
    • ${circuit_name} - the name of the currently opened model
    • ${full_circuit_name} - the currently opened model path

I hope this helps

Re: file paths

I've also seen some people using environment variables (system or user) to define such a root folder.
This environment variable could be permanent or temporarily defined when you launch Amesim using a bat file (template available in ...\Amesim\misc adding a SET ROOTFOLDER line).

Re: file paths

Thanks for the through reply.

 

Seems like the paths to data for a supercomponent is still not well thought out in AMESim.  (data iis tied to the .ame file, but not the library location)

 

It is very frustrating for engineers in my company to open a model from a central repository and for it to not just work without changing path locations to data files.

 

I am exploring using enviromental variables, but even with some automation in Python, it still takes action from the user before opening up the model to set everything up correctly.

 

Thanks for confirming that there are no good options for this.

Re: file paths

I agree, at this stage it's not very straight forward. It is an identified pain and will be addressed.
A suggestion is to be able to reference a ${this_library} token which will automatically point to your local library path (which is known by the category path list).
You may know that there are already such tokens as ${circuit_name} and ${full_circuit_name}.

Do you think this suggestion will answer your need?

Re: file paths

As long as ${this_library} would work with multiple libraries in the same .ame model that would work.

 

A suggestion I have given in the past is to have a parameter in the component that would embed the data in the component (like when you encrypt a Supercomponent).  95% of the time when I use a .data file, the data never changes.

 

Thanks!

Re: file paths

Hi @ryanprun

 

there is a variable name which is called ${library_node}.

It seems it can answer your needs.

 

In your customized supercomponent definition you can enter the path as:

${library_node}/data/file.data lib_node.png

Then when your simulation runs, it will always pick-up the file from the actual location of the library:

lib_node_2.png

 

Hope this helps !

Re: file paths

[ Edited ]

When I use the command

${library_node}/Data/J20C_Isothermal_Oil_Properties_15NOV13.data

 

I get:

 

'c:\program files (x86)\lms\lms imagine.lab\v1510\amesim\libhydr/Data/J20C_Isothermal_Oil_Properties_15NOV13.data'.

 

Even though my library storage directory is: E:/Shared_Hyd_Repo/Lib_Components/JD_Test

 

Where is ${library_node} looking for the library location?

 

Seems like it is looking at the component location and not the supercomponet/ submodel location.

 

Re: file paths

Hi,

 

is it a customized supercomponent created in LMS Amecustom or a generic one created in LMS Amesim?

In my case it was a customized one (from LMS Amecustom). It should at least work for them.

 

 

Re: file paths

Hi,

 

try using ${library_node} inside the global parameters of the supercomponent instead of using it directly in a parameter of the component level.

 

It should now return the path of the supercomponent library instead of the path of the component inside it.