ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 04-17-2013
Abdul Mirza Abdul Mirza is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 13
Downloads: 0
Uploads: 0
Thanks: 5
Thanked 1 Time in 1 Post
Rep Power: 92
Abdul Mirza is on a distinguished road
Default How to close ports of an object when a condition is true on another object?

Hi All,

I am working with fluid objects. In my model I am trying to close one of the output ports of a reservoir (Machine 1). When one of the tanks is full(Machine 2).


I know I can use closeop() method in Machine 2 when it becomes full.

But my problem is when I do that it gives me an error saying unknown Variable Machine 1.

I have attached the code below. Any advice will be much appreciated.

Code:
treenode current = ownerobject(c);
int mode = parval(1); // 1 = rising, 2 = falling

#define rising 1
#define falling 2
#define either mode

{ //************* PickOption Start *************\\

/**Open or Close Ports*/
/** \nFluid Mode: */
int curmode = /**/rising/**list:rising~falling~either*/;
/** \nObject: */
treenode involved = /**/current/**/;

if (mode == curmode)
{
/** \nAction: */ /**/closeinput(involved)/**closing reservoir port*/;

closeop(Machine1, 1); /**closing output port at Machine 1*/

}

/**\n\n*/
return 1;




} //******* PickOption End *******\\
Reply With Quote
  #2  
Old 04-17-2013
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 771
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

You must first set up the treenode variable Machine1. The usual options are:
  1. A global variable called Machine1.
  2. A local treenode variable referring to the object through:
    • port connection : eg. outobject(current,1) or centerobject(current,3)
    • model path : eg. node("/Machine1",model()) or node("/container/Machine1",model());
    • relative path : eg. node("../Machine1",current);
Reply With Quote
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Abdul Mirza (04-17-2013)
  #3  
Old 04-17-2013
Abdul Mirza Abdul Mirza is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 13
Downloads: 0
Uploads: 0
Thanks: 5
Thanked 1 Time in 1 Post
Rep Power: 92
Abdul Mirza is on a distinguished road
Default

Thanks Jason appreciate the help.

I was able to use inObject(current,1) method. As it Machine1 was the predecessor to the object I was calling that trigger.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to condition the opening/stoping of a conveyor port? Ayoub EL BOUCHTILI Flexsim Student Forum 2 01-22-2013 02:30 PM
Object as a subnode to another object.. Nischith Kashyap Q&A 1 05-06-2011 01:12 AM
RE: Change the rank of output ports of a object using flexscript gadirajus Q&A 3 04-21-2011 02:44 PM
send a flowitem from a mobile object to another mobile object KelvinHo Q&A 5 03-03-2010 08:24 AM
Transfer a mobile object by another mobile object KelvinHo Q&A 7 07-17-2008 09:32 AM


All times are GMT -6. The time now is 08:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.