I want to check if a port is open or closed. I have tried to use the command "outputopen" but it doesn't seem to work. I guess it only works when the symbol is red or green and not both? Is there any other command that works better?
I want to check if a port is open or closed. I have tried to use the command "outputopen" but it doesn't seem to work. I guess it only works when the symbol is red or green and not both? Is there any other command that works better?
If you want to check the status of an input port, you can do that either of two ways. You said you used "outputopen" with no success. If you were using that to check the status of an input port, you're right, it doesn't work. That command is used to check the status of an output port.
You can use "inputopen(obj)", which will return a zero if the port has been closed using the closeinput() command. Or it will return a 1 if it is open (no red bar).
You can use "ipopen(obj)", which will check the status of a specific port number. But, this is the "internal" status of the port (no red bar). It will return a 1 if the specified port is open (green triangle) regardless of whether or not there is a red bar (closed by code). Or it will return zero if the internal status of the port is closed (red triangle).
I've attached a sample model where in the bottom portion of the screen are 4 Script tabs. If you select a tab and press the green > icon, it will execute the code shown. By executing these snippets of code, you can see how it affects the model and the return values on tabs 3 and 4.
3 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved