Efficiency of delayed token ring insertion? - networking

Let N be the number of stations in the ring, THT the token holding time, Tt be the transmission time of packet, Tp be the propagation time of packet on Channel/ Link.
Then Cycle Time = N * THT + Tp (this is cycle time for token)
and efficiency = (useful time)/(Cycle Time)
Here useful time is stated as N * Tt. (justified as transmission time at each station in single cycle of token passing)
And thus proven efficiency = (N * Tt)/(N*THT + Tp)
Now THT depends on what strategy we are using. If I am using delayed token ring then only one station transmits the data and other station doesn't transmit the data, but everywhere showing in useful time Tt multiplied by N.In this case, THT = Tt + Tp
So, cycle time = Tp + N*(Tt + Tp)
Efficiency, e = (NTt)/(Tp + N(Tt + Tp)).
My question is why we multiplied Tt by N inspite of one transmits the data?

Here in delayed token ring N=1 since only one station transmitting the data so, Efficiency, e = Tt/Tp + Tt + Tp=Tt/2Tp + Tt .

Related

Energy Calculation using Arduino

How I can calculate accurate energy if I have Power, Current , Voltage values
This is the code of energy calculation, the result's it's wrong so how I can fix that
I want to measure apparent energy, I don't have a problem in V , I, P values
if(millis() >= energyLastSample + 1)
{
energySampleCount = energySampleCount + 1;
energyLastSample = millis();
}
if(energySampleCount >= 1000)
{
apparent_energy_l1 = apparent_power_l1/3600.0;
finalEnergyValue_l1 = finalEnergyValue_l1 + apparent_energy_l1;
apparent_energy_l2 = apparent_power_l2/3600.0;
finalEnergyValue_l2 = finalEnergyValue_l2 + apparent_energy_l2;
apparent_energy_l3 = apparent_power_l3/3600.0;
finalEnergyValue_l3 = finalEnergyValue_l3 + apparent_energy_l3;
// Serial.print(finalEnergyValue,2);
// Serial.println("test");
energySampleCount = 0 ;
}
energy_total= finalEnergyValue_l1+finalEnergyValue_l2+finalEnergyValue_l3;
}
Some tips about power calculation using Arduino or any microcontroller,
open-source code or project,
guidelines to solve my problem
Note that energy (W x t) is a measurement of power over time, while power is a measurement of work, meaning that you cannot simply divide power by 3600 (which would be the factor to convert from seconds to hours) to get an energy value. Power (W) is a measurement of how much work for example a device is currently doing. If you want to calculate the Energy consumed by a device, you will have to continuously measure the Power, for example in 1s intervals, and add it to a counter. Then you have a value which represents Ws - Watt seconds. You can then calculate the Wh consumed from that value.
Example:
You have a device which consumes 300W of power. You keep that device running for exactly 3 hours. If you measure the power consumption every second as described, you will have measured 3240000 Ws. 3240000 Ws / 3600 = 900Wh / 1000 = 0,9 kWh. You can of course change your measurement interval to fit your needs in regard to accuracy.
Pseudocode:
if ( millis() >= lastmillis + 1000 )
{
lastmillis = millis();
wattseconds = wattseconds + power; #increment energy counter by current power
kilowatthours = wattseconds / 3600000;
print(kilowatthours)
}
You could of course use a one second interrupt with an external RTC to get a more accurate timing.

Question about delayed sampled sinusoid math expression

I have been studying the digital audio processing by using the book <Designing Audio Effect Plugins in C++>.
For analog Sinusoid:
Complex Sinusoid = e^(jωt)
Delayed Sinusoid = e^(jω(t−n)) = e^(jwt) * e^(-jwn), a delay of n seconds
For digital sampled version:
sampled complex sinusoid = e^(jωnT), T is interval for each sample, n is the index of sample
I understand all above, but I got confused about the delayed sampled sinusoid which described as: e^(jω ( nT −M )), M = samples of delay
But I think it should be described as e^(jωT( n − M )), since the T is a constant for a fixed sample rate, n and M has the same unit.
Anyone can explain it for me?
You are right about e^(jωT( n − M )), when M represents delay as sample count
Formula e^(jω ( nT −M )) is valid for M as time

How to calculate Received Signal Strength (RSS) and path loss Error in dB?

supposed that the measurement RSS is "-70dBm" and the predicted RSS is "-68dBm, the transmission power of antenna is "-12dBm",
then if the following equation is right? if not, how to calculate it?
Error = |10 * log10 (70/12) - 10 * log10 (68/12)| = 10 * log10 (70/68)
now my measurement is the RSS in dBm, how to convert it into dB?
This often confuses folks in my experience, and as such warrants a thorough explanation.
The "m" in "dBm" means relative to 1 milliwatt. It is typically used for absolute measurements, whereas "regular" dBs are typically used for power gains/losses/diffs.
Example:
in/tx out/rx
1w .5w
(1 milliwatt = 0.001)
10log(1/0.001) = 30dBm
10log(0.5/0.0001) = 27dBm
loss = 3dB
10log(1) = 0dB
10log(0.5) = 3dB
loss still is 3dB
(note there is an implied /1w here since the argument to log must be unit-less, e.g. 0.5w/1w = 0.5 "flat" (aka no units))
So in the context of power differences, the m does not matter.
Things to note:
1/2 of power lost == -3dB gain (or +3dB loss)
power gains/losses in series are added/subtracted when in dBs -vs- multipled/divided when in watts
0 watts == -infinity dB
0 dBm == 1 milliwatt
log here is base 10 (not 2 nor e)
reletiveGainOrLoss = 10^(valueOfGainOrLossInDb/10)
valueOfPowerInMilliwatts = 10^(valueOfPowerInDbm/10)
In your example, I'll presume by error you mean the error of the predicted loss relative measured loss:
predicted loss =
known transmission power - predicted RSS =
-12dBm - -68dBm =
56dB
measured loss =
known transmission power - measured RSS =
-12dBm - -70dBm =
58dB
error of predicted loss relative to measured loss =
|predicted loss - measured loss| =
|56dB - 58dB| =
2dB (==2dBms, but for diffs we should drop the m) =
Or more directly: 70 - 68 (so easy with dBs!)
This equates to a 63% error (or 58, depending on how it is done):
10^(-2dB/10) =
0.63
(10^(2dB/10) =
1.584893192461113
In millwatts:
10^(valueInDbm/10) =
10^(-70/10) = 0.0000001 milliwatts
10^(-68/10) = 0.000000158489319 milliwatts
10^(-12/10) = 0.063095734448019 milliwatts
As a sanity check:
(0.0000001/0.063095734448019 - 0.000000158489319/0.063095734448019) / (0.0000001/0.063095734448019) =
(0.000001584893192 - 0.000002511886428) / 0.000001584893192 =
-0.000000926993236 / 0.000001584893192 =
-0.584893190707832
(note that doing it in watts is much more laborious! (not to even mention float errors))
To answer your other question regarding:
Error = |10 * log10 (70/12) - 10 * log10 (68/12)| = 10 * log10 (70/68)
The first equation is nonsensical; as discussed above: for dBs we add/subtract -vs- multiply/divide. The second equation is however true, based on one of the rules of logs:
log a + log b = log ab
When the RSS in dBm, the path loss is equal to the difference between the transmission RSS and received RSS, the unit of path loss in this case is dB.

Montgomery Multiplication - 32-bit register vs. 64-bit register

I need to calculate the speed difference between performing a Montgomery Multiplication page 602-603 with a word-size/register of size 32 vs. 64.
So far, this is what I understand:
x and y are represented by multiple-word arrays of length n
where n = m/w and w is the register size (either 32 or
64).
The total number of single-digit multiplications in Montgomery
multiplication is n*(2 + 2*n), where n represents the number length of the word-arrays.
I will assume that the multiplication of two single-digit takes 1 clock cycle on each of the computers.
How can I put all this together to represent the number of clock cycles needed in Montgomery multiplication on a computer with a 32-bit register or 64-bit register?
The number of cycles for a multiple-precision Montgomery multiplication would indeed be n(2+2*n) if all the intermediate single-precision multiplication operands and results were available in registers. For cryptographic operations this is hardly possible since m is usually 1024 or larger. Assuming 32-bit registers (xyR^-1 mod m) would require 192 registers only to store the operands (3*(1024/32)). In fact you need to take into account memory accesses to answer this question.
A rewrite of the algorithm with memory accesses (assuming multiplications can be done in parallel with loads/stores):
For i from 0 to n: a_i <- 0
For i from 0 to (n − 1) do the following:
Fetch a_0
Fetch y_0
Fetch x_i
Compute u_i <- (a_0 + x_i*y_0)m' mod b. Store u_i in a register
c = 0 (Computing A <- (A + x_i*y + u_i*m)/b)
for j from 0 to (n-1):
Fetch a_j
Fetch y_j
Compute (cv) = a_j + x_i*y_j + c, Fetch m_j
Compute (cv) = (cv) + u_i*m_j, if j>0 Store a_{j-1} <- v
Store a_n <- c and a_{n-1} <- v
If A >= m then A <- A − m.
Return(A).
Hope this helps.

A simple simulation example in R from a textbook

I found this piece of code from a the textbook "Statistics and Data analysis for financial engineering," but I am confused about certain line in this code:
This code tried to answer the question of What is the probability that the value of the stock will be below $950,000 at the close of at least one of the next 45 trading days? They provide the mean and SD too.
Code:
niter = 1e5 # number of iterations
below = rep(0,niter) # set up storage
set.seed(2009)
for (i in 1:niter)
{
r = rnorm(45,mean=.05/253,
sd=.23/sqrt(253)) # generate random numbers
logPrice = log(1e6) + cumsum(r)
minlogP = min(logPrice) # minimum price over next 45 days
below[i] = as.numeric(minlogP < log(950000))
}
mean(below)
A few questions:
I dont understand about logPrice = log(1e6) + cumsum(r), why we use log(1e6) and why we have cumsum(r)?
What is the purpose of this: below[i] = as.numeric(minlogP < log(950000))
why do we use log(950000)? why do we need to log?
I'm guessing that current price is $100,000 and hence log(1e6). The return has to be accumulated over period of 45 days and therefore cumsum(r)
Well you are checking if price falls below $950,000
In quant the stock return is normally distributed and stock price (always +ve) is log-normal.

Resources