Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cla_prosim_driver
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fmg005
cla_prosim_driver
Commits
821abfc7
Commit
821abfc7
authored
May 03, 2018
by
fmg005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored method
parent
91463522
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
Realtime.cpp
Realtime.cpp
+3
-2
include/Realtime.h
include/Realtime.h
+1
-1
No files found.
Realtime.cpp
View file @
821abfc7
...
...
@@ -17,13 +17,14 @@ void Realtime::AdvanceModelTime(double time) {
m_end
=
clock
();
/* start time for the next execution */
m_real_time
=
m_start
+
(
m_next_start
*
time
);
m_next_start
=
CLOCKS_PER_SEC
*
time
;
m_real_time
=
m_start
+
m_next_start
;
/* check if simuation takes longer than expected
i.e., time = 1.0s
clocks (1s real-time equivalent) = CLOCKS_PER_SEC * time
*/
if
((
m_end
-
m_start
)
>
(
CLOCKS_PER_SEC
*
time
)
)
if
((
m_end
-
m_start
)
>
m_next_start
)
m_logger
->
error
(
"Simulation too slow"
);
/* wait until start time of next execution is reached i.e., 1s of real-time */
...
...
include/Realtime.h
View file @
821abfc7
...
...
@@ -22,7 +22,7 @@ namespace CLA {
CLA
::
LOGGER
*
m_logger
;
Config
m_cfg
;
clock_t
m_real_time
,
real_start
,
m_delta
,
m_start
,
m_end
;
clock_t
m_next_start
=
CLOCKS_PER_SEC
;
clock_t
m_next_start
;
long
m_delta_secs
;
public:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment