-now=1.0, value=42</code></pre><p>The <code>example</code> process function above first creates a <code>timeout</code> event. It passes the environment, a delay, and a value to it. The <code>timeout</code> schedules itself at <code>now + delay</code> (that’s why the environment is required); other event types usually schedule themselves at the current simulation time.</p><p>The process function then yields the event and thus gets suspended. It is resumed, when ConcurrentSim processes the <code>timeout</code> event. The process function also receives the event’s value (42) – this is, however, optional, so <code>@yield event</code> would have been okay if the you were not interested in the value or if the event had no value at all.</p><p>Finally, the process function prints the current simulation time (that is accessible via the <code>now</code> function) and the <code>timeout</code>’s value.</p><p>If all required process functions are defined, you can instantiate all objects for your simulation. In most cases, you start by creating an instance of <code>Environment</code>, e.g. a <code>Simulation</code>, because you’ll need to pass it around a lot when creating everything else.</p><p>Starting a process function involves two things:</p><ul><li>You have to call the macro <code>@process</code> with as argument a call to the process function. (This will not execute any code of that function yet.) This will schedule an initialisation event at the current simulation time which starts the execution of the process function. The process instance is also an event that is triggered when the process function returns.</li><li>Finally, you can start ConcurrentSim’s event loop. By default, it will run as long as there are events in the event list, but you can also let it stop earlier by providing an until argument.</li></ul></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../tutorial/">« Tutorial</a><a class="docs-footer-nextpage" href="../environments/">Environments »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.14.1 on <span class="colophon-date" title="Thursday 14 August 2025 16:21">Thursday 14 August 2025</span>. Using Julia version 1.11.6.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0 commit comments