question

Marc R5 avatar image
0 Likes"
Marc R5 asked Ricard G commented

Optimizer - Error: Pushing a null variant onto a variant is not allowed

Layout v3.1_17.fsm

Hello,

I create a EndTime label in the sink to get the sum of the production time.

Using this to optimize, is giving me an error: "Pushing a null variant onto a variant is not allowed" and it is not optimizing.

Someone can help me find the issue?


Thanks!!!!

FlexSim 22.1.0
optquest
layout-v31-17.fsm (529.7 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ryan Clark avatar image Ryan Clark commented ·

Hi @Marc R5, was one of Jordan Johnson's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·
Ricard G avatar image Ricard G Ryan Clark commented ·
Hi, I am aware of that and always try to accept the best answer. The fact is I can't see any accept button in any answer in this topic
0 Likes 0 ·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Ricard G commented

There are two bugs. One is in FlexSim, and one is in the model. Fortunately, if you fix the model bug, the FlexSim bug won't happen.

The FlexSim bug is that the optimizer chart runs a query against the results database file, and part of that query makes an array. If there are null values in that array, you get the push() exception which you see. So that is a bug that I will get on the dev list, and fix.

But the array being made is the set of performance measure values, for the OutOfDate performance measure. This performance measure is not being used properly. You should not set a performance measure value directly. A performance measure is a function that returns a value, rather than a value. By setting the node to a certain value, you corrupt the node, so the value cannot be retrieved during an experiment; the OutOfDate value is always null. The optimizer doesn't have a way to set null values, so it things the value is zero, and that the constraint is met.

In your case, a TrackedVariable (or even a Global Variable) would work exactly the way you want. You can set that value while the model runs. The value will be reset automatically, too, so you don't need any special code in the model's OnReset trigger. Then, you can configure the performance measure function to retrieve the TrackedVariable value.

OptimizerPushBug.fsm


optimizerpushbug.fsm (545.5 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ricard G avatar image Ricard G commented ·
Thank you very much Jordan. And thanks for your quick response. Much appreciated.
0 Likes 0 ·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Jordan Johnson commented

I attempted to look in to this. First, I replaced "%c" with "%d/%m/%Y %H:%M:%S". The %c option relies on windows settings, and my windows settings didn't happen to match yours. Without that, the model didn't work at all.

Once I did that, the model ran correctly, so then I tried to optimize. The optimizer ran correctly, without any errors. I didn't get the error you describe.

I did see that the Order variable doesn't seem to be used. It has some OnSet code, but that code is setting the first cell in the Arrivals table to the value of the new array, which probably isn't what you want.

I guessed, and changed the OnSet of the Order Parameter to update the Order column of the Arrivals table, but that still had no effect. It seems like the order of items in the model isn't currently connected to the Order parameter value, or to the Order column in the Arrivals table. Here's the model with the changes I made:

layout-v31-17_2.fsm


layout-v31-17-2.fsm (530.3 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Marcello Rosadini avatar image Marcello Rosadini commented ·

Hi @Jordan this version of the model is doing what Marc expects, however the error that he describes is popping and we haven't been able to identify the pattern or reason that trigger it.

Layout v3.1_22.fsm

0 Likes 0 ·
layout-v31-22.fsm (547.4 KiB)
Jordan Johnson avatar image Jordan Johnson ♦♦ Marcello Rosadini commented ·
I can confirm that I can get the issue now. It's probably a bug. I'll look in to this and let you know what I can find.
0 Likes 0 ·