Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmt-core
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ecomod
zmt-core
Commits
28363487
Commit
28363487
authored
8 years ago
by
Christian Meyer
Browse files
Options
Downloads
Patches
Plain Diff
ZmtSimState.java: added createStatusMessage method
parent
de19e789
No related branches found
Branches containing commit
Tags
0.17.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/sim/engine/ZmtSimState.java
+25
-0
25 additions, 0 deletions
src/main/java/sim/engine/ZmtSimState.java
with
25 additions
and
0 deletions
src/main/java/sim/engine/ZmtSimState.java
+
25
−
0
View file @
28363487
...
...
@@ -3,6 +3,7 @@ package sim.engine;
import
java.io.IOException
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.text.NumberFormat
;
import
java.util.Optional
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -27,10 +28,34 @@ public abstract class ZmtSimState extends SimState {
/** Default directory to write simulation output. */
public
static
final
Path
DEFAULT_OUTPUT_DIR
=
Paths
.
get
(
"output"
);
/** {@link NumberFormat} for simulation step rates. */
private
static
final
NumberFormat
RATE_FORMAT
;
static
{
RATE_FORMAT
=
NumberFormat
.
getInstance
();
RATE_FORMAT
.
setMaximumFractionDigits
(
5
);
RATE_FORMAT
.
setMinimumIntegerDigits
(
1
);
}
public
ZmtSimState
(
long
seed
)
{
super
(
seed
);
}
/**
* Creates a message to inform about the current status of the running
* simulation. The default contains steps, time and rate. Can be called by
* the simulation runner. Child classes may override the method to create
* their own version.
*
* @param stepRatePerS
* the rate of steps per second measured by the simulation runner
* @return the created status message
*/
public
String
createStatusMessage
(
double
stepRatePerS
)
{
return
"Steps: "
+
schedule
.
getSteps
()
+
" Time: "
+
schedule
.
getTimestamp
(
"At Start"
,
"Done"
)
+
" Rate: "
+
RATE_FORMAT
.
format
(
stepRatePerS
)
+
" steps/s"
;
}
/**
* Gets the output object of this simulation. Defaults to an empty
* {@link Optional}, can be overridden in sub classes. The returned object
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment