<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Use of Global Variable in the Experimenter in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746055#M97393</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Thanks as always, Félix.&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, in the version of the model without the ELSE clause and with the model trigger OnReset disabled, it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I’d like to confirm if I understood this correctly:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The issue lies solely in linking the value of the global variable to a function that depends on the user interface (such as getchecked()).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For some unknown reason, this causes the process to break, and the logic no longer triggers events correctly — it simply returns null as the output metric, without displaying any error message.&lt;/P&gt;&lt;P&gt;The Experimenter &lt;EM&gt;can&lt;/EM&gt; use the initial value of the global variable to execute the logic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this can serve as a reference for others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm attaching the corrected version of the model without the ELSE clause.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jul 2025 09:07:01 GMT</pubDate>
    <dc:creator>borja_lorenzo</dc:creator>
    <dc:date>2025-07-30T09:07:01Z</dc:date>
    <item>
      <title>Use of Global Variable in the Experimenter</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13745827#M97389</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I want to understand how the Experimenter (Based Range) works with Global Variables.&lt;BR /&gt;Building on the thread in the question below, and to provide context, I’m sharing once again a simplified version of the model with these additional changes, so the unexpected behavior can be reproduced.&lt;/P&gt;&lt;P&gt;The question on which my simplified model is based is this:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/flexsim-forum/random-ordering-of-production-plan-as-an-experimenter-scenario/td-p/13587524" target="_blank" rel="noopener"&gt;Solucionado: Random Ordering of Production Plan as an Experimenter Scenario - Autodesk Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Despite having read many posts on the forum about the Experimenter and Global Variables, I still do not understand why it doesn’t work in my setup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the model, I have added a GUI with a checkbox button, a Global Variable, and a Model Trigger. By activating the checkbox, I’m able to control the output of items from the conveyor system. This behaves as expected during a direct run of the model, even after resetting. I also included a Custom Code and a Decide in the Process Flow so that the GUI interaction is interpreted properly in the logic.&lt;/P&gt;&lt;P&gt;It’s important to note that I’m using the default value of the Global Variable to trigger the output event.&lt;/P&gt;&lt;P&gt;I know that the Experimenter cannot read GUI elements during its execution, which is why lines 10 and 11 of the Custom Code are two different approaches. What I expected was that, although the Experimenter cannot interpret line 11 (which uses a function that directly reads the interface), it would still be able to read a node using the syntax of line 10. Neither approach has worked. Still, I hoped that even if those two lines were not interpreted, the logic could proceed by taking the initial value of the Global Variable as valid. That did not happen, and the Experimenter produces null results.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="borja_lorenzo4278_0-1753858452305.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1556977i00F1C4E73181A938/image-size/medium?v=v2&amp;amp;px=400" role="button" title="borja_lorenzo4278_0-1753858452305.png" alt="borja_lorenzo4278_0-1753858452305.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="borja_lorenzo4278_3-1753858620031.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1556980i65B2CEA6E031D0CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="borja_lorenzo4278_3-1753858620031.png" alt="borja_lorenzo4278_3-1753858620031.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To make it work, I would need to alter the logic by adding an ELSE clause in the custom code and explicitly assigning a value to the Global Variable, thereby overwriting the initial value—using the syntax from line 10 that reads the checkbox OUT itemcurrent node and checked the checkbox OUT from the GUI. I know how to fix this, but what I want to understand is: why doesn’t the Experimenter work by relying on the default value of the Global Variable, the way it does in a manual run?&lt;/P&gt;&lt;P&gt;I’m attaching both models: one with the ELSE clause and one without.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="borja_lorenzo4278_1-1753858527831.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1556978iB1CECE6FED29F0EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="borja_lorenzo4278_1-1753858527831.png" alt="borja_lorenzo4278_1-1753858527831.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="borja_lorenzo4278_2-1753858546527.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1556979i7DC711C7E3BED1D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="borja_lorenzo4278_2-1753858546527.png" alt="borja_lorenzo4278_2-1753858546527.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="borja_lorenzo4278_4-1753858775155.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1556981iC80E41DBA1B8798B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="borja_lorenzo4278_4-1753858775155.png" alt="borja_lorenzo4278_4-1753858775155.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why can’t the Experimenter use the initial (default) value of a Global Variable?&lt;/P&gt;&lt;P&gt;Am I missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 07:04:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13745827#M97389</guid>
      <dc:creator>borja_lorenzo</dc:creator>
      <dc:date>2025-07-30T07:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Global Variable in the Experimenter</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746014#M97391</link>
      <description>&lt;P&gt;You have the same code in the model reset trigger. But that code always uses "getchecked()", so it will always set OUT to 1 without the GUI open. Without the reset code the "itemcurrent()" approach works.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 08:49:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746014#M97391</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2025-07-30T08:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Global Variable in the Experimenter</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746055#M97393</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Thanks as always, Félix.&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, in the version of the model without the ELSE clause and with the model trigger OnReset disabled, it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I’d like to confirm if I understood this correctly:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The issue lies solely in linking the value of the global variable to a function that depends on the user interface (such as getchecked()).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For some unknown reason, this causes the process to break, and the logic no longer triggers events correctly — it simply returns null as the output metric, without displaying any error message.&lt;/P&gt;&lt;P&gt;The Experimenter &lt;EM&gt;can&lt;/EM&gt; use the initial value of the global variable to execute the logic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this can serve as a reference for others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm attaching the corrected version of the model without the ELSE clause.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 09:07:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746055#M97393</guid>
      <dc:creator>borja_lorenzo</dc:creator>
      <dc:date>2025-07-30T09:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Global Variable in the Experimenter</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746100#M97394</link>
      <description>&lt;P&gt;I wouldn't say the process "breaks". But yes, "getchecked()" just returns 0 when the passed in node is not actually a button in an active window. Thus your reset trigger set the global variable to 1.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 09:29:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746100#M97394</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2025-07-30T09:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Global Variable in the Experimenter</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746151#M97396</link>
      <description>&lt;P&gt;Exactly — it’s just as you suspected.&lt;BR /&gt;And I would also say that the &lt;EM&gt;OnReset&lt;/EM&gt; trigger probably cannot detect whether the node being referenced is a button on an active GUI window. As a result, part of the intended function of that button — which was to preserve the GUI state after a reset — is lost.&lt;/P&gt;&lt;P&gt;By working within this limitation, the Experimenter now does return valid results.&lt;BR /&gt;I’m sharing the updated model again, with this new interpretation of the GUI button.&lt;/P&gt;&lt;P&gt;Great learning experience.&lt;/P&gt;&lt;P&gt;Thank you very much, Felix.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 10:20:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/use-of-global-variable-in-the-experimenter/m-p/13746151#M97396</guid>
      <dc:creator>borja_lorenzo</dc:creator>
      <dc:date>2025-07-30T10:20:47Z</dc:date>
    </item>
  </channel>
</rss>

