{"data":{"markdownRemark":{"html":"<p>Annotations are used to mark fields in the model. This is important to identify the model as a specific type so that the Simudyne SDK has knowledge of these fields when running the model.</p>\n<h2 id=\"modelsettings\"><a href=\"#modelsettings\" 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>@ModelSettings</h2>\n<p><code class=\"language-text\">ModelSettings</code> is an optional annotation that allows you to set a number of configuration parameters, such as the default time settings.</p>\n<p>Optional <code class=\"language-text\">ModelSettings</code> parameters:</p>\n<ul>\n<li>\n<p><strong>id</strong> - Setting an id for a model is useful when there are multiple models running. Default value is <code class=\"language-text\">new_model</code></p>\n</li>\n<li>\n<p><strong>start</strong> - Start time for the model time to commence at. Default value is <code class=\"language-text\">2018-01-01T00:00:00Z</code>. If set, the string must represent a valid date-time that will be parsed using <a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html\">DateTimeFormatter</a></p>\n</li>\n<li>\n<p><strong>timeStep</strong> - The number of timeUnits between every model step/tick. Default value is <code class=\"language-text\">1</code></p>\n</li>\n<li>\n<p><strong>timeUnit</strong> - The base timeUnit for the timeSteps to occur in. Default value is <code class=\"language-text\">MONTHS</code></p>\n</li>\n<li>\n<p><strong>end</strong> - The 'end' of the simulation, by virtue of calling the finish function. This will also affect the <code class=\"language-text\">lastStep</code> function within step for usage by the modeller. Default value is <code class=\"language-text\">60</code></p>\n</li>\n<li>\n<p><strong>kickoff</strong> - The 'kickoff' for the simulation - the function for this is represented by <code class=\"language-text\">kickOff</code> which can be called in the tick function. Usage for this is primarily to set aside actions to activate or call agents/procesess to begin while allowing a 'warmup' phase where some actions can occur. Default value is <code class=\"language-text\">1</code>.</p>\n<p class=\"code-header\">ModelSettings.Java</p>\n</li>\n</ul>\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\">MyModel</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">AgentBasedModel</span><span class=\"token generics function\"><span class=\"token punctuation\">&lt;</span>GlobalState<span class=\"token punctuation\">></span></span> <span class=\"token punctuation\">{</span>\n<span class=\"token annotation punctuation\">@ModelSettings</span><span class=\"token punctuation\">(</span>kickoff <span class=\"token operator\">=</span> <span class=\"token number\">10</span><span class=\"token punctuation\">,</span> end <span class=\"token operator\">=</span> <span class=\"token number\">100</span><span class=\"token punctuation\">,</span> timeUnit <span class=\"token operator\">=</span> <span class=\"token string\">\"MONTHS\"</span><span class=\"token punctuation\">)</span>\n<span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">CreditCard</span> <span class=\"token keyword\">implements</span> <span class=\"token class-name\">Model</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token punctuation\">.</span><span class=\"token punctuation\">.</span><span class=\"token punctuation\">.</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"constant\"><a href=\"#constant\" 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>@Constant</h2>\n<p>Fields can be marked as <code class=\"language-text\">Constant</code> to highlight that this field is available for configuration before <code class=\"language-text\">setup()</code> has been called on the model. <code class=\"language-text\">Constant</code> is useful for configurable parameters that will be used during the model setup such as the number of agents.</p>\n<p><code class=\"language-text\">name</code> can be passed as an optional parameter to the constant annotation to set a human-friendly name for the input field in the console. If not set, the name of the field will be used.</p>\n  <p class=\"code-header\">Constant.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\">CreditCard</span> <span class=\"token keyword\">implements</span> <span class=\"token class-name\">Model</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token annotation punctuation\">@Constant</span><span class=\"token punctuation\">(</span>name <span class=\"token operator\">=</span> <span class=\"token string\">\"Initial Balance\"</span><span class=\"token punctuation\">)</span>\n  <span class=\"token keyword\">public</span> <span class=\"token keyword\">long</span> initialBalance <span class=\"token operator\">=</span> <span class=\"token number\">400</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 comment\">// set balance to value of initialBalance</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>  </code></pre></div>\n<p>Console view of constant before setup (value can be changed).</p>\n<div class=\"constant field\">\n![](/src/images/constant_2_1.png)\n</div>\n<div class=\"ui warning info message\">\n  Constant fields must be public, with a primitive type (int, float, boolean etc).\n</div>\n<h2 id=\"input\"><a href=\"#input\" 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>@Input</h2>\n<p>Fields can be marked as <code class=\"language-text\">Input</code> to show that this field is available for configuration in the model at all times. <code class=\"language-text\">Input</code> fields are used to highlight where particular parameters in the model may be involved in ongoing decisions.</p>\n<p>As with @Constant, <code class=\"language-text\">name</code> can be used as an optional parameter to set a human-friendly title for the input field in the console. If this is not set, the name of the field will be used.</p>\n  <p class=\"code-header\">Input.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\">CreditCard</span> <span class=\"token keyword\">implements</span> <span class=\"token class-name\">Model</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token annotation punctuation\">@Input</span><span class=\"token punctuation\">(</span>name <span class=\"token operator\">=</span> <span class=\"token string\">\"Spending\"</span><span class=\"token punctuation\">)</span>\n  <span class=\"token keyword\">public</span> <span class=\"token keyword\">float</span> spending <span class=\"token operator\">=</span> <span class=\"token number\">250f</span><span class=\"token punctuation\">;</span>\n\n  <span class=\"token keyword\">public</span> <span class=\"token keyword\">void</span> <span class=\"token function\">step</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// use value of spending</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>  </code></pre></div>\n<div class=\"ui segment warning message\">\n  Input fields must be public, with a primitive type (int, float, boolean etc).\n</div>\n<h2 id=\"variable\"><a href=\"#variable\" 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>@Variable</h2>\n<p>Fields marked as <code class=\"language-text\">Variable</code> are serialised as part of the model output after setup has been run.\n(This means that it is safe to depend upon state that is initialised as part of setup from a @Variable method (such as an AgentSystem)).</p>\n<p>For more information on <code class=\"language-text\">Variable</code> see <a href=\":version/reference/data_management/outputting_data\">Outputting Data</a></p>\n<div class=\"ui segment warning message\">\n  Variable fields must be public, with a supported type (<a href=\":version/reference/data_management/outputting_data#jsonvalue\">Read more about supported types</a>).\n</div>\n<h2 id=\"output\"><a href=\"#output\" 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>@Output</h2>\n<p>Currently <code class=\"language-text\">Outputs</code> and <code class=\"language-text\">Variables</code> are considered the same thing, and can be used in the same way.</p>\n<div class=\"ui segment warning message\">\n  Ouput fields must be public, with a supported type (<a href=\":version/reference/data_management/outputting_data#jsonvalue\">Read more about supported types</a>).\n</div>\n<h2 id=\"custom\"><a href=\"#custom\" 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</h2>\n<p>Fields marked as custom are objects which have fields of their own with annotations.</p>","headings":[{"value":"@ModelSettings","depth":2},{"value":"@Constant","depth":2},{"value":"@Input","depth":2},{"value":"@Variable","depth":2},{"value":"@Output","depth":2},{"value":"@Custom","depth":2}],"frontmatter":{"title":"Annotations","toc":null,"experimental":null}},"site":{"siteMetadata":{"title":"Simudyne Docs","latestVersion":"2.6"}}},"pageContext":{"absolutePath":"/home/vsts/work/1/s/content/2.5/reference/modelling/annotations.md","versioned":true,"version":"2.5","kind":"reference","pagePath":"/reference/modelling/annotations","chronology":{"prev":{"name":"Model Initialisation","path":"/reference/modelling/model-initialisation"},"next":{"name":"Model Context","path":"/reference/modelling/model-context"}},"lastUpdated":"2026-04-21T13:56:54.862Z"}}