{"data":{"markdownRemark":{"html":"<p>You can start using the Simudyne SDK without defining any configuration, since sensible default values are provided. Later on you might need to amend the settings to change the default behavior. Typical examples of settings that you might amend:</p>\n<ul>\n<li>distribution of model</li>\n<li>log level</li>\n<li>serialization level</li>\n<li>port and hostname for the server to run on</li>\n</ul>\n<h2 id=\"where-configuration-is-read-from\"><a href=\"#where-configuration-is-read-from\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Where configuration is read from</h2>\n<p>The Simudyne SDK reads the config from a <code class=\"language-text\">simudyneSDK.properties</code> file in the root directory of a project. If this file cannot be found, default values are set for all config. See <a href=\":version/reference/configuration/properties\">an example</a> or if you wish to understand a property consult the <a href=\":version/reference/configuration/explaining_properties\">reference</a></p>\n<p>All config properties can also be overwritten dynamically in the model code. Use <code class=\"language-text\">ModelContext.get(this).getConfig()</code> to get the config for a specific Model, and <code class=\"language-text\">setString()</code>, <code class=\"language-text\">setBoolean()</code>, <code class=\"language-text\">setLong()</code> or <code class=\"language-text\">setInt()</code> to set config of a specific type.</p>\n <p class=\"code-header\">ModelConfig.java</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">Housing</span> <span class=\"token keyword\">implements</span> <span class=\"token class-name\">Model</span> <span class=\"token punctuation\">{</span>\n\t<span class=\"token annotation punctuation\">@Constant</span> <span class=\"token keyword\">public</span> <span class=\"token keyword\">boolean</span> distributed <span class=\"token operator\">=</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">;</span>\n\n  <span class=\"token keyword\">public</span> <span class=\"token keyword\">void</span> <span class=\"token function\">setup</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>distributed<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    \tModelContext<span class=\"token punctuation\">.</span><span class=\"token function\">get</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">this</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getConfig</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">setString</span><span class=\"token punctuation\">(</span>\n        <span class=\"token string\">\"core-abm.backend-implementation\"</span><span class=\"token punctuation\">,</span>\n        <span class=\"token string\">\"simudyne.core.graph.spark.SparkGraphBackend\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>  \n  <span class=\"token punctuation\">}</span>  \n<span class=\"token punctuation\">}</span></code></pre></div>\n<div class=\"ui segment info message\">\n  <h4>Best practice</h4>\n  Put all config in the properties file, and only override config in the code for values that change based on user input. (An example of this might be overriding if the model should run distributed based on a toggle input). This is so that the model can be compiled and the config changed without having to recompile.\n</div>\n<h2 id=\"custom-simudynesdkproperties\"><a href=\"#custom-simudynesdkproperties\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Custom simudyneSDK.properties</h2>\n<p>A custom <code class=\"language-text\">simudyneSDK.properties</code> might look like this</p>\n<ul>\n<li>core-abm.max-messaging-phases - This is the max number of phases we will keep sending messages in a single step/tick. Setting a max number will prevent you from accidentally creating an infinite loop of messages being sent and received.</li>\n<li>core-abm.serialize.agents - When the <code class=\"language-text\">AgentSystem</code> is marked as <code class=\"language-text\">@Variable</code>, should the agents be reported <a href=\":version/reference/data_management/outputting_data\">Read More</a>.</li>\n<li>core-abm.serialize.accumulators - When the <code class=\"language-text\">AgentSystem</code> is marked as <code class=\"language-text\">@Variable</code>, should the accumulators be reported <a href=\":version/reference/data_management/outputting_data\">Read More</a>.</li>\n<li>core-abm.local-parallelism - If not set, will default to number of processors available to the JVM.</li>\n<li>core.prng-seed - The seed to use for generating random numbers.</li>\n</ul>\n <p class=\"code-header\">simudyneSDK.properties</p>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre class=\"language-yaml\"><code class=\"language-yaml\"><span class=\"token comment\">### SimudyneSDK Configuration file</span>\n\n<span class=\"token comment\">### NEXUS-SERVER ###</span>\n\nnexus<span class=\"token punctuation\">-</span>server.port = 8080\nnexus<span class=\"token punctuation\">-</span>server.hostname = 127.0.0.1\n\n<span class=\"token comment\">### CORE ###</span>\n\n<span class=\"token comment\"># core.prng-seed = 1640702558671097951</span>\n\n<span class=\"token comment\">### CORE-ABM ###</span>\ncore<span class=\"token punctuation\">-</span>abm.max<span class=\"token punctuation\">-</span>messaging<span class=\"token punctuation\">-</span>phases = 50\n\n<span class=\"token comment\"># For serialization-level, choose between : {NONE,CHECKED}</span>\ncore<span class=\"token punctuation\">-</span>abm.serialization<span class=\"token punctuation\">-</span>level=NONE\ncore<span class=\"token punctuation\">-</span>abm.serialize.agents=true\ncore<span class=\"token punctuation\">-</span>abm.serialize.links=true\ncore<span class=\"token punctuation\">-</span>abm.serialize.accumulators=true\ncore<span class=\"token punctuation\">-</span>abm.local<span class=\"token punctuation\">-</span>parallelism=8</code></pre></div>\n<div class=\"ui segment info message\">\nThe above hostname will make sure that the server and console are ONLY available locally. If you wish to deploy to a server you should change the hostname either to the IP address, or more commonly 0.0.0.0\n</div>\n<h2 id=\"example-simudynesdkproperties\"><a href=\"#example-simudynesdkproperties\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Example simudyneSDK.properties</h2>\n<p>For a full example see <a href=\":version/reference/configuration/properties\">simudyneSDK.properties</a></p>","headings":[{"value":"Where configuration is read from","depth":2},{"value":"Custom simudyneSDK.properties","depth":2},{"value":"Example simudyneSDK.properties","depth":2}],"frontmatter":{"title":"Model Configuration","toc":null,"experimental":null}},"site":{"siteMetadata":{"title":"Simudyne Docs","latestVersion":"2.6"}}},"pageContext":{"absolutePath":"/home/vsts/work/1/s/content/2.5/reference/modelling/model-configuration.md","versioned":true,"version":"2.5","kind":"reference","pagePath":"/reference/modelling/model-configuration","chronology":{"prev":{"name":"Model Context","path":"/reference/modelling/model-context"},"next":{"name":"Global State","path":"/reference/modelling/globals"}},"lastUpdated":"2026-04-21T13:56:54.862Z"}}