한서우

original files

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
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 / Nbitspersymbol*Nsamplespersymbol]; // corrupted signal
12 + void AWGN();
13 +};
14 +#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 + <ClCompile Include="myMatrix.cpp" />
115 + </ItemGroup>
116 + <ItemGroup>
117 + <ClInclude Include="channel.h" />
118 + <ClInclude Include="evaluate.h" />
119 + <ClInclude Include="myMatrix.h" />
120 + <ClInclude Include="receiver.h" />
121 + <ClInclude Include="sender.h" />
122 + <ClInclude Include="variables.h" />
123 + </ItemGroup>
124 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
125 + <ImportGroup Label="ExtensionTargets">
126 + </ImportGroup>
127 +</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 + <ClCompile Include="myMatrix.cpp">
22 + <Filter>소스 파일</Filter>
23 + </ClCompile>
24 + </ItemGroup>
25 + <ItemGroup>
26 + <ClInclude Include="sender.h">
27 + <Filter>헤더 파일</Filter>
28 + </ClInclude>
29 + <ClInclude Include="variables.h">
30 + <Filter>헤더 파일</Filter>
31 + </ClInclude>
32 + <ClInclude Include="channel.h">
33 + <Filter>헤더 파일</Filter>
34 + </ClInclude>
35 + <ClInclude Include="receiver.h">
36 + <Filter>헤더 파일</Filter>
37 + </ClInclude>
38 + <ClInclude Include="evaluate.h">
39 + <Filter>헤더 파일</Filter>
40 + </ClInclude>
41 + <ClInclude Include="myMatrix.h">
42 + <Filter>헤더 파일</Filter>
43 + </ClInclude>
44 + </ItemGroup>
45 +</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 +void main() {
8 + Csender mySender;
9 + Cchannel myChannel;
10 + Creceiver myReceiver;
11 + Cevaluate myEvaluator;
12 +
13 + mySender.transmitData(); // generate data[ ], s[ ]
14 + myChannel.s = mySender.s;
15 + myChannel.AWGN(); // calculate r[ ]
16 + myReceiver.r = myChannel.r;
17 + myReceiver.demodulate(); // calculate constellation[ ], DecodedData[ ];
18 + myEvaluator.Data = mySender.data;
19 + myEvaluator.DecodedData = myReceiver.DecodedData;
20 + myEvaluator.evaluate(); // compare the original and the decoded
21 +}
...\ 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 +#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 +#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/Nbitspersymbol*Nsamplespersymbol]; // trasmitted signal
10 + void transmitData();
11 +};
12 +#endif
1 +#ifndef __VARIABLES
2 +#define __VARIABLES
3 +#define Nbits 1000 // number of transmitted bits
4 +#define Nsamplespersymbol 20
5 +#define Nbitspersymbol 2 // QPSK
6 +#define Eb 40 // fixed
7 +#define No 4 // at SNR = 20dB, variable
8 +#endif