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 03-04-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 136
ankus d is on a distinguished road
Post On Model Open after set make all code C++ ??

Hi all ...
I have problem with my model.

I built a bit large model. and to run it in "On Open model" i wrote command.
because very slow....then i set my model "Make all code c++", after that my model run faster than before.

But, after i wrote code in "On Open model", and then open model..flexsim gave me warning to compile first..

The problem of my model can be seen on the attached file.

How to handle this and avoid compile when i open model..? any ideas?

Thanks in advance
Ankus
Attached Thumbnails
Click image for larger version

Name:	OnModelOpen.JPG
Views:	247
Size:	174.6 KB
ID:	587  
Reply With Quote
  #2  
Old 03-04-2009
tobias.biemueller tobias.biemueller is offline
Flexsim User
 
Join Date: Aug 2007
Location: Bielefeld, Germany
Posts: 42
Downloads: 22
Uploads: 0
Thanks: 23
Thanked 18 Times in 16 Posts
Rep Power: 162
tobias.biemueller is on a distinguished road
Default

Hi Ankus,

if you choose the option "Make all code c++" then its necessary to compile.
There is no possibility to avoid this with c++. After each programming you have to compile first, before you can run the model.

If you dont want to compile, then you must turn all into flexscript.

Hope i understand it right and it helps you a little bit

Best regards
Tobias
Reply With Quote
  #3  
Old 03-04-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 136
ankus d is on a distinguished road
Default

The problem is if i turn into flexscript, the run of my model is very very slow, compare with C++ ( very fast).

Moreover, i will run my model several times, so the speed is very important.

So, i wonder if there is a way to run model in C++ but we no need to compile first..?
Reply With Quote
  #4  
Old 03-04-2009
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: 682
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

He Ankus,

There is a way around it by putting your C++ code in a DLL. Then you don't have to compile but you have your code in C++. Check out the wiki articles Forum about Creating DLL's that attach to Flexsim.

Steven
Reply With Quote
  #5  
Old 03-04-2009
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

If you don't want to go the DLL route you can just automate the compile stage when the model loads - rather than avoid it. To do this you need to keep the OnModelLoad node as Flexscript and locate your C++ code in another node - maybe in a userfunction toggled as C++. Then have the following as the OnModelLoad code text:

Code:
 
if (getnodenum(node("MAIN:/1/1/13"))){
      cmdcompile();
}
else{
     myOnModelLoadUserfunction();  //containing your C++ code
}
If you change the C++ code in you model you will of course still need to recompile. Don't forget you can also have a mixture of C++ and Flexscript toggled nodes in a model, so only the time critical ones might have to be toggled C++ or indeed DLL.

Jason
Reply With Quote
The Following 5 Users Say Thank You to Jason Lightfoot For This Useful Post:
ankus d (03-05-2009), Brandon Peterson (03-05-2009), Carsten Seehafer (03-06-2009), Phil BoBo (03-04-2009), Steven Hamoen (03-04-2009)
  #6  
Old 03-05-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 136
ankus d is on a distinguished road
Default

Jason..

Could you mind, give me a simple example model ?
Thanks..
Reply With Quote
  #7  
Old 03-05-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 136
ankus d is on a distinguished road
Default

I tried as Jason said..

when i open model, compiling project is executed automatically, but after that, nothing happen.

My function in user command(named "myOnModelLoadUser") to run model did'nt executed. I dont know is it right or not..

Need help... Hope someone can help me..
Attached Thumbnails
Click image for larger version

Name:	OnModelLoad.JPG
Views:	224
Size:	121.6 KB
ID:	590  
Reply With Quote
  #8  
Old 03-05-2009
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

Ankus, I'm sorry it looks like OnModelOpen only fires once when the model is opened. This is unlike the OnLoad nodes we've used in the past (before this version of model triggers were made available) which also fired when the model had compiled. This is my mistake. If you put the user command call into the OnPost-Compile part of the Model Triggers instead, it will work as you intended.

Sorry for the confusion.

Jason

Last edited by Jason Lightfoot; 03-05-2009 at 08:39 AM.
Reply With Quote
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
ankus d (03-05-2009), Phil BoBo (03-05-2009)
  #9  
Old 03-05-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 136
ankus d is on a distinguished road
Default

Thanks Jason...
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
error:Unable to open storage set. make sure the file exists. qin tian Q&A 3 11-17-2008 01:05 PM
Working model not saved when we "Open" model David Chan Gripes and Goodies 0 08-21-2008 03:10 AM
Make sure you stop model with the stop button before collecting state based statistics Paul Dowling Tips and Tricks 2 06-10-2008 08:10 AM
How to get a full path of the current open Flexsim model file. Regan Blackett Tips and Tricks 7 04-17-2008 10:39 AM
Model Startup Code Lolke Koopmans Q&A 4 12-14-2007 09:51 AM


All times are GMT -6. The time now is 11:40 PM.


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