I would like to update the fields "quantity 1", "quantity 2", "quantity 3", etc. in my assembly block with a variable. I have set up a user control screen in the simulation window and let the user control a slider to change each quantity.
I am doing this by:
When I run the analysis, the variables do successfully update, but the assembler doesn't accept any agents. I believe the issue is that the variables initial value of 0 is getting initialized before the users selection takes effect.
How can I update quantities in an assembler based on user slider controls?
I believe the issue is that the variables initial value of 0 is getting initialized before the users selection takes effect.
Correct. You can verify this by understanding the little icons next to properties. For your assembler, the "=" sign tells you: "I am set at the start and do not check for changes myself ever again":
Also see this help article.
How can I update quantities in an assembler based on user slider controls?
Use code-complete on the block to find "updater" functions. In this case:
It is your responsibility to call these when the actual qty values would change, so you can easily do that in your function that does the computations anyway. You can then also discard those variables, you do not need them anymore.