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 > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 08-03-2007
Regan Blackett Regan Blackett is offline
Flexsim Consultant, Forum Moderator
 
Join Date: Jul 2007
Posts: 14
Downloads: 19
Uploads: 16
Thanks: 0
Thanked 14 Times in 6 Posts
Rep Power: 183
Regan Blackett will become famous soon enoughRegan Blackett will become famous soon enough
Default Displaying the simulation time with the various date/time formats.

This can be accomplished with the use of a VisualTool object. Simply drag a VisualTool into your model and set it display text. Under "Text Display", choose "Display Time". The code inside gives good ideas about how to display on-screen texts.

If you want to compute the week and day using code, you can do following:
Code:
double startTime = 0;
int week = (time()-startTime)/7/24/3600;
int day = (time()-startTime-7*24*3600*week)/24/3600;
In order to display week and day in the VisualTool, replace the code in the Text Display with the following:
Code:
treenode current = ownerobject(c);
treenode  textnode = parnode(1);
/**Display Time. Format - Week w, Day d*/
double startTime = 0;
int week = (time()-startTime)/7/24/3600;
int day = (time()-startTime-7*24*3600*week)/24/3600;
string timetext = 
concat(
    "Week ",
    numtostring(week,0,0),", Day ",
    numtostring(day,0,0)
);
setnodestr(textnode, timetext);
The Following 5 Users Say Thank You to Regan Blackett For This Useful Post:
stmyint (11-13-2012)
  #2  
Old 08-11-2008
Dan Cremer Dan Cremer is offline
Flexsim User
 
Join Date: Aug 2008
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Dan Cremer is on a distinguished road
Default Displaying dates

Regan:
This did not work. When I started running the model, the date did not change from "Week 0, Day 0".
  #3  
Old 08-11-2008
Pablo Concha Pablo Concha is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 104
Downloads: 100
Uploads: 1
Thanks: 103
Thanked 52 Times in 37 Posts
Rep Power: 232
Pablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nice
Default

It does work for me, code assumes you're working on seconds, so it may take a while to change days/weeks if you're running the model slow (86400 time units for each day).. you can change the 3600 on the model for 60 to work in minutes... or 1 in hours, etc...

regards,

Pablo Concha E.
The Following User Says Thank You to Pablo Concha For This Useful Post:
Dan Cremer (08-19-2008)
  #4  
Old 08-19-2008
Dan Cremer Dan Cremer is offline
Flexsim User
 
Join Date: Aug 2008
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Dan Cremer is on a distinguished road
Default THANKS

I meant to thank you sooner for your reply.
  #5  
Old 10-24-2008
JMEngelhart's Avatar
JMEngelhart JMEngelhart is offline
Flexsim User
 
Join Date: Sep 2008
Posts: 44
Downloads: 9
Uploads: 0
Thanks: 1
Thanked 7 Times in 6 Posts
Rep Power: 148
JMEngelhart is on a distinguished road
Default

How about if I want to display the Day of the week - ie: Sunday, Monday, etc.?
  #6  
Old 10-27-2008
Pablo Concha Pablo Concha is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 104
Downloads: 100
Uploads: 1
Thanks: 103
Thanked 52 Times in 37 Posts
Rep Power: 232
Pablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nice
Default

Quote:
Originally Posted by JMEngelhart View Post
How about if I want to display the Day of the week - ie: Sunday, Monday, etc.?
Hello,

I think this works... (working on minutes)....

Code:
treenode current = ownerobject(c);
treenode  textnode = parnode(1);
/**Display Time. Format - Week w, Day d*/
double startTime = 0;
int week = (time()-startTime)/7/24/60;
int day = (time()-startTime-7*24*60*week)/24/60;
string daystr;
switch(day)
{
    case 0: daystr = "Monday";break;
    case 1: daystr = "Tuesday";break;
    case 2: daystr = "Wednesday";break;
    case 3: daystr = "Thursday";break;
    case 4: daystr = "Friday";break;
    case 5: daystr = "Saturday";break;
    case 6: daystr = "Sunday";break;
}
string timetext = 
concat(
    "Week ",
    numtostring(week,0,0),", ",
    daystr
);
setnodestr(textnode, timetext);
regards,

Pablo Concha E.
The Following 3 Users Say Thank You to Pablo Concha For This Useful Post:
stmyint (11-13-2012)
  #7  
Old 10-26-2010
Albert Munoz Albert Munoz is offline
Flexsim User
 
Join Date: Sep 2010
Posts: 14
Downloads: 5
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 117
Albert Munoz is on a distinguished road
Default

Any chance you could describe how to have this display on a GUI?

Thanks
Albert
  #8  
Old 10-26-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

You can do this with a hotlinkx on a static control in a GUI.

Use setviewtext(c,timetext) instead of setnodestr(textnode, timetext)

See the attached model.
Attached Files
File Type: zip hotlinkx_static.zip (30.2 KB, 231 views)
The Following User Says Thank You to Phil BoBo For This Useful Post:
Albert Munoz (10-26-2010)
  #9  
Old 10-26-2010
Albert Munoz Albert Munoz is offline
Flexsim User
 
Join Date: Sep 2010
Posts: 14
Downloads: 5
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 117
Albert Munoz is on a distinguished road
Default

Thanks Phil,

I am having trouble opening the attached model, when I open it, the system console displayes the following message;

exception: Exception caught in flexscript execution of VIEW:/nodefunctions/menucommands/File/openmodel line 44 instruction 109. Discontinuing execution.
  #10  
Old 10-27-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

Is anyone else having this problem? The model is opening fine on my computer.

Make sure you have the latest version of the software (5.0.4).
  #11  
Old 10-27-2010
Pablo Concha Pablo Concha is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 104
Downloads: 100
Uploads: 1
Thanks: 103
Thanked 52 Times in 37 Posts
Rep Power: 232
Pablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nice
Default

no problem here, (v 5.04)

regards

Pablo Concha Erilkin
The Following User Says Thank You to Pablo Concha For This Useful Post:
Phil BoBo (10-27-2010)
  #12  
Old 10-27-2010
Albert Munoz Albert Munoz is offline
Flexsim User
 
Join Date: Sep 2010
Posts: 14
Downloads: 5
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 117
Albert Munoz is on a distinguished road
Default

Sorry, I am running on Version 5.00 in a computer where I have no admin priviledges. I have contacted the admin of the university faculty where the licenses are stored, hopefully this can be remedied soon.

Thanks
Albert
  #13  
Old 11-12-2012
Michael Herfert's Avatar
Michael Herfert Michael Herfert is offline
Flexsim User
 
Join Date: Nov 2008
Posts: 3
Downloads: 11
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Michael Herfert is on a distinguished road
Default

Hello,

through the search function I found this article. It was helpful but I have an other problem. So I´ll open this thread again.
It is possible to show the right calendar date with the visualtool?
If I will start a simulation run, for example at the 1th January 2012 - how I can show that.

Many thanks in advance for your help
regards Michael



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.