홍주원

change sender by HJW

Showing 31 changed files with 120 additions and 12 deletions
No preview for this file type
No preview for this file type
 sender.cpp
c:\users\ghdwn\desktop\0509_team3\constellation\constellation\sender.cpp(42): warning C4244: '=': 'double'에서 'float'(으)로 변환하면서 데이터가 손실될 수 있습니다.
c:\users\ghdwn\desktop\0509_team3\constellation\constellation\sender.cpp(43): warning C4244: '=': 'double'에서 'float'(으)로 변환하면서 데이터가 손실될 수 있습니다.
constellation_main.obj : error LNK2019: "public: void __thiscall Cchannel::AWGN(void)" (?AWGN@Cchannel@@QAEXXZ) 외부 기호(참조 위치: _main 함수)에서 확인하지 못했습니다.
constellation_main.obj : error LNK2019: "public: void __thiscall Creceiver::demodulate(void)" (?demodulate@Creceiver@@QAEXXZ) 외부 기호(참조 위치: _main 함수)에서 확인하지 못했습니다.
constellation_main.obj : error LNK2019: "public: void __thiscall Cevaluate::evaluate(void)" (?evaluate@Cevaluate@@QAEXXZ) 외부 기호(참조 위치: _main 함수)에서 확인하지 못했습니다.
C:\Users\ghdwn\Desktop\0509_team3\constellation\Debug\constellation.exe : fatal error LNK1120: 3개의 확인할 수 없는 외부 참조입니다.
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.16299.0
Debug|Win32|C:\Users\ghdwn\Desktop\0509_team3\constellation\|
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
......@@ -21,32 +21,32 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{6FF25C27-45BF-4502-A1F8-0EFB069E1515}</ProjectGuid>
<RootNamespace>constellation</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
......@@ -112,6 +112,7 @@
<ItemGroup>
<ClCompile Include="constellation_main.cpp" />
<ClCompile Include="myMatrix.cpp" />
<ClCompile Include="sender.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="channel.h" />
......
......@@ -21,6 +21,9 @@
<ClCompile Include="myMatrix.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="sender.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="sender.h">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
......@@ -15,7 +15,7 @@ void main() {
myChannel.AWGN(); // calculate r[ ]
myReceiver.r = myChannel.r;
myReceiver.demodulate(); // calculate constellation[ ], DecodedData[ ];
myEvaluator.Data = mySender.data;
myEvaluator.DecodedData = myReceiver.DecodedData;
//myEvaluator.Data = mySender.data;
//myEvaluator.DecodedData = myReceiver.DecodedData;
myEvaluator.evaluate(); // compare the original and the decoded
}
\ No newline at end of file
......
#include"sender.h"
#include<cstdlib>
using namespace std;
void Csender::transmitData() {
srand((unsigned)time(NULL));
for (int i = 0; i < Nbits; i++)
{
int random = rand() % 2;
data[i] = random;
}
for (int k = 0; k < Nbits; k = k + 2)
{
if (data[k] == 0 && data[k + 1] == 0) {
At[k / 2] = A * 1;
Bt[k / 2] = A * 1;
}
else if (data[k] == 0 && data[k + 1] == 1) {
At[k / 2] = A * 1;
Bt[k / 2] = A * -1;
}
else if (data[k] == 1 && data[k + 1] == 0) {
At[k / 2] = A * -1;
Bt[k / 2] = A * 1;
}
else if (data[k] == 1 && data[k + 1] == 1) {
At[k / 2] = A * -1;
Bt[k / 2] = A * -1;
}
}
double t;
int k = 0;
for (t = 0; t < T; t += dt)
{
c0[k] = sqrt(2. / T)*cos(2 * PI*t / T);
c1[k] = sqrt(2. / T)*sin(2 * PI*t / T);
k++;
}
for (int i = 0; i < Nbits / Nbitspersymbol; i++) {
for (int k = 0; k < Nsamplespersymbol; k++)
{
s[i * Nsamplespersymbol + k] = ((At[i] * c0[k]) + (Bt[i] * c1[k]));
}
}
for (int i = 0; i < 500; i++) {
for (int k = 0; k < 20; k++) {
Temp[k] = s[i * 20 + k];
}
matrixmult(1, 20, 1, Temp, c0, sender);
}
}
\ No newline at end of file
......@@ -5,8 +5,13 @@
class Csender {
public:
Csender() {};
char data[Nbits];
float s[Nbits/Nbitspersymbol*Nsamplespersymbol]; // trasmitted signal
int data[Nbits];
float s[Nbits / Nbitspersymbol * Nsamplespersymbol]; // trasmitted signal
void transmitData();
float At[Nbits / Nbitspersymbol], Bt[Nbits / Nbitspersymbol];
float c0[Nsamplespersymbol], c1[Nsamplespersymbol], sender[1];
float A = 10.;
float Temp[20];
double T = 20. / 1., dt = 1. / 1.;
};
#endif
......
......@@ -3,6 +3,19 @@
#define Nbits 1000 // number of transmitted bits
#define Nsamplespersymbol 20
#define Nbitspersymbol 2 // QPSK
#define Eb 40 // fixed
#define No 4 // at SNR = 20dB, variable
#define Eb 40 // fixed ;
#define No 4 // at SNR = 20dB, variable
#define PI 3.141592
//#define A 5;
#include"myMatrix.h"
#include<fstream>
#include<iterator>
#include<random>
#include <iostream>
#include<cstdlib>
#include<ctime>
#include<time.h>
#include<stdlib.h>
#include<math.h>
#endif
......