홍주원

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