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:

  • R, the resistance of the circuit
  • V, the input voltage to the circuit

and one output variable:

  • I, the current in the circuit

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.


Add a spin button to the interface to display voltage, an input slider to display resistance and two different objects to display the current - an output digital and an analogue meter.


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 .jsm and are saved by default in the setups directory of the eSim Builder installation folder. You can save your interface here, or elsewhere if you chose, but it is always a good idea to store all your interfaces in sensibly named folders in the same place, keeping interfaces for the same model together - you won't regret it when you need to find an interface several months later! It is important to save regularly when you are building an interface so that you can back-track at any time with minimum inconvenience.

You can now customise the objects on your interface to tailor their looks and behaviours. This is covered in the next step.