Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Text / string variables operations for input parameters

Experimenter
Experimenter

Hello all,

 

I'm an experience user on AMESim but I keep failing to find a simple solution to my problem.

 

I developed a complex simulation tool on AMESim (Rev 13).

User have to define one input :

  • Either a (big) text file
  • Either parameter to use a ideal law

 

Thing is, in our simulation, the text file slows the simulation. So I'd like to bypass this parameter when we use ideal law.

 

My problem: Impossible to build the good text parameter. I've tried 2 ways:

  1. I tried if condition (that I failed to produce with text parameters) : (param>0)*(heavyFile.data)&(param<0)*(fakeFile.data)
  2. I could use dirty GP name and survive with something like this : ${${param}}
    with test = heavyFile.data; fake = fakeFile.data; param = test OR fake (user input)

 

None of this solution works.

 

Spoiler alert:

Spoiler
To be honest, I succeeded to bypass limitations, asking for user to enter: GP param = ${test}. and then to call ${param} in my component. My problem is, I actually have 2 files: heavyFile.data and heavyFile_max.data so it gets messy. Then I have to ask user to enter ${test} or ${fake} for 2 GP. Or I could assume it is always in the same directory and with the same name to just have "${param}.data" and "${param}_max.data". But I just hope anyone can show me a better solution.

 

If anyone can help that would be great!

Thanks!

 

Maxime

1 REPLY 1

Re: Text / string variables operations for input parameters

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hello MaximeP,

 

The text parameters are sent "as is" to the submodels. Therefore, a logical expression will not be evaluated by Amesim GUI. Evaluation of expressions is performed only for real and integer parameters.

 

I suggest you add an enumeration parameter to your submodel indicating what type of input the user is setting: either a text file, or an expression. Depending on this enumeration, the submodel code will simply ignore the text file and try to interpret the expression.

 

Best wishes,