Skip to main content

8.6) PV Installation Idea Debug


If before we implement the final decision to build PV, we like to check the procedure we just implemented. If you run the model now, you will not see a big difference to before in the View. Therefore, we are using a new technique for testing to code which is outprint statements using the primitive show. In the determine-idea-to-install-PV procedure write directly after set PV-building-decision true within the brackets:

show PV-building-decision

If you run the model now you will see a line printed in the command centre stating the turtle number and the value of the variable you programmed to show (PV-building-decision), which should be always true if the procedure is working. This is an extremely helpful thing to test your code and controll if NetLogo actually enters a certain routine or not. If you are not using it anymore, you can just “out comment” it by setting a semicolon in front of it.

We like the agents to think about PV, or not, every year from new. To ensure that we reset PV-building-decision parameter at the beginning of the go procedure by asking all agents which had a thought about PV last year to reset their mind.

In the go procedure after the stop command insert the following code:

ask turtles with [PV-building-decision] [set PV-building-decision false]