Table of Contents

Table of Contents

FlexScript Class - FlowObject.InputOutput

FlowObject.InputOutput

Description

Allows access to the input or output ports for this FloWorks object.

You cannot obtain an instance of this class directly, use it as follows:


FlowObject pump = model.find("FlowPump1");
pump.input.close();
return pump.input.maxRate;
	  

Properties

amount Returns the current cumulative input or output amount.
maxRate Gets or sets the maximum allowed flow rate.
ports Accesses the input or output ports
rate Gets the current flow rate.
triggerAmount Gets or sets the amount at which the input or output trigger logic will execute.
triggerInterval Gets or sets the interval at which the input or output trigger logic will execute.

Methods

close Block all flow input ports.
open Unblock all flow input ports.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.amount

readonly double amount

Description

Returns the current cumulative input or output amount.

Calling flowObject.input.amount is equivalent to flowObject.stats.input.

Calling flowObject.output.amount is equivalent to flowObject.stats.output.

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.maxRate

double maxRate

Description

Gets or sets the maximum allowed flow rate.

This property requests or changes the maximum possible flow rate. To get actual rate (which may be lower due to other constraints in the network), use rate.

Note that the flow rate is only changed after the system has had a chance to recalculate, so the following code will return the current flow rate:


FlowObject pump = model.find("FlowPump1");
// Assume that at the moment, pump.input.rate == 1.
pump.input.maxRate = 0.5;

// The following will return 1. The flow rate will be updated 
// only after the next Flow Control calculation event.
return pump.input.rate; 
	  

For non-content-holding objects, such as pumps and valves, you can request or set either the input or the output maximum rate - the other one will be adjusted automatically.

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.ports

ports

Description

Accesses the input or output ports

You can use the following properties and methods:

Opening and closing the input or output

To open or close all input / output of the object, use the following code:


obj.input.ports.close();
obj.output.ports.open();
	  

This is the FloWorks-equivalent of the FlexSim commands closeallip, openallip and closeallop, openallop.

You should not use those FlexSim commands: calling ports.open() and ports.close() ensures that all flow rates in the network are recalculated while openallip and similar functions do not.

If you want to close specific ports, use the "bracket" notation below to access a single port. If you are looking for the equivalent of closeinput, use obj.input/output.close.

Accessing a specific port

The number of input or output ports can be retrieved from the length property. To access a specific port, use the "bracket" notation:


// Open only the first input port:
obj.input.ports[ 1 ].select();

// Set the flow ratio through the last output port:
int numOfPorts = obj.output.ports.length;
obj.output.ports[ numOfPorts ].ratio = 0.5;
	  

See the reference for FlowObject.Port to see which properties and methods are available on the result of the "bracket" operator.

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.rate

readonly double rate

Description

Gets the current flow rate.

Due to other constraints in the network, the flow rate may always be lower than the specified maximum.

This property reads the currently assigned flow rate. To get or set the preferred rate (the maximum rate in absence of other constraints), use maxrate.

Note that the flow rate is only changed after the system has had a chance to recalculate, so the following code will return the current flow rate:


FlowObject pump = model.find("FlowPump1");
// Assume that at the moment, pump.input.rate == 1.
pump.input.maxRate = 0.5;

// The following will return 1. The flow rate will be updated 
// only after the next Flow Control calculation event.
return pump.input.rate; 
	  

For non-content-holding objects, such as pumps and valves, you can request either the input or the output rate - the other one will be adjusted automatically.

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.triggerAmount

double triggerAmount

Description

Gets or sets the amount at which the input or output trigger logic will execute.

This property gets or sets the total cumulative inflow or outflow amount at which the On Input or On Output trigger logic will execute.

Previously, you would call GetFlowInputTriggerAmount, SetFlowInputTriggerAmount or GetFlowOutputTriggerAmount, SetFlowOutputTriggerAmount to do this.

If no trigger amount has been set yet, the property will return 0.

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.triggerInterval

double triggerInterval

Description

Gets or sets the interval at which the input or output trigger logic will execute.

This property gets or sets the interval at which the On Input or On Output trigger logic will be scheduled.

If you have previously scheduled a trigger which has not executed yet, the interval will take effect once that scheduled trigger executes. Otherwise, the trigger will be automatically scheduled based on the current input or output. See below for examples.

Set the property to 0 to disable the interval. The last scheduled trigger, if any, will still execute. If you set this from within the On Input or On Output, no new trigger will be executed.

If you manually set the trigger amount after the interval, the interval will also be canceled.

Examples:


// Assume we are at the start of the simulation
FlowObject source = model.find( "FlowSource1" );

// Fire the On Output trigger automatically at 
// an output quantity of 10, 20, 30, etc.
source.output.triggerInterval = 10;

// Cancel all those triggers, and only execute 
// manually at output quantity 15.
source.output.triggerAmount = 15;

// In addition, automatically schedule triggers 
// at quantity 15, 25, 35, etc. (This works because 
// we have previously set a trigger amount which 
// has not been reached yet.)
source.output.triggerInterval = 10;

// Still execute the next trigger at output 
// quantity 15, but cancel the events at 25, 35, etc.
source.output.triggerInterval = 0;
      
Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.close()

void close( )

Description

Block all flow input ports.

This is the FloWorks-equivalent of the FlexSim commands closeinput or closeoutput.

You should not use those FlexSim commands: calling input.close() and output.close() ensures that all flow rates in the network are recalculated while closeinput and similar functions do not.

If you want to close specific ports, use the ports property: obj.input.ports.close() or obj.output.ports[1].close().

Do no remove, this fixes the anchor on doc.flexsim.com

FlowObject.InputOutput.open()

void open( )

Description

Unblock all flow input ports.

This is the FloWorks-equivalent of the FlexSim commands openinput or openoutput.

You should not use those FlexSim commands: calling input.open() and output.open() ensures that all flow rates in the network are recalculated while openinput and similar functions do not.

If you want to close specific ports, use the ports property: obj.input.ports.open() or obj.output.ports[1].open().