Highlighted

[Python] Copy & Paste Parameter from one Submodel to another

Genius
Genius

Hello,

I am still working on my SC and on my app which automatically chooses the right submodel (SC) depending on the parameter.

Now I have a problem: each  time the app detects the necessity to change the submodel, it reset all the parameter which already have been set, and set the default parameter from the submodel.

I quickly checked the documentation, and it seems not to have an utility to copy and paste parameter from one submodel to another.

Am I right?

Regards

Maxime

6 REPLIES 6

Re: [Python] Copy & Paste Parameter from one Submodel to another

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Maxime,

I'm not sure, but I suppose you are using the Embedded API.

The AMEChangeSubmodel function has an argument to keep the values of parameters when they have the same title. It's the copy_common_parameters flag below:

2018-05-30 08_39_04-Help - [Embedded API].png

Re: [Python] Copy & Paste Parameter from one Submodel to another

Siemens Phenom Siemens Phenom
Siemens Phenom
Actually, for supercomponents, this flag will only keep the parameters of the exposed parameters (visible at the SC level).
Internal parameters should indeed be reset to default values when you change the SC submodel.

Re: [Python] Copy & Paste Parameter from one Submodel to another

Genius
Genius
Hello @Emmanuel_D,
Indeed it doesn't work if the parameters aren't exposed.
So I will have to modify my code
Thanks anyway

Re: [Python] Copy & Paste Parameter from one Submodel to another

Genius
Genius
Hello,
So I am still stucked with this issue.
I wanted to set all my parameters after having changed the submodel, but AMESim remains in submodel mode.
I wanted to enforce AMESim to switch on parameter mode and then set all my parameters.
But I don't know how to get in parameter mode (API)

I have a piece of code with:
circuit = _get_circuit(None)
mode=AMEGetMode()
_change_mode(circuit,mode)

But no chance to find any help on AMEGetMode() etc....
Why those functions aren't showed in the help?

Maxime

Re: [Python] Copy & Paste Parameter from one Submodel to another

Genius
Genius
ok,
I really had to digg
Smiley Wink
_change_mode(circuit, 'parameter_mode')

Re: [Python] Copy & Paste Parameter from one Submodel to another

Siemens Genius Siemens Genius
Siemens Genius

Dear @mAx,

 

Indeed in rev15 this function was "private". That is why the name starts with an underscore "_". These internal functions are not documented and might change from one version to another.

Starting in revision 16 the public function AMEChangeMode has been created.

 

But I'm glad you managed to find a solution to your problem!

 

Br,

ElecKid.