question

Kari Payton avatar image
0 Likes"
Kari Payton asked Mischa Spelt answered

Update code for Open/Close ports on reset trigger for fluid generator.

Idk why this is, but whenever I tried the option close port on the reset trigger for the FluidGenerator it didn't work. After some hours I saw something to use clopeop for fluids. I went in and used the custom code trigger on reset option to use closeop function instead of closeoutput and it works. Maybe update the standard fluid trigger options with this function or make functions all the same for fluid and solids?

FlexSim 18.0.1
fluid libraryfluids
· 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.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

Are you talking about a FluidGenerator or a FloWorks object?

The FluidGenerator works just fine with closeoutput() OnReset:

fluidgenerator-closeoutput-onreset.fsm

Please post a model demonstrating the issue you are having.

You can use both closeoutput/input and closeop/ip with fluid objects. Fluid will only be sent through a port if all of the connections are open (output and op of upstream object, input and ip of downstream object).

0 Likes 0 ·
Kari Payton avatar image Kari Payton Phil BoBo ♦♦ commented ·

unfortunately I can't find the saved copy of the file I was working on. I was referring to FluidGenerator. I tried to redo it and couldn't replicate the issue now. Possibly I had something else going on. Next time I'll provide the model. Sorry @phil.bobo

0 Likes 0 ·

1 Answer

Mischa Spelt avatar image
1 Like"
Mischa Spelt answered

In case anyone finds this topic in the future let me complement this thread with the FloWorks answer: because FloWorks does not use time slicing but events, you need to make sure that the engine is aware of ports being opened or closed so the flow rates through your network can be recalculated. In pre-17.2 FloWorks separate commands CloseFlowOp and CloseFlowOutput were provided that you had to use instead of FlexSim's closeop and closeoutput. Since version 17.2 FloWorks supports 'dot syntax' which allows you to write:

// Note: type of the variable is FlowObject instead of Object
FlowObject flowObject = model.find("...");

// "Red bar" for all output, just like in regular FlexSim
flowObject.output.close();

// Close a single port, equivalent of 'old' closeop/CloseFlowOp
flowObject.output.ports[1].close();

or directly through

// note the use of .as(..) to ensure that the treenode is treated as flow object
model.find("...").as(FlowObject).output.close();
model.find("...").as(FlowObject).output.ports[1].close();
5 |100000

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