Cancel
Showing results for 
Search instead for 
Did you mean: 

Formate for time in methods

Valued Contributor
Valued Contributor

Hello.

 

since the regular writing formate of time does not work in methods
(example, for 8 hours 8:00:00:0000) because the ":" is not accepted;
I do not use the colon ( : ), so my time looks like 80000, (or 0800 
or 08 00 00 0000)and its a bit confusing how many "zeros"
I actually need, and how SimPlant is reading it, digit-wise.

Thanks for help ;-)

10 REPLIES

Betreff: Formate for time in methods

Gears Phenom Gears Phenom
Gears Phenom

I'm not sure I understand what exactly you're trying to do. Defining a time-variable in a method for 8hr could be done like this, e.g.:

grafik.png

So what do you mean with ":" is not accepted?

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
Highlighted

Betreff: Formate for time in methods

Valued Contributor
Valued Contributor

He is giving me a syntax error warning for line 11 if I do it that way.
That is why I was asking. It will be red and not usable if I use a colon ( : ).syntax.PNG

Betreff: Formate for time in methods

Gears Phenom Gears Phenom
Gears Phenom
What PlantSimulation version do you use?
____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: Formate for time in methods

Valued Contributor
Valued Contributor

Version 11 (64bit).

Betreff: Formate for time in methods

Gears Phenom Gears Phenom
Gears Phenom

why? Smiley Very Happy So the third option with directly using the ":" was introduced in Plant Simulation 14 (or maybe 13.2 or something, I don't use those). In Plant 11 you can only use the first 2 options (using str_to_time or entering the time in seconds); does that still solve your problem?

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: Formate for time in methods

Valued Contributor
Valued Contributor

since I defined it as time above already, he is complaining if I convert again.
I put in the 8 00 0000 (without spaces) for eight hours and at least he formally does not complain.
Or do I have to type 8 x 3600 to get the numerically correct value?

Betreff: Formate for time in methods

Phenom
Phenom

8 * 3600  equals 8 h

 

 

 

Betreff: Formate for time in methods

Gears Phenom Gears Phenom
Gears Phenom

@Hannes821  schrieb:

since I defined it as time above already, he is complaining if I convert again.


That should not happen, if you do it like I showed in my first post; if your variable (on the left) is really of type "time" and then you assign str_to_time("8:00:00") to it, then this must be valid code.

 


@Hannes821  schrieb:

I put in the 8 00 0000 (without spaces) for eight hours and at least he formally does not complain.
Or do I have to type 8 x 3600 to get the numerically correct value?


As shown in my first post, you must use 8x3600! What you put in there equals ~92 days (because it simply means 8000000 seconds).

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: Formate for time in methods

Valued Contributor
Valued Contributor

To the first part, maybe this picture illustrates why it is not a valid input;
2.PNGnot working3.PNGnot working4.PNGworking, thank you

to the second part, thank you, this solved the problem.
Now I finally know how to (in which formate/ shape to) insert time. Thank you.