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
Downloads

Q&A Using Flexsim and building models

  #1  
Old 12-20-2013
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default clock shows wrong time

Hi I´ve got a clock included in one of my bigger modells and it started to Show this times.

What am I doing wrong?
Attached Thumbnails
Click image for larger version
Name:	wrong_clock.png
Views:	113
Size:	96.4 KB
ID:	2399  
__________________
Hemmi
  #2  
Old 12-20-2013
syseo's Avatar
syseo syseo is offline
Flexsim User
 
Join Date: Aug 2007
Location: Korea
Posts: 290
Downloads: 439
Uploads: 0
Thanks: 249
Thanked 63 Times in 41 Posts
Rep Power: 211
syseo has a spectacular aura aboutsyseo has a spectacular aura about
Default Please Check your 'Model Start Time' setting.

Main menu File>Model Setting.


Check the setting of 'Model Start Time' value.
  #3  
Old 12-21-2013
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default

Thank you but didn´t work.
__________________
Hemmi
  #4  
Old 12-26-2013
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

Please send a model showing the issue to Support using www.flexsim.com/support so that we can figure out what is happening.
  #5  
Old 12-26-2013
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default

Thanks Phil, I did so. But I also can share the example here, because it doesn´t work for new models.
Maybe this problem doesn´t appear at other systems?
Attached Files
File Type: fsm Wrong_Clock.fsm (14.8 KB, 44 views)
__________________
Hemmi
  #6  
Old 12-26-2013
Carsten Seehafer's Avatar
Carsten Seehafer Carsten Seehafer is offline
FlexSim Geek
 
Join Date: Oct 2008
Location: Ritterhude, Deutschland
Posts: 230
Downloads: 45
Uploads: 1
Thanks: 474
Thanked 320 Times in 143 Posts
Rep Power: 379
Carsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud of
Default

There is a small bug in the code for "none format" time. The start time will added after the calculation of the time string

This code should solve your problem (changes are in bold letters):

Code:
treenode current = ownerobject(c);
treenode  textnode = parnode(1);
/***popup:DisplayDateTime*/
/**Display Date and Time*/
#define formatNone 0
#define formatDefault 1
#define formatCustom 2
int format = /** \nUSe Default Format: *//***tag:format*//**/formatNone/**list:formatNone~formatDefault~formatCustom*/;
switch (format) {
    case formatNone: 
        double modelunit = getmodelunitnum(TIME_MULTIPLE);
        double timeinseconds = time() * modelunit;
        timeinseconds += getmodelunitnum(START_SECOND);
        timeinseconds += getmodelunitnum(START_MINUTE)*60;
        timeinseconds += getmodelunitnum(START_HOUR)*3600;
        int cumulative = 0;
        int daynumber = (timeinseconds / (3600 * 24)) + 1;
        cumulative += (daynumber-1) * 3600 * 24;
        int hournumber = (timeinseconds - cumulative) / 3600;
        cumulative += hournumber * 3600;
        int minutenumber = (timeinseconds - cumulative) / 60;
        cumulative += minutenumber * 60;
        int secondnumber = timeinseconds  - cumulative;
        /*The code inside this comment should be removed.
        hournumber += getmodelunitnum(START_HOUR);
        minutenumber += getmodelunitnum(START_MINUTE);
        secondnumber += getmodelunitnum(START_SECOND);*/
        string hourstring = numtostring(hournumber,0,0);
        string minutestring = numtostring(minutenumber,0,0);
        string secondstring = numtostring(secondnumber,0,0);
        if (hournumber < 10) hourstring = concat("0", hourstring);
        if (minutenumber < 10) minutestring = concat("0", minutestring);
        if (secondnumber < 10) secondstring = concat("0", secondstring);
        string timetext = concat("Day ",
                    numtostring(daynumber,0,0),", ",
                    hourstring,":",
                    minutestring,":",
                    secondstring);
        setnodestr(textnode, timetext);
    break;
    case formatDefault:
        setnodestr(textnode, getmodelunitstr(CURRENT_TIME));
    break;
    case formatCustom:
        string timeformat = /** \nTime Format: *//***tag:timeformat*//**/"h:mm:ss tt"/**/;
        string dateformat = /** \nDate Format: *//***tag:dateformat*//**/"ddd d MMM yyyy"/**/;
        applicationcommand("convertunixtime", tonum(textnode), getmodelunitnum(CURRENT_TIME), timeformat, dateformat);
    break;
}
This code is also in the attached model.
Attached Files
File Type: fsm Correct_Clock.fsm (14.9 KB, 40 views)
The Following 5 Users Say Thank You to Carsten Seehafer For This Useful Post:
Tom David (01-07-2014)


Thread Thread Starter Forum Replies Last Post
Sketchup model shows wrong colors Steven Hamoen Q&A 2 02-12-2013 06:32 AM
Something wrong with my flexsim 5 Hao Zhou Q&A 3 12-01-2011 10:30 AM
Displaying simulation clock Shankar Narayan Q&A 5 11-25-2011 01:32 PM
Clock Overflow Flow Stopped Error Msg shashanktrivedi Q&A 1 06-08-2011 08:24 PM
Countdown clock E.C.Ante Q&A 4 10-10-2007 04:27 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.