백승재

com

No preview for this file type
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 +
2 +Microsoft Visual Studio Solution File, Format Version 12.00
3 +# Visual Studio 14
4 +VisualStudioVersion = 14.0.25420.1
5 +MinimumVisualStudioVersion = 10.0.40219.1
6 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "constellation", "constellation\constellation.vcxproj", "{6FF25C27-45BF-4502-A1F8-0EFB069E1515}"
7 +EndProject
8 +Global
9 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 + Debug|x64 = Debug|x64
11 + Debug|x86 = Debug|x86
12 + Release|x64 = Release|x64
13 + Release|x86 = Release|x86
14 + EndGlobalSection
15 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x64.ActiveCfg = Debug|x64
17 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x64.Build.0 = Debug|x64
18 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x86.ActiveCfg = Debug|Win32
19 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x86.Build.0 = Debug|Win32
20 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x64.ActiveCfg = Release|x64
21 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x64.Build.0 = Release|x64
22 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x86.ActiveCfg = Release|Win32
23 + {6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x86.Build.0 = Release|Win32
24 + EndGlobalSection
25 + GlobalSection(SolutionProperties) = preSolution
26 + HideSolutionNode = FALSE
27 + EndGlobalSection
28 +EndGlobal
This diff could not be displayed because it is too large.
1 + constellation.vcxproj -> C:\Users\Booruruk\AppData\Roaming\SPB_16.6\desktop\constellation\Debug\constellation.exe
2 + constellation.vcxproj -> C:\Users\Booruruk\AppData\Roaming\SPB_16.6\desktop\constellation\Debug\constellation.pdb (Partial PDB)
1 +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
2 +Debug|Win32|C:\Users\Booruruk\AppData\Roaming\SPB_16.6\desktop\constellation\|
No preview for this file type
No preview for this file type
No preview for this file type
1 +#ifndef __CHANNEL
2 +
3 +#define __CHANNEL
4 +#include <cmath>
5 +#include <random>
6 +#include "variables.h"
7 +class Cchannel {
8 +public:
9 + Cchannel();
10 + float *s; // trasmitted signal
11 + float r[Nbits]; // corrupted signal
12 + float noise[Nbits];
13 + void AWGN();
14 +};
15 +
16 +Cchannel::Cchannel()
17 +{
18 + default_random_engine generator;
19 + normal_distribution<double> myGauss(0, No/2);
20 + for (int i = 0; i < Nbits; i++)
21 + noise[i] = myGauss(generator);
22 +}
23 +
24 +void Cchannel::AWGN()
25 +{
26 + for (int i = 0; i < Nbits; i++)
27 + r[i] = s[i] + noise[i];
28 +}
29 +#endif
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup Label="ProjectConfigurations">
4 + <ProjectConfiguration Include="Debug|Win32">
5 + <Configuration>Debug</Configuration>
6 + <Platform>Win32</Platform>
7 + </ProjectConfiguration>
8 + <ProjectConfiguration Include="Release|Win32">
9 + <Configuration>Release</Configuration>
10 + <Platform>Win32</Platform>
11 + </ProjectConfiguration>
12 + <ProjectConfiguration Include="Debug|x64">
13 + <Configuration>Debug</Configuration>
14 + <Platform>x64</Platform>
15 + </ProjectConfiguration>
16 + <ProjectConfiguration Include="Release|x64">
17 + <Configuration>Release</Configuration>
18 + <Platform>x64</Platform>
19 + </ProjectConfiguration>
20 + </ItemGroup>
21 + <PropertyGroup Label="Globals">
22 + <ProjectGuid>{6FF25C27-45BF-4502-A1F8-0EFB069E1515}</ProjectGuid>
23 + <RootNamespace>constellation</RootNamespace>
24 + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
25 + </PropertyGroup>
26 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
28 + <ConfigurationType>Application</ConfigurationType>
29 + <UseDebugLibraries>true</UseDebugLibraries>
30 + <PlatformToolset>v140</PlatformToolset>
31 + <CharacterSet>MultiByte</CharacterSet>
32 + </PropertyGroup>
33 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34 + <ConfigurationType>Application</ConfigurationType>
35 + <UseDebugLibraries>false</UseDebugLibraries>
36 + <PlatformToolset>v140</PlatformToolset>
37 + <WholeProgramOptimization>true</WholeProgramOptimization>
38 + <CharacterSet>MultiByte</CharacterSet>
39 + </PropertyGroup>
40 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
41 + <ConfigurationType>Application</ConfigurationType>
42 + <UseDebugLibraries>true</UseDebugLibraries>
43 + <PlatformToolset>v140</PlatformToolset>
44 + <CharacterSet>MultiByte</CharacterSet>
45 + </PropertyGroup>
46 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
47 + <ConfigurationType>Application</ConfigurationType>
48 + <UseDebugLibraries>false</UseDebugLibraries>
49 + <PlatformToolset>v140</PlatformToolset>
50 + <WholeProgramOptimization>true</WholeProgramOptimization>
51 + <CharacterSet>MultiByte</CharacterSet>
52 + </PropertyGroup>
53 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
54 + <ImportGroup Label="ExtensionSettings">
55 + </ImportGroup>
56 + <ImportGroup Label="Shared">
57 + </ImportGroup>
58 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
59 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
60 + </ImportGroup>
61 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
62 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
63 + </ImportGroup>
64 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
65 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
66 + </ImportGroup>
67 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
68 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
69 + </ImportGroup>
70 + <PropertyGroup Label="UserMacros" />
71 + <PropertyGroup />
72 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
73 + <ClCompile>
74 + <WarningLevel>Level3</WarningLevel>
75 + <Optimization>Disabled</Optimization>
76 + <SDLCheck>true</SDLCheck>
77 + </ClCompile>
78 + </ItemDefinitionGroup>
79 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
80 + <ClCompile>
81 + <WarningLevel>Level3</WarningLevel>
82 + <Optimization>Disabled</Optimization>
83 + <SDLCheck>true</SDLCheck>
84 + </ClCompile>
85 + </ItemDefinitionGroup>
86 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
87 + <ClCompile>
88 + <WarningLevel>Level3</WarningLevel>
89 + <Optimization>MaxSpeed</Optimization>
90 + <FunctionLevelLinking>true</FunctionLevelLinking>
91 + <IntrinsicFunctions>true</IntrinsicFunctions>
92 + <SDLCheck>true</SDLCheck>
93 + </ClCompile>
94 + <Link>
95 + <EnableCOMDATFolding>true</EnableCOMDATFolding>
96 + <OptimizeReferences>true</OptimizeReferences>
97 + </Link>
98 + </ItemDefinitionGroup>
99 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
100 + <ClCompile>
101 + <WarningLevel>Level3</WarningLevel>
102 + <Optimization>MaxSpeed</Optimization>
103 + <FunctionLevelLinking>true</FunctionLevelLinking>
104 + <IntrinsicFunctions>true</IntrinsicFunctions>
105 + <SDLCheck>true</SDLCheck>
106 + </ClCompile>
107 + <Link>
108 + <EnableCOMDATFolding>true</EnableCOMDATFolding>
109 + <OptimizeReferences>true</OptimizeReferences>
110 + </Link>
111 + </ItemDefinitionGroup>
112 + <ItemGroup>
113 + <ClCompile Include="constellation_main.cpp" />
114 + </ItemGroup>
115 + <ItemGroup>
116 + <ClInclude Include="channel.h" />
117 + <ClInclude Include="evaluate.h" />
118 + <ClInclude Include="receiver.h" />
119 + <ClInclude Include="sender.h" />
120 + <ClInclude Include="variables.h" />
121 + </ItemGroup>
122 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
123 + <ImportGroup Label="ExtensionTargets">
124 + </ImportGroup>
125 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="소스 파일">
5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7 + </Filter>
8 + <Filter Include="헤더 파일">
9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10 + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11 + </Filter>
12 + <Filter Include="리소스 파일">
13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15 + </Filter>
16 + </ItemGroup>
17 + <ItemGroup>
18 + <ClCompile Include="constellation_main.cpp">
19 + <Filter>소스 파일</Filter>
20 + </ClCompile>
21 + </ItemGroup>
22 + <ItemGroup>
23 + <ClInclude Include="sender.h">
24 + <Filter>헤더 파일</Filter>
25 + </ClInclude>
26 + <ClInclude Include="variables.h">
27 + <Filter>헤더 파일</Filter>
28 + </ClInclude>
29 + <ClInclude Include="channel.h">
30 + <Filter>헤더 파일</Filter>
31 + </ClInclude>
32 + <ClInclude Include="receiver.h">
33 + <Filter>헤더 파일</Filter>
34 + </ClInclude>
35 + <ClInclude Include="evaluate.h">
36 + <Filter>헤더 파일</Filter>
37 + </ClInclude>
38 + </ItemGroup>
39 +</Project>
...\ No newline at end of file ...\ No newline at end of file
1 +#include <iostream>
2 +using namespace std;
3 +#include "sender.h"
4 +#include "channel.h"
5 +#include "receiver.h"
6 +#include "evaluate.h"
7 +#include<fstream>
8 +
9 +void main() {
10 + Csender mySender;
11 + Cchannel myChannel;
12 + Creceiver myReceiver;
13 + Cevaluate myEvaluator;
14 +
15 + mySender.transmitData(); // generate data[ ], s[ ]
16 + myChannel.s = mySender.s;
17 + myChannel.AWGN(); // calculate r[ ]
18 + myReceiver.r = myChannel.r;
19 + myReceiver.demodulate(); // calculate constellation[ ], DecodedData[ ];
20 + myEvaluator.Data = mySender.data;
21 + myEvaluator.DecodedData = myReceiver.DecodedData;
22 + //myEvaluator.evaluate(); // compare the original and the decoded
23 +
24 + ofstream fp("1.txt");
25 + for (int i = 0; i < Nbits; i += 2) {
26 + fp << (int)mySender.data[i] << "\t" << (int)mySender.data[i+1] << "\t" << mySender.s[i] << "\t" << mySender.s[i+1] << "\t" << myChannel.r[i] << "\t" << myChannel.r[i+1] << "\t" << (int)myReceiver.DecodedData[i] << "\t" << (int)myReceiver.DecodedData[i+1] << endl;
27 + //fp << myChannel.noise[i] << "\t" << myChannel.noise[i + 1] << endl;
28 +
29 + }
30 + system("pause");
31 +}
...\ No newline at end of file ...\ No newline at end of file
1 +#ifndef __EVALUATE
2 +
3 +#define __EVALUATE
4 +#include <cmath>
5 +#include "variables.h"
6 +class Cevaluate {
7 +public:
8 + Cevaluate() {};
9 + char *DecodedData; // from the receiver
10 + char *Data; // from the sender
11 + void evaluate();
12 +};
13 +
14 +void Cevaluate::evaluate()
15 +{
16 + for (int i = 0; i < Nbits; i++)
17 + {
18 + if (DecodedData[i] == Data[i])
19 + cout << 1 << endl;
20 + else
21 + cout << 0 << endl;
22 + }
23 +}
24 +#endif
1 +#include <iostream>
2 +#include "myMatrix.h"
3 +using namespace std;
4 +void scalarmult(int n, int m, float a, float *b, float *c){
5 + int N = n*m;
6 + for(int i=0;i<N;i++) c[i] = a*b[i];
7 +}
8 +void matrixadd(int n, int m, float *a, float *b, float *c){
9 + int N = n*m;
10 + for (int i = 0; i<N; i++) c[i] = a[i]+b[i];
11 +}
12 +// (N by K) C X (K by M) D = (N by M) E
13 +void matrixmult(int N, int K, int M, float*C, float*D, float*E) {
14 + int n, k, m;
15 + for (n = 0; n < N; n++)
16 + for (m = 0; m < M; m++) {
17 + float sum = 0;
18 + for (k = 0; k < K; k++) sum += C[n*K + k] * D[k*M + m];
19 + E[n*M + m] = sum;
20 + }
21 +}
22 +// Solve equation Av = b
23 +// return 0 when solution exists,
24 +// -1 when solution does not exist.
25 +// A ==> indentity matrix
26 +// b ==> v (the solution)
27 +int GaussElimination(int N, float *a, float *b)
28 +{
29 + float temp, aii, aji;
30 + int i, j, k;
31 + //showequation(N, a, b);
32 + for (i = 0; i<N; i++) {
33 + aii = a[i*N + i];
34 + if (aii == 0.0) return -1; // 부정/불능 여기 더 할 일 있음
35 + // i-th row를 aii로 모두 나누기
36 + for (k = i; k<N; k++) a[i*N + k] /= aii;
37 + b[i] /= aii;
38 + // 다른 row들의 i번째 항을 모두 0으로 만들기
39 + for (j = 0; j<N; j++) {
40 + if (i != j) {
41 + aji = a[j*N + i];
42 + for (k = i; k<N; k++) a[j*N + k] -= a[i*N + k] * aji;
43 + b[j] -= b[i] * aji;
44 + }// if(i!=j)
45 + } // other rows
46 + //showequation(N, a, b);
47 + }
48 + return 0;
49 +}
50 +void showMatrix(int n, int m, float* F) {
51 + int i, j;
52 + for (i = 0; i < n; i++) {
53 + for (j = 0; j < m; j++) cout << F[i*m + j] << "\t";
54 + cout << "\n";
55 +
56 + }
57 +}
58 +void showMatrix(char*name, int n, int m, float* F) {
59 + cout << name << endl;
60 + showMatrix(n, m, F);
61 +}
62 +// show N X N matrix
63 +void showequation(int N, float *a, float *b)
64 +{
65 + int i, j;
66 + for (i = 0; i<N; i++)
67 + {
68 + for (j = 0; j<N; j++) cout << a[i*N + j] << "\t";
69 + cout << b[i];
70 + }
71 + cout << "\n";
72 +}
...\ No newline at end of file ...\ No newline at end of file
1 +void scalarmult(int n, int m, float a, float *b, float *c);
2 +void matrixadd(int n, int m, float *a, float *b, float *c);
3 +void matrixmult(int N, int K, int M, float*C, float*D, float*E);
4 +int GaussElimination(int, float*, float*);
5 +void showMatrix(int n, int m, float* F);
6 +void showMatrix(char*name, int n, int m, float* F);
7 +void showequation(int N, float *a, float *b);
...\ No newline at end of file ...\ No newline at end of file
1 +#ifndef __RECEIVER
2 +
3 +#define __RECEIVER
4 +#include <cmath>
5 +#include "variables.h"
6 +class Creceiver {
7 +public:
8 + Creceiver() {};
9 + float *r; // corrupted signal = received signal
10 + float constellation[Nbits];
11 + char DecodedData[Nbits];
12 + void demodulate();
13 +};
14 +
15 +void Creceiver::demodulate()
16 +{
17 + for (int i = 0; i < Nbits; i++)
18 + {
19 + constellation[i]=r[i]/Eb;
20 + }
21 + for (int i = 0; i < Nbits; i+=2)
22 + {
23 + if (constellation[i]>0&&constellation[i + 1]>0)
24 + {
25 + DecodedData[i] = 1;
26 + DecodedData[i + 1] = 1;
27 + }
28 + else if (constellation[i]<0&&constellation[i + 1]>0)
29 + {
30 + DecodedData[i] = 0;
31 + DecodedData[i + 1] = 1;
32 + }
33 + else if (constellation[i]<0 &&constellation[i + 1]<0)
34 + {
35 + DecodedData[i] = 0;
36 + DecodedData[i + 1] = 0;
37 + }
38 + else if (constellation[i] >0 && constellation[i + 1]<0)
39 + {
40 + DecodedData[i] = 1;
41 + DecodedData[i + 1] = 0;
42 + }
43 + }
44 +}
45 +#endif
1 +#ifndef __SENDER
2 +#define __SENDER
3 +#include <cmath>
4 +#include "variables.h"
5 +class Csender {
6 +public:
7 + Csender();
8 + char data[Nbits];
9 + float s[Nbits]; // trasmitted signal
10 + void transmitData();
11 +};
12 +Csender::Csender()
13 +{
14 + for (int i = 0; i < Nbits; i++)
15 + data[i] = rand() % 2;
16 +}
17 +void Csender::transmitData()
18 +{
19 + for (int i = 0; i < Nbits; i += 2)
20 + {
21 + if (data[i] == 1&&data[i + 1] == 1)
22 + {
23 + s[i] = 0.707*Eb;
24 + s[i + 1] = 0.707*Eb;
25 + }
26 + else if (data[i] == 0 && data[i + 1] == 1)
27 + {
28 + s[i] = -0.707*Eb;
29 + s[i + 1] = 0.707*Eb;
30 + }
31 + else if (data[i] == 0 && data[i + 1] == 0)
32 + {
33 + s[i] = -0.707*Eb;
34 + s[i + 1] = -0.707*Eb;
35 + }
36 + else if (data[i] == 1 && data[i + 1] == 0)
37 + {
38 + s[i] = 0.707*Eb;
39 + s[i + 1] = -0.707*Eb;
40 + }
41 + }
42 +}
43 +#endif
1 +#ifndef __VARIABLES
2 +#define __VARIABLES
3 +#define Nbits 10000 // number of transmitted bits
4 +#define Nsamplespersymbol 20
5 +#define Nbitspersymbol 2 // QPSK
6 +#define Eb 5.6 // fixed
7 +#define No 4 // at SNR = 20dB, variable
8 +#endif