uint64_t scenario2(uint64_t hoppingPeriod, uint64_t beaconningPeriod, size_t /*beaconCount*/, float /*senseBW*/) { uint64_t band_start = 2.3995e9; uint64_t band_end = 2.5125e9; float band1 = band_start + (rand_cmwc() % ((band_end - band_start) / 1000000)) * 1e6; float band2 = band_start + (rand_cmwc() % ((band_end - band_start) / 1000000)) * 1e6; /*std::cout << "Band1: " << band1 / 1e6; std::cout << ", Band2: " << band2 / 1e6 << std::endl;*/ HoppingPattern hp1(1000e3, Band(band_start, band_end), 1.1e6, HoppingPattern::LINEAR, 1e3); hp1.addAvailableEntry(Band(band1, band1+1e6), 0.0, 0.4); hp1.addAvailableEntry(Band(band2, band2+1e6), 0.5, 0.4); CogNode n1(42, 0, 0, beaconningPeriod, hp1, 1); HoppingPattern hp2(60e6, Band(band_start, band_end), 1.1e6, HoppingPattern::RANDOM, hoppingPeriod, 1e6); CogNode n2(43, 0, 0, 10e3, hp2, 1); CogNode *nodes[] = { &n1, &n2 }; size_t nodesCount = sizeof(nodes) / sizeof(CogNode *); while (true) { uint64_t next = -1; for (size_t i = 0; i < nodesCount; i++) { uint64_t nodeNext = nodes[i]->usUntilNextOperation(); if (nodeNext < next) next = nodeNext; } //std::cout << "next = " << next << std::endl; // FIXME? If a node jumps to a frequency, it won't be able to // receive a message until the next tick change. That's pretty // much what we get in real life though :s for (size_t i = 0; i < nodesCount; i++) { nodes[i]->addTicks(next); if (n2.hasNeighbour(42)) { return n2.ticksSinceStart(); } } } //std::cout << std::endl; }
void ChaoticUnison::setup(){ ofDisableLighting(); ofDisableAlphaBlending(); cout<<"setup chaos!"<<endl; bands.clear(); for(int i = 1; i< NUM_BANDS+1;i++){ bands.push_back(Band(i*50)); } }
void FilterBank::addBand(int band_id, const IirFilter& filter) { bands_.push_back(Band(band_id, filter)); }