한서우

original files

No preview for this file type
No preview for this file type
No preview for this file type

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "constellation", "constellation\constellation.vcxproj", "{6FF25C27-45BF-4502-A1F8-0EFB069E1515}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x64.ActiveCfg = Debug|x64
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x64.Build.0 = Debug|x64
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x86.ActiveCfg = Debug|Win32
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Debug|x86.Build.0 = Debug|Win32
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x64.ActiveCfg = Release|x64
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x64.Build.0 = Release|x64
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x86.ActiveCfg = Release|Win32
{6FF25C27-45BF-4502-A1F8-0EFB069E1515}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
#ifndef __CHANNEL
#define __CHANNEL
#include <cmath>
#include <random>
#include "variables.h"
class Cchannel {
public:
Cchannel() {};
float *s; // trasmitted signal
float r[Nbits / Nbitspersymbol*Nsamplespersymbol]; // corrupted signal
void AWGN();
};
#endif
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6FF25C27-45BF-4502-A1F8-0EFB069E1515}</ProjectGuid>
<RootNamespace>constellation</RootNamespace>
<WindowsTargetPlatformVersion>8.1</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>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</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>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="constellation_main.cpp" />
<ClCompile Include="myMatrix.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="channel.h" />
<ClInclude Include="evaluate.h" />
<ClInclude Include="myMatrix.h" />
<ClInclude Include="receiver.h" />
<ClInclude Include="sender.h" />
<ClInclude Include="variables.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="constellation_main.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="myMatrix.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="sender.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="variables.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="channel.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="receiver.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="evaluate.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="myMatrix.h">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
#include <iostream>
using namespace std;
#include "sender.h"
#include "channel.h"
#include "receiver.h"
#include "evaluate.h"
void main() {
Csender mySender;
Cchannel myChannel;
Creceiver myReceiver;
Cevaluate myEvaluator;
mySender.transmitData(); // generate data[ ], s[ ]
myChannel.s = mySender.s;
myChannel.AWGN(); // calculate r[ ]
myReceiver.r = myChannel.r;
myReceiver.demodulate(); // calculate constellation[ ], DecodedData[ ];
myEvaluator.Data = mySender.data;
myEvaluator.DecodedData = myReceiver.DecodedData;
myEvaluator.evaluate(); // compare the original and the decoded
}
\ No newline at end of file
#ifndef __EVALUATE
#define __EVALUATE
#include <cmath>
#include "variables.h"
class Cevaluate {
public:
Cevaluate() {};
char *DecodedData; // from the receiver
char *Data; // from the sender
void evaluate();
};
#endif
#include <iostream>
#include "myMatrix.h"
using namespace std;
void scalarmult(int n, int m, float a, float *b, float *c){
int N = n*m;
for(int i=0;i<N;i++) c[i] = a*b[i];
}
void matrixadd(int n, int m, float *a, float *b, float *c){
int N = n*m;
for (int i = 0; i<N; i++) c[i] = a[i]+b[i];
}
// (N by K) C X (K by M) D = (N by M) E
void matrixmult(int N, int K, int M, float*C, float*D, float*E) {
int n, k, m;
for (n = 0; n < N; n++)
for (m = 0; m < M; m++) {
float sum = 0;
for (k = 0; k < K; k++) sum += C[n*K + k] * D[k*M + m];
E[n*M + m] = sum;
}
}
// Solve equation Av = b
// return 0 when solution exists,
// -1 when solution does not exist.
// A ==> indentity matrix
// b ==> v (the solution)
int GaussElimination(int N, float *a, float *b)
{
float temp, aii, aji;
int i, j, k;
//showequation(N, a, b);
for (i = 0; i<N; i++) {
aii = a[i*N + i];
if (aii == 0.0) return -1; // 부정/불능 여기 더 할 일 있음
// i-th row를 aii로 모두 나누기
for (k = i; k<N; k++) a[i*N + k] /= aii;
b[i] /= aii;
// 다른 row들의 i번째 항을 모두 0으로 만들기
for (j = 0; j<N; j++) {
if (i != j) {
aji = a[j*N + i];
for (k = i; k<N; k++) a[j*N + k] -= a[i*N + k] * aji;
b[j] -= b[i] * aji;
}// if(i!=j)
} // other rows
//showequation(N, a, b);
}
return 0;
}
void showMatrix(int n, int m, float* F) {
int i, j;
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) cout << F[i*m + j] << "\t";
cout << "\n";
}
}
void showMatrix(char*name, int n, int m, float* F) {
cout << name << endl;
showMatrix(n, m, F);
}
// show N X N matrix
void showequation(int N, float *a, float *b)
{
int i, j;
for (i = 0; i<N; i++)
{
for (j = 0; j<N; j++) cout << a[i*N + j] << "\t";
cout << b[i];
}
cout << "\n";
}
\ No newline at end of file
void scalarmult(int n, int m, float a, float *b, float *c);
void matrixadd(int n, int m, float *a, float *b, float *c);
void matrixmult(int N, int K, int M, float*C, float*D, float*E);
int GaussElimination(int, float*, float*);
void showMatrix(int n, int m, float* F);
void showMatrix(char*name, int n, int m, float* F);
void showequation(int N, float *a, float *b);
\ No newline at end of file
#ifndef __RECEIVER
#define __RECEIVER
#include <cmath>
#include "variables.h"
class Creceiver {
public:
Creceiver() {};
float *r; // corrupted signal = received signal
float constellation[Nbits];
char DecodedData[Nbits];
void demodulate();
};
#endif
#ifndef __SENDER
#define __SENDER
#include <cmath>
#include "variables.h"
class Csender {
public:
Csender() {};
char data[Nbits];
float s[Nbits/Nbitspersymbol*Nsamplespersymbol]; // trasmitted signal
void transmitData();
};
#endif
#ifndef __VARIABLES
#define __VARIABLES
#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
#endif