Any of those help What you need to store is add another attribute for each customer that stores the tick at which it failed or when it is fixed. I have taken the latter approach and called that attribute end-waiting-time (NOT tested).
if random 100 > 95
[set device-working? false
set real-waiting-time real-waiting-time + waiting-time
set end-waiting-time ticks + waiting-time] ; this is the new line
if device-working? = false tick and ticks = end-waiting-time
[ set device-working? true ]
wish of those help if energy < 20000 [ask adults [go-home den]] will be a problem in go if energy is (as it appears) a turtle variable. This will make the context of the procedure a turtle context, not an observer context. Edit:
ask adults [if (energy < 20000) [go-home den]]
Find the difference between two variables of the agents of two different breeds - Netlogo
hop of those help? This is untested, but I hope it's close enough to get you there if it's not correct. First, you have some confusion with your breeds and turtles-own sex indicator. It would be much easier to have one or the other. Scrap your turtles-own statement entirely and simply test the breed because then you can't introduce errors where (for example) you have have the flag (girl? or boy?) inconsistent with the breed, or both set to TRUE or whatever. The way you have it set up, it is possible to have a turtle of breed boy but accidentally set its variable boy? to FALSE. There is no need for these variables at all, breed is an automatic variable (like who number or size that is created with the turtle) and you can test on the breed directly.
[ let my-girls link-neighbors with [breed = girls]
if any? my-girls
[ set age-diff map [ x -> abs (x - age) [age] of my-girls ] ]