The app designer is an Simcenter Amesim software pre and post-processing IDE (Integrated Development Environment) that can be used to create user interfaces (which are also called "app") for specific needs.
With the app designer it is easy to create dock windows in Simcenter Amesim for customized parametrization and post processing of results.
The app designer is designed to respond to a wide variety of needs ranging from simple to complex pre and post processing graphical user interfaces linked either to models or components.
In this example we will create and modify a parametrization app to change the value of a parameter with a slider. We will edit the Python code in this example.
2. Create a simple app:
We recommend to open a simple Simcenter Amesim demo model, SimpleMassSpring.ame, which is available through help > get Simcenter Amesim demo.
In this model, we change the input from a Sinus to constant value. The model in Simcenter Amesim is a simple mass spring model with an external force input.
Step 2: Switch to parameter mode (F11) and create an app
Click the app designer icon in the analysis toolbar.
The app designer - quick start dialog box opens and select dialog from the generic templates list and then click create.
A new app is created for the model, and the integrated development environment (IDE) is opened:
In this step, we will add the elements we require in the app, mainly the slider and the real editor. The slider will help us to modify the input force value and the real editor will display the value of the parameter.
We select the real editor widget and drag it into the form window:
We add now a slider element onto the form Window:
In addition to the elements, we can add labels to describe the slider
We have completed the design of our app and we can now associate the Simcenter Amesim parameter values with the widgets.
Let's start with the association of the input force parameter from Simcenter Amesim the real editor.
In the app designer, select the associations tab.
Click the button to create a new association for the widget. Double-click in the first column to enable the widget list, and then select the real editor from the list.
Select the constant component in Simcenter Amesim, and drag the constant value parameter to the data link field.
Step 3: Associating the slider to the parameter value
To link the slider with the parameter value we need to change the python code of this example.
In the app designer we switch to the maiform.py to get access to the python code. We see a predefined structure of code and the lines, where we can add additional code.
In the next step we add initialization declarations for the slider in the extra initialization part of the code. Please refer to the Simcenter Amesim Python API for further details about the commands.
#>>>>>>> Extra initialization declarations here paramProviderSlider = appObject.paramProvider() self.paramLink = paramProviderSlider.getParamLink('k@constant')
self.paramLink.valueChanged.connect(self.valueChangedInAmesim) #<<<<<<< End of initialization
Looking into the code you see two new methods, self.mySliderMoved and self.valueChangedInAmesim, which need to be defined. The definition will be implemented in the additional methods declaratins part.
#>>>>>>> Additional methods declarations here def mySliderMoved(self, newValue):
self.paramLink.setValue(str(newValue)) def valueChangedInAmesim(self, newValue):
self.horizontalSlider.blockSignals(False) #<<<<<<< End of additional methods declarations
The final Python code looks like:
Step 4: Check the Simcenter Amesim app
In the app designer we can test the app by clicking in the tab on the button. To use the new app please close the app designer and go to Simcenter Amesim. Now you should be able to see, that the new app has been added to model. By clicking on the app designer button the app will be launched automatically and you can change the value of the constant parameter either by using the slider or typing the value in the app.
The app can be downloaded and imported into your Simcenter Amesim model.