question

Jon Abbott avatar image
2 Likes"
Jon Abbott asked Jon Abbott commented

Port open and close commands in FlexSim 17

I'm using FlexSim 17.1 to update a model that is currently developed using FlexSim 16. I noticed that some of the port open and close commands are now deprecated and replaced. For example, openinput(object) has been replaced with object.input.open(). When I try to use the new command on "current", however, it does not work. The validation checker says that "open" is an unknown command. "current" is a separator in this case, if that helps to diagnose the issue. Also, when I type "current." in the code editor, it provides a list of options to choose from, but input is not one of them. Is there a different syntax that should be used than what is described by the tooltip? Thanks in advance for your assistance.

Also, another unrelated issue - the software versions listed in the FlexSim Answers forum post drop-down does not include 17.1 yet.

FlexSim 17.1.0
FlexSim 17.0.3
portsflexsim 2017port control
· 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.

Mischa Spelt avatar image Mischa Spelt commented ·

First thought: are you sure current is an Object and not a treenode?

3 Likes 3 ·
Joerg Vogel avatar image Joerg Vogel commented ·
current.input.close();
// or
current.input.open();

just right from the Flexsim Class Reference Object.input

2 Likes 2 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

@Jon Abbott,

I updated the software versions listing here at Answers. Thanks for the heads up.

1 Like 1 ·

1 Answer

·
Matthew Gillespie avatar image
2 Likes"
Matthew Gillespie answered Jon Abbott commented

If you're updating from 2016 then the headers are probably still declaring current as a treenode:

treenode current = ownerobject(c);
treenode item = param(1);

You should update the header to declare current (and item) as an Object:

Object current = ownerobject(c);
Object item = param(1);

Or you can just cast the treenode into an Object when you use it:

current.as(Object).input.close();
· 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.

Jon Abbott avatar image Jon Abbott commented ·

Thanks @Matthew Gillespie, this is exactly what happened. I had looked through the release notes for FlexSim 2017 but didn't catch that treenode items need to be changed to objects when using the new syntax.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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