How do I convert my older models to run smoothly in StarLogo Nova 2.0 ?

Posted September 21, 2017 by ilee

Comments

Submitted by ilee on Sun, 09/24/2017 - 08:01 · Permalink

Older models in the StarLogo Nova database can be opened in StarLogo Nova 2.0.  There are a few changes you can make to those models to make them more aligned and faster running in StarLogo Nova 2.0.  Here are some suggestions to make your models better conform to the new engine:

  1. Check your use of random throughout the model. Use the new "random _  to _" block to get a value between in the specified range. Use "With _% chance" (instead of random (100) < __) to trigger a probabilistic event or behavior. For example, old way: [50 - random (100)] -->  new way: random(-50) to (50). And another example, old way: random (x) --> new way: random (1) to (x)
  2. Traits are created and initialized within their breed pages. On the breed's page, create using the "Show Traits" interface, and set traits in the drop downs. If you cannot access a breed's traits - then the breed's traits were not set up correctly. Initial settings of traits can be done via the trait editor.
  3. Agent's procedures need to be moved to that agent's page. In the past they could reside on the World's page but now you need to move them to the page of the agent that calls them - or everyone page).
  4. You may need to "re-balance" simulations - the old version had a bug in collision detection that caused some agents to be counted twice. This bug was fixed in the new version and might cause you to need to find a new equilibrium point, in ecosystems models and opinion dynamics models, for example.

 

Submitted by codeforfun2017 on Mon, 09/25/2017 - 14:44 · Permalink

In reply to ilee:

Hi,

Relating to setting up traits, now via the Traits UI.  In my older project I used the traits blocks in the World page to set Agent traits after creation.  In v2.0, I noticed that the "Set My" block where you can select a trait, does not work - the drop-down does not work.  But I was able to get passed this by using the new Traits UI.  If this is the case, what is the purpose of the Traits blocks now?

Thanks!

Submitted by ilee on Mon, 09/25/2017 - 15:17 · Permalink

Hello,  Thanks for your question. 

In older projects, I believe the "set my" block will fill with traits once you drag it into the create and each do block. When it is dropped outside the create and each do block, it doesn't have those traits in its "scope".

Give that a try and let me know if it works for you.

--Irene

Submitted by codeforfun2017 on Tue, 09/26/2017 - 15:39 · Permalink

Hi there,

oh yes, you are right. One last question.  The new traits dialog available on every page is a place to just set the initial values, like initialization code.  Setting the traits during create will override these initial values.  Is my understanding correct?  

Thank you

Submitted by ilee on Tue, 09/26/2017 - 16:02 · Permalink

Correct. In the traits editor you can add user defined traits as well as initialize the values of traits.  Any setting of the traits in code using the "set my __ to ___" will override the current value for that trait.  But it will not change the initialization settings in the "edit traits" area.