![]() | ![]() | ||
| Introduction | Your first interface | Building a model | Advanced features | Resources | |||
2.2 Accessing variables and objects | ![]() ![]() | ||
|
In this step you will take a closer look at the interface you created in step 1, and find out how to add variables from the model onto the user interface so that they can be viewed and manipulated. The model you're working with is Ohm's Law. This model describes the linear relationship between voltage, current and resistance in an electrical circuit. This model has two input variables:
and one output variable:
R, V, and I are related using the equation: Current (I) = Voltage (V) / Resistance (R)
![]() You can access these three variables from the property tree. If you right-click on any variable in the tree, a menu containing a choice of appropriate visualisation objects will be displayed. The types of object available will depend on whether the variable is defined as an input or output variable, and the type of variable it is (e.g. textual, numeric). ![]() When you select a type of object and move your mouse over the interface, you will see a crosshair cursor. Clicking again will place your chosen object on the interface.
You can now run your simulation and see how the objects interact with each other. Select the Edit menu and the Edit interface option. Notice that if you go back to the menu the tick beside that option will have disappeared, and the text '(Edit mode)' will have disappeared from the interface title bar - this tells you that the simulation is in Run mode. (Follow the same procedure again to toggle between Run and Edit modes.) Your interface will look something like this (not very beautiful, but it works!): ![]() Now would be a good time to save your interface, go to the File menu and select Save, which will bring up the Save dialog. Interface files are saved with the extension You can now customise the objects on your interface to tailor their looks and behaviours. This is covered in the next step. | |||
![]() | ![]() ![]() | ||