All FloWorks objects have a product type defined. FloWorks has made a deliberate choice not to transfer product types automatically from one object to the next: products only affects the product stored in or flowing through the object. This gives you, as a modeller, a great deal of flexibility. For example, you can quickly build a model in which product types are split, mixed or blended, without having to tell FloWorks anything about the densities and component mixes of your products. Of course, if you do require that level of detail, the full integration of FloWorks with all FlexSim features including Process Flow allows you to include such refinements yourself.The product type usually changes the color of the fluids in or flowing through the object, but as explained above, the color may change instantly upon entering a next object. There are a few exceptions to this rule:
FloWorks products can either be simple numbers, that you can use in any way that makes sense in your particular model; or they can be predefined products with fixed names and colors from a table that you need to fill before (or while) you create the model. The next two sections describe these two options in more detail.
When you start a new FloWorks model, product identifiers are by default positive integer numbers: FloWorks objects can have product 1, 2, 3, etc. As soon as you create the first FloWorks object in the model, a Color Palette that defines the color for each product is automatically added to the Toolbox. For more information on how to change the default color assignments, please see the documentation for the Color Palette tool.
It is possible to define a custom set of products and their colors, instead of the default numeric product IDs. You can toggle to Product Table mode in one of the following two ways:
Both of these options bring up the Products Table Editor. See the Product Editor Reference Page for more details on how to use it.
When accessing FloWorks objects through FlexScript coding, you should use the
FlowObject class (see the class reference for more information).
This class has a property
product, which can be used to request or change the current product. Note that most FloWorks objects do not automatically
change their product on reset, so if you change the product of an object during the run it will not change back to its initial product when you reset the model.
The type of the product property is a
Variant that can take the following values:
productwill always be a number. If the product is not applicable, for example because you are requesting the outflow product of an empty conveyor, the number zero will be returned. For example:
FlowObject source = model.find("FlowSource1"); source.product = 3; // Returns a Variant with numeric value 3 return source.product;
When using a user-defined product table
product will usually be a string with the product name. For example, assuming you have
defined a product called "My Product":
FlowObject source = model.find("FlowSource1"); source.product = "My Product"; // Returns a Variant with string value "My Product" return source.product;
If you are using a user-defined product table and you know the internal product ID, you can still use that in the product setter, for example you can replace the second line in the example above by
source.product = 1. If "My Product" corresponds to product ID 1, the last line will still return a Variant containing the
string value "My Product". However,
if no product in the table has internal ID 1, the last line will return a Variant with numeric value 1 and the product will be colored according to the
"All other products" color defined in the product table.
In case the product is not applicable, for example because you are requesting the outflow product of an empty conveyor, the empty variant
will be returned.
When using a user-defined product table, if necessary you can use the function
GetFlowProductId(string productName) to find the numeric
product ID corresponding to the named product. This function will return the number zero (0) if the product name is not a valid name in the table.