NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Curricular Models/NIELS

(back to the library)

Current in a Wire HubNet

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This model is an extension of the Current in a Wire model that adds two elements: temperature and HubNet interactivity. Just like Current in a Wire, this model visualizes the flow of electrons, caused by a voltage difference between two ends of a wire. The electrons are constantly accelerated by the applied voltage meaning they acquire some kinetic energy as they move towards the positive end of the wire. However, as they flow, the electrons collide with the nuclei of the material the wire is made of, in other words, they encounter resistance. In these collisions, some of the kinetic energy of the electrons is transformed into heat energy which is absorbed by the wire.

Because this is a HubNet model, a number of "clients" or students connect to this model via the HubNet Client Launcher. Every client that is connected gets to "control" a slice of the wire by placing and removing the nuclei that electrons collide with in their slice. Through a series of activities, students both interact and experiment with the idea that many macro-level phenomena like current and resistance are emergent–that they arise due to simple interactions between many micro-level objects like atoms and electrons.


The wire in this model (the patches which aren't black) is composed of atoms, which in turn are made of negatively charged electrons and positively charged nuclei. According to the Bohr model of the atom, these electrons revolve in concentric shells around the nucleus. However, in each atom, the electrons that are farthest away from the nucleus (i.e., the electrons that are in the outermost shell of each atom) behave as if they are free from the nuclear attraction. Here we represent electrons as tiny orange-colored circles.

Voltage in the wire gives rise to a constant electric field throughout the wire, imparting a steady drift to the electrons toward the positive side of the wire or the cathode. In addition to this drift, the electrons also collide with the atomic nuclei that make up the wire, giving rise to electrical resistance. The nuclei are the blue circles shown in the wire that in this model causes the electrons to go around them.

When an electron collides with a nuclei, its kinetic energy is transformed into heat which is absorbed by the wire. We visualize the temperature of the wire by coloring the patches that represent the wire by how warm they are. The warmer the patch, the closer to white its color will be. The cooler the patch, the closer to a dark-grey it will be.

The wire is divided into many "slices" so that each HubNet Client can monitor and control a single slice of the wire. Within each slice, students can click on nuclei to remove them or create a new nuclei on some other patch. In this manner, the students can control the location of the nuclei in their slice and see what the relationship is between that structure, collisions, and the temperature of their slice.


When the model opens, the teacher or activity leader needs to first select the number of students that will connect by using the NUM-STUDENTS slider. They also need to select how many nuclei will be present in each slice using the NUCLEI-PER-SLICE slider. Once those two options are selected, hit the SETUP button.

The COMPLETE RESET button should only be used as a last resort because it will disconnect all students who are currently connected.

Then ask however many students you have selected to join through the HubNet Client application. If the model is not listed in the bottom of the login window, make sure to provide students with the correct IP address and port number for your model. After all students have joined, the teacher starts the model by clicking the GO button.

In addition to the NUM-STUDENTS and NUCLEI-PER-SLICE sliders, there are several other interface elements the teacher or activity leader can control in order to change the behavior of the model:

  • The VOLTAGE slider controls the voltage or the electric potential difference between the cathode and anode of the wire.
  • The DIFFUSION-FACTOR slider controls how much heat flows from one wire patch to its neighbors
  • The SHARE-TEMP-ACROSS-SLICES? switch controls whether or not heat can diffuse from one wire slice to another
  • The RESET ALL TEMPERATURES button, when clicked, sets the temperature of all patches in the wire back to their original values
  • The WATCH AN ELECTRON button, when clicked, causes the model to follow a single electron and visualize its path as it flows through the wire
  • The STOP WATCHING AND ERASE button, when clicked, causes the model to cease following an electron and also erases any paths left on the view

The teacher or activity leader can also control two different aspects of the HubNet part of the model:

  • The SHOW-TEMP? switch, controls whether or not the temperatures of the wire slices and the average temperature of the wire are shown (both in this model and the client interfaces)
  • The IDENTIFY-STUDENTS? switch, if on, labels all the slices with the user-name of the connected HubNet client who is controlling that slice (otherwise, the slices are just identified by an ID number).

Finally, there are a number of different monitors and plots:

  • The TIMER monitor shows how long the simulation has been running in "model time"
  • The HIGHEST SLICE TEMPERATURE monitor shows the current temperature of the hottest wire slice
  • The LEADER monitor shows which HubNet Client's slice has the current highest temperature (if a slice that doesn't have a client connected is hottest, it will just display "Computer"
  • The AVG. TEMP OVER ALL SLICES monitor displays the average temperature of the entire wire
  • The ELECTRONS ARRIVED AT CATHODE monitor displays the number of electrons that have flowed past the cathode of the wire
  • The TEMPERATURE IN EACH SLICE plot displays a histogram where each bar's height represents the current temperature in that slice
  • The AVERAGE TEMPERATURE plot displays the average temperature since the beginning of the simulation
  • The CURRENT VS. TIME plot displays the electrical current that has been measured from the wire since the beginning of the simulation

Client Interface Elements

The Client Interface has a few different features that give HubNet Clients a few different options for interaction:

  • Each Client's View is limited to just their slice of the wire
  • The SLICE monitor shows the slice id that the client has been assigned so that they know which slice in the wire they are controlling
  • The AVG TEMP monitor shows the current temperature of the slice the client is controlling
  • The LABEL-AN-ELECTRON button picks an electron in the students slice and labels it with its speed so that a student can investigate how the collisions affect a single electron's speed as it travels through the wire
  • The nuclei that are located in the student's slice will be colored according to the color of the histogram bar that student's average temperature is displayed in instead of the default blue color
  • To move nuclei around, student simply click on one of the nuclei in their slice (it will be highlighted in yellow to indicate it has been selected) and then click on a patch in their slice they would like to move it to


What happens to the movement of the electrons as VOLTAGE changes?

Notice the change of speed and movement of electrons as they collide with nuclei.

Notice that there's a relationship between the speed of the electrons as they collide and the heat the patches near this collision absorb. Watch the collisions and see if you can figure out what the relationship is. Once you have a guess, switch over to the Code Tab and see if you can find the code where this heat energy is produced and absorbed.

Are there certain formations of nuclei that seem to cause collisions that cause more heating than others?

How does increasing the DIFFUSION-FACTOR affect the spread of temperature across the wire?


This model was designed for students (clients) to play three different games:

Game 1

The goal in this game is for students to maximize the temperature in their slice of the wire. For this game, the teacher should set the SHARE-HEAT-ACROSS-SLICES? switch to the OFF position.

Once everything is setup, allow students to join and ask them to try out different strategies for maximizing the temperature in their slice. Also ask them to write down what their strategy is once they settle on one.

Sample Strategies and Reasoning

  1. Far-end arrangement
    • "Maybe more travel time for electrons will result in more heat"
  2. Clustering arrangement
    • "More collisions will result in more heat"

Game 2

Game 2 is similar to Game 1, the only difference being that the SHARE-HEAT-ACROSS-SLICES? switch should be in the ON position. The teacher should also remind the students what this changes about the model.

Again, ask students to come up with a good strategy to maximize temperature and write it down. If their strategy changed from Game 1, ask them why they thought they needed to change strategies.

Sample Strategies and Reasoning

  1. Far-end arrangement
    • "Maybe more travel time for electrons will result in more heat"
  2. Arrangement is responsive to the right-adjacent slice (move nuclei inward from the left edge)
    • "Temperature gets up faster if it does not spill into the next slice"

Game 3

Game 3 is the same as Game 2, except for in this game, the Teacher should allow all the students to see the main model.

Sample Strategies and Reasoning

  1. Hybrid strategy: Far-end + Cluster
    • "More travel time for electrons will result in more heat"
  2. Arrangement is responsive to the right-adjacent slice
    • "More collisions will result in more heat"

After the Games

After students complete the three games, conduct a group discussion in which students discuss their strategies for maximizing temperature in their slice for Games 1, 2 and 3.

Following this group discussion, review the following with the students: * Mechanism of resistance * Relationship between collisions, heat, and light * Flow of electrons in a wire.


Currently the model randomly places nuclei within each slice of the wire. In real wires, the nuclei are much more structured. Try writing a procedure that places the nuclei in specific formations that represent a real world material.

Right now, students can only ever see their slice of the wire. See if you can add an option in the Client Interface to "peek" at the whole wire.


This model uses the hubnet-send-follow primitive to give students a local view of a part of the system.


Checkout the other NIELS curricular models, including:

  • Current in a Wire
  • Electron Sink
  • Electrostatics
  • Parallel Circuit
  • Series Circuit


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

Please cite the HubNet software as:

To cite the NIELS curriculum as a whole, please use:

  • Sengupta, P. and Wilensky, U. (2008). NetLogo NIELS curriculum. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.


Copyright 2008 Pratim Sengupta and Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

To use this model for academic or commercial research, please contact Pratim Sengupta at <> or Uri Wilensky at <> for a mutual agreement prior to usage.

(back to the NetLogo Models Library)