コード例 #1
6
ファイル: dynamictest.cpp プロジェクト: flowexpert/charon
void manualTest() {
	sout << "### Manual Test ###" << std::endl << std::endl;

	DummyDynamicInputModule modIn("input");
	DummyDynamicOutputModule modOut("output");

	modIn.in1.connect(modOut.out1);

	modIn.run();
	sout << std::endl;

	ParameterFile file;
	file.set("input.type", "DummyDynamicInputModule");
	file.set("input.length", 2);
	file.set("output.length", 2);
	file.set("input.parameters", 4);
	file.set("input.param4", 987);
	
	modIn.getMetadata().save("DummyDynamicInputModule.before.wrp");
	modOut.getMetadata().save("DummyDynamicOutputModule.before.wrp");

	modIn.prepareDynamicInterface(file);
	modIn.loadParameters(file);
	modOut.prepareDynamicInterface(file);
	
	modIn.getMetadata().save("DummyDynamicInputModule.after.wrp");
	modOut.getMetadata().save("DummyDynamicOutputModule.after.wrp");

	modOut.resetExecuted();
	sout << std::endl;

	if (modIn.connected()) {
		throw "everything is connected!";
	}

	modIn.in2.connect(modOut.out2);
	if (modIn.connected()) {
		sout << "everything is connected" << std::endl;
	}

	modIn.run();
	sout << std::endl << "### End of Test ###" << std::endl << std::endl;
}
コード例 #2
-10
Signal
BluetoothTransmitter::modulate(const Bits& input, double df) {
    Signal modOut(Ns * input.size());
    int offset = 0;
    double phase=getPhase();

    for (int i=0; i<input.size(); ++i) {
        for(int j=0; j<Ns; ++j) {
            double tt=twopi*df*(j+Ns*i)/((double)Ns);
            if (tt>twopi) { tt=fmod(tt,twopi); }
            double state = qsign(input[i])*s_qcoef[j] +
                           qsign(m_prev)*s_qcoef[j+Ns] + phase;
            modOut[offset+j] = exp(Sample(0.0,twopi* (m_hf * state)+tt));
        } // end j

        // Update phase and previous bit value
        phase += (m_prev ? -0.5 : 0.5);
        m_prev = input[i];
        offset += Ns;
    } // end i

    setPhase(phase);
    return modOut;
}