Skip to content

Commit

Permalink
Merge pull request #109 from project8/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
pslocum authored Nov 3, 2019
2 parents 4aebbac + 46e913a commit c9c9714
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required( VERSION 3.1 )

# Define the project
cmake_policy( SET CMP0048 NEW ) # version in project()
project( locust_mc VERSION 1.15.4)
project( locust_mc VERSION 1.15.5)

list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake )
include( PackageBuilder )
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM project8/p8compute_dependencies:v0.9.0 as locust_common
ARG build_type=Release
ENV LOCUST_BUILD_TYPE=$build_type

ENV LOCUST_TAG=v1.15.4
ENV LOCUST_TAG=v1.15.5
ENV LOCUST_BUILD_PREFIX=/usr/local/p8/locust/$LOCUST_TAG

RUN mkdir -p $LOCUST_BUILD_PREFIX &&\
Expand Down
3 changes: 2 additions & 1 deletion Source/Generators/LMCFakeTrackSignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ namespace locust
TFile* hfile = new TFile(fRoot_filename.c_str(),"RECREATE");

const unsigned nChannels = fNChannels;
double LO_phase = 0.;
const double tLocustStep = 1./aSignal->DecimationFactor()/(fAcquisitionRate*1.e6);
double signalAmplitude;
double tTimeOffset = 0;
Expand All @@ -742,13 +741,15 @@ namespace locust

for(unsigned ch = 0; ch < nChannels; ++ch) // over all channels
{
double LO_phase = 0.;
double voltage_phase = fStartVPhase;
unsigned tTrackIndexRange[2] = {static_cast<unsigned>(fStartTime / tLocustStep), static_cast<unsigned>(fEndTime / tLocustStep)};
tTrackIndexRange[1] = std::min(tTrackIndexRange[1], aSignal->TimeSize()*aSignal->DecimationFactor());
fCurrentFrequency = fStartFrequency;

for( unsigned index = tTrackIndexRange[0]; index < tTrackIndexRange[1]; ++index ) // advance sampling time
{
LO_phase += 2.*LMCConst::Pi()*fLO_frequency * tLocustStep;
fCurrentFrequency += fSlope * 1.e6/1.e-3 * tLocustStep;
voltage_phase += 2.*LMCConst::Pi()*GetPitchCorrectedFrequency(fCurrentFrequency) * tLocustStep;
signalAmplitude = sqrt(50.) * sqrt(fSignalPower) * WaveguidePowerCoupling(fCurrentFrequency, fPitch);
Expand Down
1 change: 1 addition & 0 deletions Source/Generators/LMCPlaneWaveSignalGenerator.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* LMCPlaneWaveSignalGenerator.cc
*
Expand Down
1 change: 1 addition & 0 deletions Source/Generators/LMCPlaneWaveSignalGenerator.hh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* LMCPlaneWaveSignalGenerator.hh
*
Expand Down
109 changes: 69 additions & 40 deletions Source/RxComponents/LMCPowerCombiner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ namespace locust
int NPAIRS = fabs((double)z_index - (double)fnPatchesPerStrip/2.);
if (z_index >= fnPatchesPerStrip/2) NPAIRS += 1; // compensate for patches to the right of amp.
std::vector<double> D = GetPartialGains(RJunction, R0, RGround, NPAIRS); // calculate new vector of gains.
double dampingfactor = 0.6*0.66; // patch loss * T-junction loss.
//double dampingfactor = 0.6*0.66; // patch loss * T-junction loss.
double dampingfactor = 0.425; // "active S-matrix" for the 2 patch case
return dampingfactor * D[NPAIRS-1];
}

Expand Down Expand Up @@ -142,15 +143,17 @@ namespace locust
}


bool PowerCombiner::SetVoltageDividerDampingFactors()
{
for (unsigned z_index=0; z_index<fnPatchesPerStrip; z_index++)
{
int NPAIRS = fabs((double)z_index - (double)fnPatchesPerStrip/2.);
if (z_index >= fnPatchesPerStrip/2) NPAIRS += 1; // compensate for patches to the right of amp.
std::vector<double> D = GetPartialGains(fjunctionResistance, 1.0, 10.e6, NPAIRS); // calculate new vector of gains.
fdampingFactors[z_index] = fpatchLoss*famplifierLoss * D[NPAIRS-1]; // patch loss * T-junction loss
}
bool PowerCombiner::SetVoltageDividerDampingFactors()
{

for (unsigned z_index=0; z_index<fnPatchesPerStrip; z_index++)
{
int NPAIRS = fabs((double)z_index - (double)fnPatchesPerStrip/2.);
if (z_index >= fnPatchesPerStrip/2) NPAIRS += 1; // compensate for patches to the right of amp.
std::vector<double> D = GetPartialGains(fjunctionResistance, 1.0, 10.e6, NPAIRS); // calculate new vector of gains.
fdampingFactors[z_index] = fpatchLoss*famplifierLoss * D[NPAIRS-1]; // patch loss * T-junction loss
}

return true;
}

Expand Down Expand Up @@ -178,7 +181,7 @@ namespace locust

bool PowerCombiner::SetCenterFedDampingFactors()
{
for (unsigned z_index=0; z_index<fnPatchesPerStrip; z_index++)
for (unsigned z_index=0; z_index<fnPatchesPerStrip; z_index++)
{
int njunctions = fabs((double)z_index - (double)fnPatchesPerStrip/2.) - 1;
if (z_index >= fnPatchesPerStrip/2) njunctions += 1; // compensate for patches to the right of amp.
Expand All @@ -191,31 +194,57 @@ namespace locust
fdampingFactors[z_index] = fpatchLoss*pow(fjunctionLoss, njunctions)*famplifierLoss; // patch loss * junction loss * amplifier loss
}
}

return true;

}

bool PowerCombiner::SetSmatrix10patchDampingFactors()
{
if (fnPatchesPerStrip != 10)
{
LERROR(lmclog,"The S-matrix is expecting 10 patches per strip.");
return false;
}

for (unsigned z_index=0; z_index<fnPatchesPerStrip; z_index++)
{
// fdampingFactors[z_index] = something goes here.
// it should be related to PowerCombiner::fsMatrix10patch[].
}



return true;

}

bool PowerCombiner::SetSmatrixDampingFactors()
{
if (fnPatchesPerStrip != 2 && fnPatchesPerStrip != 4 && fnPatchesPerStrip != 6)
{
LERROR(lmclog,"The S-matrix is implemented only for 2, 4, or 6 patches per strip.");
return false;
}

SetTransmissionCoefficients();
for (unsigned z_index=0; z_index<fnPatchesPerStrip; z_index++)
{
fdampingFactors[z_index] = ftransmissionCoefficients[z_index];
}

return true;

}

std::vector<double> PowerCombiner::GetSmatrixElements()
{
std::vector<double> smatrix;

if (fnPatchesPerStrip == 2) smatrix = fsMatrix2patch;
if (fnPatchesPerStrip == 4) smatrix = fsMatrix4patch;
if (fnPatchesPerStrip == 6) smatrix = fsMatrix6patch;

return smatrix;
}

bool PowerCombiner::SetTransmissionCoefficients()
{
ftransmissionCoefficients.resize(fnPatchesPerStrip);

std::vector<double> smatrix = GetSmatrixElements();
double patchImpedance = 100;
double ampImpedance = 50;

for (int i = 0; i < fnPatchesPerStrip; i++)
{
ftransmissionCoefficients[i] = smatrix[i+1]*sqrt(ampImpedance/patchImpedance);
//printf("Transmission Coeff for patch %d is %f\n", i, ftransmissionCoefficients[i]);
}

return true;

}

bool PowerCombiner::SetVoltageDampingFactors(int aPatchesPerStrip)
{
Expand All @@ -224,7 +253,7 @@ namespace locust

if ((fpowerCombiner == 7) || (fpowerCombiner == 0) || (fpowerCombiner == 2) || (fpowerCombiner == 3) || (fpowerCombiner == 4))
{
SetCenterFedDampingFactors();
SetCenterFedDampingFactors();
}

else if (fpowerCombiner == 1) // series
Expand All @@ -237,9 +266,9 @@ namespace locust
SetVoltageDividerDampingFactors();
}

else if (fpowerCombiner == 6)
else if (fpowerCombiner == 6) // s-matrix
{
SetSmatrix10patchDampingFactors();
SetSmatrixDampingFactors();
}

return true;
Expand All @@ -254,9 +283,9 @@ namespace locust
if (fpowerCombiner == 0) // corporate
{
fjunctionLoss = 1.0;
fpatchLoss = 0.6;
famplifierLoss = 0.66;
fendPatchLoss = 0.6;
fpatchLoss = 1.0;
famplifierLoss = 0.425; // hard coded active S-matrix for 2 patches for now
fendPatchLoss = 1.0;
}

else if (fpowerCombiner == 1) // series
Expand Down Expand Up @@ -305,10 +334,10 @@ namespace locust

else if (fpowerCombiner == 7) // single-patch
{
// these losses have no effect. FIR for single patch is responsible for patch gain.
// there is a single impedance transformation to the amplifier.
fjunctionLoss = 1.0;
fpatchLoss = 1.0;
famplifierLoss = 1.0;
famplifierLoss = 0.7071;
fendPatchLoss = 1.0;
}

Expand Down
11 changes: 9 additions & 2 deletions Source/RxComponents/LMCPowerCombiner.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ namespace locust
bool SetCenterFedDampingFactors();
bool SetSeriesFedDampingFactors();
bool SetVoltageDividerDampingFactors();
bool SetSmatrix10patchDampingFactors();
bool SetSmatrixDampingFactors();
std::vector<double> GetResistances(double RJunction, double R0, double RGround, int NPAIRS);
std::vector<double> GetPartialGains(double RJunction, double R0, double RGround, int NPAIRS);
double GetVoltageDividerWeight(double RJunction, double R0, double Rground, unsigned z_index);
double GetParallelResistance(std::vector<double> R, int NRESISTORS, int resistorindex);
std::vector<double> GetSmatrixElements();
bool SetTransmissionCoefficients();
int fpowerCombiner;
int fnPatchesPerStrip;
double fjunctionLoss;
Expand All @@ -66,8 +68,13 @@ namespace locust
double fjunctionResistance;
std::vector<double> fdampingFactors;

std::vector<double> fsMatrix10patch = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
// Uniform taper S-matrices from HFSS:
std::vector<double> fsMatrix2patch = {0.2, 0.64, 0.64};
std::vector<double> fsMatrix4patch = {0.09, 0.47, 0.47, 0.47, 0.47};
std::vector<double> fsMatrix6patch = {0.03, 0.38, 0.38, 0.38, 0.38, 0.38, 0.38};
// end Uniform taper S-matrices.

std::vector<double> ftransmissionCoefficients;
};


Expand Down

0 comments on commit c9c9714

Please sign in to comment.