Chemical Reactions Model -Needs Debugging

This is a Model in Chemistry of the Chemical Reaction:
Silver Nitrate solution and Copper rod:
2 AgNO3 (aq) + Cu (s) ---> Cu(NO3)2 (aq) + 2 Ag (s)

Your challenge is to fix each bug in the code. Don't forget to REMIX your model and hit Run Code, setup, and forever before testing your solution for each step.

1. I am getting an "empty socket" error.

2. When setup is pushed, 1000 water agents are supposed to appear. But nothing happens.

3. When a red copper agent (cube) collides with a silver nitrate agent, it changes color to gray. When a gray copper agent collides with a silver nitrate agent, the gray copper SHOULD be deleted. That is not happening. Instead the gray copper agents seem to stay on the rod as gray cubes (squares in 2D).

4. The copper nitrate (white, light blue and dark blue spheres) are supposed to be moving around in a wiggle walk, but they seem stuck where the red copper used to be. Can you fix that?

5. There are no Silver agents when setup is pushed, so why isn't the databox "# of Silver atoms deposited" displaying zero when Setup button is pushed"?

This is the Base Model in Chemistry of Silver Nitrate and Copper.
Module 4 Lesson 4 starter.
2 AgNO3 (aq) + Cu (s) ---> Cu(NO3)2 (aq) + 2 Ag (s)

Assumptions in this model:
1- Each agent represent one atom or ion or ionic compound.
2- Each agent of water represents 1 molecule of water.
3- Every gray copper represent 1/2 oxidation process.

When copper atom reacts with a silver ion, it turns gray as an indication of a change in oxidation state from 0 to +1. Once another silver ion reacts with copper of oxidation state +1 ending with oxidation state +2, that Cu(II) ion dissociates into solution.
Copper Nitrate then is flowing into solution forms a complex with three water molecules turning the solution blue.

The count of copper within 200 steps counts the red copper atom and the gray copper (+1) ions. The Cu+2 ions are not counted there because they are actually a separate breed in this model. That make sense because Cu+2 is a product of the reaction, while Cu+1 is considered a transition state of the copper atom agent.

Note: The databox counting #copper atoms can be:

count red copper + (count gray copper/2) or
count all the copper agents, red and gray - (count gray copper/2)

When silver nitrates runs out before the copper atoms, then we might have two (or multiples of two) gray copper agents, which really should correspond to one Cu atom that didn't finish undergoing a full oxidation to Cu+2. so we have to divide the gray copper agent number by half to get a true number for copper atoms.

Another way to explain it:
The reaction:
2 AgNO3 (aq) + Cu (s) ---> Cu(NO3)2 (aq) + 2 Ag (s)

can be written as:
AgNO3 (aq) + 1/2 Cu (s) ---> 1/2 Cu(NO3)2 (aq) + Ag (s)

so this 1/2 ratio is why we divide the count of gray copper by half.
1/2 Cu is represented by one gray copper, which means 2 gray copper agents represent 1 Cu atom.
so to know how many copper atoms are left when all we have are gray copper agents, we take the gray copper count and divide by 2.

Technical note: I set the slider on Silver Nitrate on purpose to jump in increments of 2 so that we do not end up with half an atom of copper left.

  • 0 (Current Version) View Project History
Engine speed5