36 return check_and_cast<
Vast*>(simulation.getModule(
moduleID));
76 if(msg->isName(
"probeTimer")) {
81 unsigned int maxComponent = 0;
82 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
83 unsigned int count =
getComponentSize(itTopology->second.getModule()->getHandle().getKey());
84 if(count > maxComponent) {
103 double mnAverage = 0.0;
106 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
107 double AOIWidthSqr = itTopology->second.getModule()->getAOI();
108 AOIWidthSqr *= AOIWidthSqr;
109 Vector2D vastPosition = itTopology->second.getModule()->getPosition();
111 for(VTopology::iterator itI =
Topology.begin(); itI !=
Topology.end(); ++itI) {
112 if(itI != itTopology && vastPosition.
distanceSqr(itI->second.getModule()->getPosition()) <= AOIWidthSqr) {
113 SiteMap::iterator currentSite = itTopology->second.getModule()->Sites.find(itI->second.getModule()->getHandle());
114 if(currentSite == itTopology->second.getModule()->Sites.end()) {
118 drift += sqrt(currentSite->second->coord.distanceSqr(itI->second.getModule()->getPosition()));
124 mnAverage += missing;
125 if(mnMax < missing) {
132 mnAverage /= (double)
Topology.size();
134 drift /= (double)driftCount;
146 else if(msg->isName(
"plotTimer")) {
151 bool missingFound =
false;
153 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
154 double AOIWidthSqr = itTopology->second.getModule()->getAOI();
155 AOIWidthSqr *= AOIWidthSqr;
156 Vector2D vastPosition = itTopology->second.getModule()->getPosition();
157 for(VTopology::iterator itI =
Topology.begin(); itI !=
Topology.end(); ++itI) {
158 if(itI != itTopology && vastPosition.
distanceSqr(itI->second.getModule()->getPosition()) <= AOIWidthSqr) {
159 SiteMap::iterator currentSite = itTopology->second.getModule()->Sites.find(itI->second.getModule()->getHandle());
160 if(currentSite == itTopology->second.getModule()->Sites.end()) {
170 int range = (int)
Topology.begin()->second.getModule()->getAreaDimension();
171 std::stringstream oss;
172 std::string filename;
173 int simTimeInt, stellen = 1;
174 simTimeInt = (int)SIMTIME_DBL(simTime());
176 for(
int i=0; i<6; i++) {
177 if(!(simTimeInt / stellen)) {
185 filename = oss.str() +
".plot";
186 pltNetwork.open(filename.c_str(), std::ios::out);
187 pltNetwork <<
"set xrange [0:" << range <<
"]" << endl;
188 pltNetwork <<
"set yrange [0:" << range <<
"]" << endl;
192 filename = oss.str() +
".point";
193 pltData.open(filename.c_str(), std::ios::out);
195 pltNetwork <<
"plot '" << filename <<
"' using 1:2 with points pointtype 7,\\" << endl;
198 filename = oss.str() +
".arrow";
199 pltVector.open(filename.c_str(), std::ios::out);
201 pltNetwork <<
" '" << filename <<
"' using 1:2:3:4 with vectors linetype 1" << endl;
205 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
206 pltData << itTopology->second.getModule()->getPosition().x <<
"\t" << itTopology->second.getModule()->getPosition().y << endl;
212 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
213 for(SiteMap::iterator itSites = itTopology->second.getModule()->Sites.begin(); itSites != itTopology->second.getModule()->Sites.end(); ++itSites) {
215 VTopology::iterator destNode =
Topology.find(itSites->second->addr.getKey());
217 Vector2D relPos = destNode->second.getModule()->getPosition() - itTopology->second.getModule()->getPosition();
218 pltVector << itTopology->second.getModule()->getPosition().x <<
"\t" << itTopology->second.getModule()->getPosition().y <<
"\t"
219 << relPos.
x <<
"\t" << relPos.
y << endl;
223 Vector2D relPos = itSites->second->coord - itTopology->second.getModule()->getPosition();
224 pltVector << itTopology->second.getModule()->getPosition().x <<
"\t" << itTopology->second.getModule()->getPosition().y <<
"\t"
225 << relPos.
x <<
"\t" << relPos.
y << endl;
230 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
231 double AOIWidthSqr = itTopology->second.getModule()->getAOI();
232 AOIWidthSqr *= AOIWidthSqr;
233 Vector2D vastPosition = itTopology->second.getModule()->getPosition();
234 for(VTopology::iterator itI =
Topology.begin(); itI !=
Topology.end(); ++itI) {
235 if(itI != itTopology && vastPosition.
distanceSqr(itI->second.getModule()->getPosition()) <= AOIWidthSqr) {
236 SiteMap::iterator currentSite = itTopology->second.getModule()->Sites.find(itI->second.getModule()->getHandle());
237 if(currentSite == itTopology->second.getModule()->Sites.end()) {
238 Vector2D relPos = itI->second.getModule()->getPosition() - itTopology->second.getModule()->getPosition();
239 pltVector << itTopology->second.getModule()->getPosition().x <<
"\t"
240 << itTopology->second.getModule()->getPosition().y <<
"\t"
241 << relPos.
x <<
"\t" << relPos.
y <<
"\t"
242 << itTopology->second.getModule()->getParentModule()->getParentModule()->getFullName() <<
":"
243 << itTopology->second.getModule()->thisSite.addr.getKey().toString(16) <<
"\t"
244 << itI->second.getModule()->getParentModule()->getParentModule()->getFullName() <<
":"
245 << itI->second.getModule()->thisSite.addr.getKey().toString(16) << endl;
259 for(
int i=0; i<=simulation.getLastModuleId(); i++) {
260 cModule* module = simulation.getModule(i);
261 if(module && dynamic_cast<Vast*>(module)) {
262 Vast* vast = check_and_cast<
Vast*>(module);
273 for(VTopology::iterator itTopology =
Topology.begin(); itTopology !=
Topology.end(); ++itTopology) {
274 itTopology->second.visited =
false;
280 VTopology::iterator itEntry =
Topology.find(key);
281 if(itEntry !=
Topology.end() && itEntry->second.visited ==
false) {
283 itEntry->second.visited =
true;
284 Vast* vast = itEntry->second.getModule();
285 for(SiteMap::iterator itSites = vast->
Sites.begin(); itSites != vast->
Sites.end(); ++itSites) {