Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
93e5a95d
Commit
93e5a95d
authored
May 11, 2015
by
Ulrich Kemloh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get the host name now working properly.
parent
504b98b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
7 deletions
+43
-7
matsim/HybridSimulationManager.cpp
matsim/HybridSimulationManager.cpp
+8
-6
pedestrian/AgentsSourcesManager.cpp
pedestrian/AgentsSourcesManager.cpp
+30
-1
pedestrian/AgentsSourcesManager.h
pedestrian/AgentsSourcesManager.h
+5
-0
No files found.
matsim/HybridSimulationManager.cpp
View file @
93e5a95d
...
...
@@ -54,9 +54,9 @@ HybridSimulationManager::HybridSimulationManager(const std::string& server,
_externalServerPort
=
port
;
//get the canonical hostname
//
char hostname[1024];
//
gethostname(hostname, 1024);
//
_internalServerName=std::string(hostname);
char
hostname
[
1024
];
gethostname
(
hostname
,
1024
);
_internalServerName
=
std
::
string
(
hostname
);
//GOOGLE_PROTOBUF_VERIFY_VERSION;
//grpc_init();
...
...
@@ -98,8 +98,10 @@ bool HybridSimulationManager::Run(Simulation& sim)
//string extern_service_address("zam597:9999");
string
extern_service_address
(
_externalServerName
+
":"
+
std
::
to_string
(
_externalServerPort
));
string
jupedsim_service_address
(
_internalServerName
+
":"
+
std
::
to_string
(
_internalServerPort
));
//string jupedsim_service_address("0.0.0.0:9999")/*_serverName + ":" + std::to_string(_port)*/;
///0.0.0.0 means to listen on all devices
string
jupedsim_service_address
(
"0.0.0.0:"
+
std
::
to_string
(
_internalServerPort
));
//string jupedsim_service_address(_internalServerName + ":" + std::to_string(_internalServerPort));
//string jupedsim_service_address("0.0.0.0:9998")/*_serverName + ":" + std::to_string(_port)*/;
//create the client that will be running on its own thread
...
...
@@ -124,7 +126,7 @@ bool HybridSimulationManager::Run(Simulation& sim)
Log
->
Write
(
"INFO:
\t
Notifying Matsim at "
+
extern_service_address
);
//if(false==_rpcClient->NotifyExternalService(_exinternalServerName,_internalServerPort))
if
(
false
==
_rpcClient
->
NotifyExternalService
(
"zam763"
,
_internalServerPort
))
if
(
false
==
_rpcClient
->
NotifyExternalService
(
_internalServerName
,
_internalServerPort
))
{
Log
->
Write
(
"ERROR:
\t
Notification failed"
);
}
...
...
pedestrian/AgentsSourcesManager.cpp
View file @
93e5a95d
...
...
@@ -14,6 +14,7 @@
#include "../voronoi/VoronoiDiagramGenerator.h"
#include "../geometry/Building.h"
#include "../mpi/LCGrid.h"
#include <iostream>
#include <thread>
#include <chrono>
...
...
@@ -284,11 +285,13 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
//int subroomID = dist->GetSubroomID();
// first default Position
for
(
const
auto
&
ped
:
peds
)
for
(
auto
&
ped
:
peds
)
{
//ped->Dump(ped->GetID()); continue;
int
index
=
-
1
;
AdjustVelocityUsingWeidmann
(
ped
);
//in the case a range was specified
for
(
unsigned
int
a
=
0
;
a
<
positions
.
size
();
a
++
)
{
...
...
@@ -337,6 +340,32 @@ void AgentsSourcesManager::ComputeBestPositionRandom(AgentsSource* src,
}
}
void
AgentsSourcesManager
::
AdjustVelocityUsingWeidmann
(
Pedestrian
*
ped
)
const
{
//get the density
vector
<
Pedestrian
*>
neighbours
;
_building
->
GetGrid
()
->
GetNeighbourhood
(
ped
,
neighbours
);
//pers per m2
double
density
=
1.0
;
//radius corresponding to a surface of 1m2
double
radius_square
=
0.564
*
0.564
;
for
(
const
auto
&
p
:
neighbours
)
{
if
(
(
ped
->
GetPos
()
-
p
->
GetPos
()).
NormSquare
()
<
radius_square
)
density
+=
1.0
;
}
//get the velocity
double
density_max
=
5.4
;
double
speed
=
1.34
*
(
1
-
exp
(
-
1.913
*
(
1.0
/
density
-
1.0
/
density_max
)));
//set the velocity vector
if
(
ped
->
FindRoute
()
!=-
1
)
{
}
}
void
AgentsSourcesManager
::
GenerateAgents
()
...
...
pedestrian/AgentsSourcesManager.h
View file @
93e5a95d
...
...
@@ -93,6 +93,11 @@ private:
private:
void
ComputeBestPositionVoronoi
(
AgentsSource
*
src
,
Pedestrian
*
agent
);
void
ComputeBestPositionRandom
(
AgentsSource
*
src
,
std
::
vector
<
Pedestrian
*>&
peds
)
const
;
/**
* Adjust the velocity of the pedestrian using the weidmann fundamental diagram
*/
void
AdjustVelocityUsingWeidmann
(
Pedestrian
*
ped
)
const
;
};
#endif
/* AGENTSSOURCESMANAGER_H_ */
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