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.

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.

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.