Page 1 of 1

Why is an attribute being set to “0”?

Posted: Fri Mar 31, 2023 8:41 pm
by Jack Harich
Another head-scratching puzzle. Something is setting an attribute to “0”. I can even remove the one place where’s set, and it’s still set to “0”. I’m using an attribute instead of a stock for a boolean 1 or 0, due to the awkwardness and diagram clutter of changing stock values with flows and an input from the stock.

On the Voter entity, the attribute is temp refPol equals politician supported.

I started setting the attribute to “1” or “0”. The first initial value for the attribute was “0”, so the model may have remembered that somewhere. Then I changed the initial value to “x” and started using “false1” and “true1” for settings, in case Ventity was converting “false” to 0 and “true” to 1. Nothing helped.

A clue is in the Equation Listing Control, searching on “temp refPol”. Notice the selected row. It has Expression “0”. But on that action, the attribute is being read, not set.
Equation Listing Control for temp refPol.png
Equation Listing Control for temp refPol.png (55.14 KiB) Viewed 3658 times
RDem 104.zip
(79.88 KiB) Downloaded 194 times

Re: Why is an attribute being set to “0”?

Posted: Fri Mar 31, 2023 9:01 pm
by Jack Harich
Good news. Thinking about this further and lessons learned from previous bugs, I looked for an undeleted atribute for the attribute in question, before I changed it to a shadow. I found it, deleted it, and now the model sets the attribute appropriately. "0" no longer appears in Equation Listing. So thanks for your help earlier, it helped here!

Re: Why is an attribute being set to “0”?

Posted: Fri Mar 31, 2023 10:42 pm
by tomfid
Great!