question

Alessio Merlo avatar image
2 Likes"
Alessio Merlo asked Phil BoBo edited

How does variant manage number?

Hi,

I migrated a model from FlexSim 16.2 to 17.0 and I had a strange behaviour with a message trigger. Does somebody help me? I attached a simple model which duplicates the issue.

The OnEntry trigger of the processor sends a message (delay or not is the same) with tonum(item) as first parameter. In the message trigger I read the number like a double or variant with msgparam(1) and I convert it in a treenode with tonode() function. In FlexSim 16.2 the result of tonode() function is the same, but in FlexSim 17.0 not. What is the change?

Thanks for the support.

16-2.fsm

17-0.fsm

FlexSim 17.0.0
message triggervariantflexsim 17
16-2.fsm (15.1 KiB)
17-0.fsm (15.2 KiB)
5 |100000

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

1 Answer

Phil BoBo avatar image
3 Likes"
Phil BoBo answered Phil BoBo edited

This is a bug that the tonode() overload isn't correctly returning a node when it is passed a Variant with number data. It will be fixed in the 17.0.1 bug fix release so that it works the same way it did in 16.2.

In the meantime, you can put it into a double, as you are in your example, or cast it to a number before passing it into the tonode() command by calling tonode(tonum(msgparam(3))).

5 |100000

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