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 > Flexsim Student Forum
Downloads

Flexsim Student Forum Forum for discussion for Flexsim Students using the Flexsim Textbook.

  #1  
Old 10-08-2012
Elasius Elasius is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 5
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Elasius is on a distinguished road
Exclamation Problems with execution of Trigger after program starts.

Hello, I study computer sience and I work on a plugin based model transformation system.

This system contains a plugin to export models to Flexsim 4. By using a Flexsim 4 compatible xml-format. (It is neccessary that I stay at Version 4!)

It actually works very well.

The basic flexsim elements are edited by creating and editing correxponding xml-nodes. For example i define an OnExit-Trigger for the Flexsim-Element.

Therefore I copied and pasted an example in flexsim script into the corresponding xml-structure. The xml-Node then for example looks like this:

The attempt of the trigger is to open the input side of the grandparent-element.

Code:
<node>
    <version>2</version>
    <flags>66</flags>
    <name>
        <![CDATA[exittrigger]]>
    </name>
    <datatype>2</datatype>
    <branch>1</branch>
    <flagsex>16384</flagsex>
    <indexcache>0</indexcache>
    <data>
<![CDATA[treenode item = parnode(1);
treenode current = ownerobject(c);
int port = parval(2);
{ //************* PickOption Start *************\\
/**Close and Open Ports*/
/** 
The action will be performed if some condition is true (equal to 1).*/
if(/** \nCondition: */ /**/content(current) < 2/**/)
{
/** 
Action: */ /**/openinput/**list:closeinput~openinput~stopinput~resumeinput~closeoutput~openoutput~stopoutput~resumeoutput*/
(
/** 
Object: */ /**/inobject(inobject(current,1),1)/**/
);
}
/**\n\nWarning: It is better to send a delayed message to open or resume the ports of the current object!*/
/**\n\n*/
} //******* PickOption End *******\\
]]>
    </data>
    <node>
        <version>2</version>
        <flags>64</flags>
        <name>
            <![CDATA[]]>
        </name>
        <datatype>0</datatype>
        <branch>0</branch>
        <flagsex>0</flagsex>
        <size>0</size>
    </node>
</node>
If I start Flexsim 4 with the generated model. I see everything, but during the simulation, the trigger is not executed.

Can anybody explain, why the trigger is ignored during the simulation?

If I then open the Element-properties in Flexsim and if I search the trigger, it is set and well-defined. If then I close the properties-dialog, the trigger works.

Maybe I forgot to define in the xml-Structure, that the trigger is ready to be executed? But I dont know how to do so...

The attachement contains a Flexsim 4 compatible XML-Structure.
Attached Files
File Type: zip ModesSimple_corrected.zip (50.3 KB, 131 views)
  #2  
Old 10-08-2012
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Have you tried with the buildall() command? This builds all the flexscript nodes again. You could try this in the script window after you have loaded your xml file to see if it does the trick.

Or after the properties are closed, is your node now toggled as flexscript so is that what is failing? (your node looks like a square with an "S" inside instead of a simple round ball)
  #3  
Old 10-08-2012
Elasius Elasius is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 5
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Elasius is on a distinguished road
Default

Thanks, but that does not work at all.

After generating the model the end user should open it in flexsim and this should be ready, to work with.

Ideally the user dont need to type and execute a single command to run the simulation with the full power of all Triggers.

I would assume, that the subnode "node" does require some Contents, but what?

Do you have an idea?

Quote:
your node looks like a square with an "S" inside instead of a simple round ball
Whether the shown trigger is senseless or not. That does not care.
  #4  
Old 10-08-2012
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

If you open a model you can execute any command you want. So for now I'm just trying to find what the problem is. Usually if the code doesn't work upfront, but does work after you opened the properties tabpage it is the fact that the properties toggle the node as flexscript.

Have you saved your model as xml after the trigger worked and look at the differences?
I have attached a picture showing you toggled and non toggled nodes. I don't have version 4 on my pc anymore so I can't tell what should be in the subnode
Attached Thumbnails
Click image for larger version
Name:	FlexsimNodes.jpg
Views:	191
Size:	21.7 KB
ID:	1943  
  #5  
Old 10-08-2012
Elasius Elasius is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 5
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Elasius is on a distinguished road
Default

Save as xml is not possible for my "educational license".

My possibilities are not sufficent. A already send a request to upgrate my license. I am still waiting for response.

Maybe you or someone else can do this job for me ??

E.g. open my attached model in Flexsim 4.5 (! - our programm only works with this version) and toggle, as you said, every Trigger by opening, and closing the Flexscript Editor for my defined triggers. After doing that for each Element, save as xml and attache the resulting file to this thread, so that I can do the neccessary comparisons?

This would be very helpfull and I would be very gratefull.
  #6  
Old 10-08-2012
Elasius Elasius is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 5
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Elasius is on a distinguished road
Default

OK Maybe it also works with a newer Version of Flexsim.

So if you or anybody else can build a simple model with the basic elements: source, processor and sink and define a sample OnExit-trigger. Then save it as XML and attache it to this thread.

Maybe I can then compare the results with the results of my Flexsim-Version.
  #7  
Old 10-08-2012
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Here is a simple model in version 5.1.2 with a source, processor and sink and a msg on the onexit of the processor
Attached Files
File Type: zip SimpleModelAsXML.zip (36.1 KB, 432 views)
  #8  
Old 10-08-2012
Elasius Elasius is offline
Flexsim User
 
Join Date: Jul 2012
Posts: 5
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Elasius is on a distinguished road
Default

Thanks a lot. In my example the subnodes are missing.

Code:
<node>
     <version>2</version>
     <flags>66</flags>
     <name>
         <![CDATA[exittrigger]]>
     </name>
     <datatype>2</datatype>
     <branch>1</branch>
     <flagsex>16384</flagsex>
     <indexcache>0</indexcache>
     <data> 
<![CDATA[treenode item = parnode(1); treenode current = ownerobject(c); int port = parval(2);  { //************* PickOption Start *************\\  /**Close and Open Ports*/ /**  The action will be performed if some condition is true (equal to 1).*/ if(/** \nCondition: */ /**/content(current) < 2/**/) { /**  Action: */ /**/openinput/**list:closeinput~openinput~stopinput~resumeinput~closeoutput~openoutput~stopoutput~resumeoutput*/ ( /**  Object: */ /**/inobject(inobject(current,1),1)/**/ ); } /**\n\nWarning: It is better to send a delayed message to open or resume the ports of the current object!*/ /**\n\n*/  } //******* PickOption End *******\\   ]]> 
    </data>
     <node>
         <version>2</version>
         <flags>64</flags>
         <name>
             <![CDATA[]]>
         </name>
         <datatype>0</datatype>
         <branch>0</branch>
         <flagsex>0</flagsex>
         <size>1</size>
        <node>
                <version>2</version>
                <flags>66</flags>
                <name><![CDATA[]]>
                </name>
                <datatype>2</datatype>
                <branch>0</branch>
                <flagsex>131072</flagsex>
                <data><![CDATA[°]]>
                </data>
        </node>
     </node>
 </node>
Now it works! Thanks alot!

Last edited by Elasius; 10-08-2012 at 05:36 AM. Reason: end of lines ignored


Thread Thread Starter Forum Replies Last Post
Unexpected program stop George Serhan Q&A 6 01-26-2012 09:03 AM
Trigger OnModelClose ? Carsten Seehafer Q&A 1 12-14-2011 08:50 AM
How to Interlinking between 2 flexsim program? smin Jeon Q&A 3 07-11-2011 08:22 AM
On Message Trigger Anthony Timmiss Q&A 19 08-13-2008 08:20 AM
Entry trigger mallik Q&A 4 01-25-2008 07:18 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.