{"data":{"markdownRemark":{"html":"<p>@Variable is needed for all data reporting. The Simudyne SDK provides several helper methods and classes that can be used to report more complex data easily.</p>\n<p>If using the Simudyne SDK with the console, this reported data will be displayed for you in an appropriate format on the console. If using the Simudyne SDK without the console, the data will be returned in a JSON format.</p>\n<div class=\"ui segment info message\">\nAccumulators are reported by default. They could be present twice in the console if the annotation is used for them.\n</div>\n<h3 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</h3>\n<p>The most simple way of reporting data is creating a field in the <code class=\"language-text\">Model</code> and annotating it with <code class=\"language-text\">@Variable</code>.\nFields annotated with @Variable will be displayed in the console as a line chart.</p>\n<div class=\"ui segment warning message\">\n All fields marked as @Variable need to have public access, and must be a data type that can be reported. Accepted data types include primitive types (float, int, double), and any object that extends simudyne.core.JSONValue (see JsonValue below).\n</div>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">MyAgent agent<span class=\"token punctuation\">;</span>\n<span class=\"token annotation punctuation\">@Variable</span> <span class=\"token keyword\">public</span> <span class=\"token keyword\">float</span> balance <span class=\"token operator\">=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>Console view</p>\n<p>\n  <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-aa0c8.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n  \n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 47.592738752959754%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAYAAAC0VX7mAAAACXBIWXMAABJ0AAASdAHeZh94AAABhElEQVQoz52STS8DYRDHn5sWxXa7b13VF0qIA+lBKpogtt1tV7f0VZtKBGkTh5KIL4DExXfBxcFnItyc/M1uq/RAtIdfZvLM/OeZ55lh4VAWsmqCl9LwyRnw/8TJJY2gZBAIWpAns+SbYIqapkAKXnEwbK3oN+gCnXwDTJA18OI6fNIG2f74qfEKG+2CY/wm2FAczL0K5hqAjm7Ik6ALqGA8VsB57RinlUOc7R31TYt0F/VjGIkqOGkHrJnfx/vjNV7uLvF6f4XXh17e/sCOP5Pu4+kGtycNuMZ1sLWVIg6sGkpaAeVk0aGkfVPcyrdx/ALZL9rxAp3VMyVoiTI4kZ48Ha1AUgyIhCDb0zLoc3WaoA5OsCdpYoxPw8NrZFMY9SYxwiUxzGlwT2jU1RaRwbhgwD9lgS3FWghGclRMdwp38dOOyUmEZ2pYjjXhD6Q750a3AUmhlRM1zC82MLdQddaIhaN5qKFd6speVrMHXjIh0tJHZkuQVOvXnMlQjnLK8Cnb+ASsUFSwD+UbbAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-8e416.webp 173w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-0b506.webp 345w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-58be5.webp 690w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-59b8d.webp 1035w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-a4d14.webp 1267w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-7e3fa.png 173w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-7f1d4.png 345w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-13856.png 690w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-045bb.png 1035w,\n/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-aa0c8.png 1267w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-13856.png\"\n          alt=\"Console View\"\n          title=\"\"\n          src=\"/static/balance_console_2_1-a303938463affe172e6f34b2cf2bbc00-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  \n  </a>\n    </p>\n<p>To set the title of the line chart, set the name in the variable annotation. If not set, it defaults to the name of the field.</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@Variable</span><span class=\"token punctuation\">(</span>name<span class=\"token operator\">=</span><span class=\"token string\">\"Balance Header\"</span><span class=\"token punctuation\">)</span> <span class=\"token keyword\">public</span> <span class=\"token keyword\">float</span> balance <span class=\"token operator\">=</span> <span class=\"token number\">0</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>Methods that return accepted data types can also be annotated with @Variable. These methods will be called at least once per step, but may be called many more times, so they should not change any values in the model.</p>\n<p>Variable methods will only be called after setup, so the model can depend on a state that is initialised as part of the setup (such as AgentSystem).</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@Variable</span><span class=\"token punctuation\">(</span>name <span class=\"token operator\">=</span> <span class=\"token string\">\"Interest Charge\"</span><span class=\"token punctuation\">)</span>\n<span class=\"token keyword\">public</span> <span class=\"token keyword\">float</span> <span class=\"token function\">interestCharge</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">return</span> interest <span class=\"token operator\">*</span> balance<span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Fields marked as @Variable (this will be ignored for methods marked as @Variable) can set the parameter \"initialisable\" to true if you want the variable assigned before setup.</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@Variable</span><span class=\"token punctuation\">(</span>name <span class=\"token operator\">=</span> <span class=\"token string\">\"Balance\"</span><span class=\"token punctuation\">,</span> initializable <span class=\"token operator\">=</span> <span class=\"token boolean\">true</span><span class=\"token punctuation\">)</span>\n<span class=\"token keyword\">public</span> <span class=\"token keyword\">float</span> balance <span class=\"token operator\">=</span> <span class=\"token number\">400</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>\n  <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-17015.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n  \n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 325px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 28.307692307692307%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsSAAALEgHS3X78AAAAc0lEQVQY07WQSwrAIAxEvf8h3YqKoCKIok5JoCL90S4aGAIDeZlEpJRQSkGtFWMMUFHf1Xtnrd6ThJQSSikYY3jwCKRlrbWTfwvERa1J34ImkJJpreGcg7UWOecJocRf0jHQe48QAmKMLPrlCvjyv19O3gCHUtof1XPPdgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-29416.webp 173w,\n/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-f56e9.webp 325w\"\n          sizes=\"(max-width: 325px) 100vw, 325px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-a8cac.png 173w,\n/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-17015.png 325w\"\n          sizes=\"(max-width: 325px) 100vw, 325px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-17015.png\"\n          alt=\"Console View\"\n          title=\"\"\n          src=\"/static/constant_after_setup_2_1-b471532a07eccc8dedf5ab3110196529-17015.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  \n  </a>\n    </p>\n<h3 id=\"jsonvalue\"><a href=\"#jsonvalue\" 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>JSONValue</h3>\n<p>When reporting complex objects, the Simudyne SDK needs to be able to generate a JSON value and JSON schema of the objects. Therefore, all complex objects need to implement JSONValue and the methods for returning the JSON value.</p>\n<p>The Simudyne SDK provides several data types that implement JSONValue, and can be used out of the box to report to the console. These are explained below. Using these provided data types is the recommended way of reporting.</p>\n<div class=\"ui segment warning message\">\nAdvanced users can create their own data types that implement JSONValue, and the data returned will be reported as a JSON, but the console will not be able to handle these data types, and will not display the information.\n</div>\n<h3 id=\"accumulators\"><a href=\"#accumulators\" 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>Accumulators</h3>\n<p>Accumulators are variables that are only added to through an associative and commutative operation. They can be used to implement counters or sums.</p>\n<p>The two supported accumulators are DoubleAccumulators and LongAccumulators. They are both used in the same way, DoubleAccumulators for storing values of type <code class=\"language-text\">double</code>, and LongAccumulators for storing values of type <code class=\"language-text\">long</code>.</p>\n<p>Accumulators can be created within an AgentBasedModel.</p>\n<p class=\"code-header\">(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\">MyClass</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\t<span class=\"token punctuation\">.</span><span class=\"token punctuation\">.</span><span class=\"token punctuation\">.</span>\n  <span class=\"token punctuation\">{</span>  \n  \t<span class=\"token comment\">// create accumulator</span>\n  \t<span class=\"token function\">createLongAccumulator</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"born\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token comment\">// get accumulator and add value</span>\n  \t<span class=\"token function\">getLongAccumulator</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"born\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">add</span><span class=\"token punctuation\">(</span><span class=\"token number\">10</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 comment\">// get accumulator and add value from within an Agent</span>\n<span class=\"token keyword\">public</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">Cell</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">Agent</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 keyword\">public</span> LongAccumulator born <span class=\"token operator\">=</span> <span class=\"token function\">getLongAccumulator</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"born\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\n  <span class=\"token keyword\">public</span> <span class=\"token keyword\">void</span> <span class=\"token function\">onStart</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    born<span class=\"token punctuation\">.</span><span class=\"token function\">add</span><span class=\"token punctuation\">(</span><span class=\"token number\">10</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>    </code></pre></div>\n<p>When running a simulation locally, accumulators are automatically reported to the console. To explicitly turn on or off reporting for accumulators, set the config field core-abm.serialize.accumulators. (See Model Configuration). Accumulators can be created with a second parameter for the display name that will be used when reporting the accumulators on the console.</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token function\">createLongAccumulator</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"born\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"Amount Born\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>To view the count or mean of the accumulator, use the <code class=\"language-text\">getCount()</code> or <code class=\"language-text\">getMean()</code> methods and save the results as a primitive type annotated with @Variable.</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@Variable</span><span class=\"token punctuation\">(</span>name <span class=\"token operator\">=</span> <span class=\"token string\">\"Born Mean\"</span><span class=\"token punctuation\">)</span>\n<span class=\"token keyword\">public</span> <span class=\"token keyword\">long</span> bornMean <span class=\"token operator\">=</span> <span class=\"token function\">getLongAccumulator</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"born\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">mean</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h3 id=\"agent-statistics\"><a href=\"#agent-statistics\" 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>Agent Statistics</h3>\n<p>Statistics about the values of specific fields in agents can be collected using <code class=\"language-text\">AgentSystem.stats()</code>.</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token comment\">// Agent statistics are collected for a specific agent class</span>\n<span class=\"token keyword\">public</span> AgentStatistics<span class=\"token generics function\"><span class=\"token punctuation\">&lt;</span>MyAgent<span class=\"token punctuation\">></span></span> myAgentStats <span class=\"token operator\">=</span> <span class=\"token function\">stats</span><span class=\"token punctuation\">(</span>MyAgent<span class=\"token punctuation\">.</span><span class=\"token keyword\">class</span><span class=\"token punctuation\">)</span>\n\n<span class=\"token comment\">// Filters can be used if statistics are only needed for some of the agents.</span>\n<span class=\"token comment\">// In this case, only get statistics of agents where age is > 100   </span>\nmyAgentStats<span class=\"token punctuation\">.</span><span class=\"token function\">filter</span><span class=\"token punctuation\">(</span>x <span class=\"token operator\">-</span><span class=\"token operator\">></span> x<span class=\"token punctuation\">.</span>age<span class=\"token punctuation\">)</span>\n\n<span class=\"token comment\">// Specify which fields to collect statistics for.    </span>\nmyAgentStats<span class=\"token punctuation\">.</span><span class=\"token function\">field</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Age\"</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">-</span><span class=\"token operator\">></span> x<span class=\"token punctuation\">.</span>age<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">field</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Balance\"</span><span class=\"token punctuation\">,</span> x <span class=\"token operator\">-</span><span class=\"token operator\">></span> x<span class=\"token punctuation\">.</span>balance<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>  \n\n<span class=\"token comment\">// Get the statistics results</span>\n<span class=\"token keyword\">public</span> AgentStatisticsResult<span class=\"token generics function\"><span class=\"token punctuation\">&lt;</span>MyAgent<span class=\"token punctuation\">></span></span> statsResults <span class=\"token operator\">=</span> myAgentStats<span class=\"token punctuation\">.</span><span class=\"token function\">get</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>This will collect statistics and save as Apache SummaryStatistics.</p>\n<p>Get the SummaryStatistics for a field and get the required statistic to report using the SummaryStatistics methods. Annotate the field with @Variable, so the result will be reported to the console.</p>\n<p class=\"code-header\">(Java)</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@Variable</span> <span class=\"token keyword\">public</span> <span class=\"token keyword\">double</span> balanceMean <span class=\"token operator\">=</span>\n  statsResults<span class=\"token punctuation\">.</span><span class=\"token function\">getField</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"Balance\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>get <span class=\"token function\">Mean</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h3 id=\"agent-fields\"><a href=\"#agent-fields\" 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>Agent fields</h3>\n<p>It is also possible to report the fields inside agents. In order to do so, annotate the fields inside Agents.</p>\n<p class=\"code-header\">(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\">Cell</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">Agent</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\">@Variable</span> <span class=\"token keyword\">public</span> <span class=\"token keyword\">boolean</span> alive<span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>This will output a table for each Agent type, with the values of the fields annotated with @Variable for each agent in the system.</p>\n<div class=\"ui segment info message\">\n<h4>Agent view </h4>The top-right corner lets you select different views. For the following example, select the Agent view.\n</div>\nExample output:\n<table class=\"ui celled table\">\n  <thead>\n    <tr>\n      <th>Cell</th>\n      <th>Alive</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>6565</td>\n      <td>false</td>\n    </tr>\n    <tr>\n        <td>4536</td>\n        <td>false</td>\n    </tr>\n    <tr>\n      <td>7791</td>\n      <td>false</td>\n    </tr>\n    <tr>\n        <td>1209</td>\n        <td>false</td>\n    </tr>\n  </tbody>\n</table>\n<div class=\"ui segment warning message\">\nWhen running models in distributed mode, AgentSystem reporting is muted even if AgentSystem is annotated with @Variable. To report agent fields, core-abm.serialize.agents must be set to true in the config, and to report accumulators, set core-abm.serialize.accumulators must be set to true.\n</div>\n<div class=\"ui segment warning message\">\n<h4>Reporting for multirun Simulations</h4>\nWhen running a model as a multirun, Agent tables will not be reported on the console.\n</div>","headings":[{"value":"Variable","depth":3},{"value":"JSONValue","depth":3},{"value":"Accumulators","depth":3},{"value":"Agent Statistics","depth":3},{"value":"Agent fields","depth":3}],"frontmatter":{"title":"Reporting","toc":null,"experimental":null}},"site":{"siteMetadata":{"title":"Simudyne Docs","latestVersion":"2.6"}}},"pageContext":{"absolutePath":"/home/vsts/work/1/s/content/2.4/reference/agents/reporting.md","versioned":true,"version":"2.4","kind":"reference","pagePath":"/reference/agents/reporting","chronology":{"prev":{"name":"Actions and Sequencing","path":"/reference/agents/actions-and-sequencing"},"next":{"name":"Global State","path":"/reference/agents/global-state"}},"lastUpdated":"2026-04-21T13:56:54.850Z"}}