Consider the following inputs and outputs associated with a DCS system. It is interesting to note that EXACTLY the same could be applicable to a SCADA system (although the SCADA system could use either a dedicated RTU or else a PLC).
Break the following signals up (either going to, or away from the RTU-type devices) and indicate which are:
i) digital inputs, ii) digital outputs, iii) analog inputs and iv) analog outputs:
18.1 ( 1 mark) START signal
18.2 ( 1 mark) |
Speed control signal of a VSD (going to the VSD – Please think in terms of a SPEED UP button and a SLOW DOWN button). |
18.3( 1 mark) An I/P (current to pressure) transducer for a butterfly valve (going to the valve).
18.4( 1 mark) Solenoid Valve (operating something in the field).
18.5( 1 mark) A light.
18.6( 1 mark) An electric motor’s contactor (which will be used to start a motor in the field)
18.7( 1 mark) An RTD temperature probe.
Note – This question is mandatory. It should be answered and students are expected to get this question completely right to be assessed as competent with a score for this module.
In: Electrical Engineering
List nine general firewall policies?
In: Electrical Engineering
Describe the purposes within the organization for data collection by the SCADA historian
In: Electrical Engineering
this is cahce memory related c program....and not working or running properly???????
#include <iostream> |
#include <string> |
#include <vector> |
#include <iomanip> |
#include <cmath> |
#include <cstdlib> |
#include <ctime> |
using namespace std; |
int cash_type, block_size, cash_size,number_of_blocks=0;; |
int compulsry_misses=0, capcity_misses=0, conflict_misses=0; |
#define DRAM_SIZE (64*1024*1024) |
unsigned int m_w = 0xABABAB55; /* must not be zero, nor 0x464fffff */ |
unsigned int m_z = 0x05080902; /* must not be zero, nor 0x9068ffff */ |
unsigned int rand_() |
{ |
m_z = 36969 * (m_z & 65535) + (m_z >> 16); |
m_w = 18000 * (m_w & 65535) + (m_w >> 16); |
return (m_z << 16) + m_w; /* 32-bit result */ |
} |
unsigned int memGen1() |
{ |
static unsigned int addr=0; |
return (addr++)%(DRAM_SIZE); |
} |
unsigned int memGen2() |
{ |
static unsigned int addr=0; |
return rand_()%(128*1024); |
} |
unsigned int memGen3() |
{ |
return rand_()%(DRAM_SIZE); |
} |
unsigned int memGen4() |
{ |
static unsigned int addr=0; |
return (addr++)%(1024); |
} |
unsigned int memGen5() |
{ |
static unsigned int addr=0; |
return (addr++)%(1024*64); |
} |
unsigned int memGen6() |
{ |
static unsigned int addr=0; |
return (addr+=256)%(DRAM_SIZE); |
} |
// Cache Simulator |
bool cacheSim(unsigned int addr, int cash[3][100000], int type, int &block_counter, int index_addr, int tag_addr) |
{ |
int shift_offset=log2(block_size); |
bool detected=false; |
bool misses_flag=true; |
if (cash_type==0) // Direct Mapped ****************************************** |
{ |
if (cash[0][index_addr]==tag_addr) |
{ |
return true; |
} |
else |
{ |
cash[0][index_addr]= tag_addr; |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[1][i]!=1) |
{ misses_flag=false; |
i=number_of_blocks;} |
} |
//calculating misses |
if (misses_flag) |
capcity_misses++; // capcity miss because the cash is full |
else |
{ |
if(cash[1][index_addr]==1) |
conflict_misses++; |
else |
{ |
compulsry_misses++; |
} |
} |
cash[1][index_addr]= 1; |
return 0; |
} |
} // end of directed mapped |
/////////////////////////////////////////////////////////////////// |
else if (cash_type==1) // set asscoiative ************************************* |
{ |
index_addr=index_addr * type; |
for (int i=0; i < type ; i++) |
{ |
if (cash[0][index_addr+i]==tag_addr) |
{ |
// cout <<"0x hitttttttt" << setfill('0') << setw(8) << hex << tag_addr << endl; |
return 1; |
} |
} |
for (int j=0; j < type; j++) |
{ |
if (cash[1][index_addr+j] == -1) |
{ |
compulsry_misses++; |
cash[0][index_addr+j]=tag_addr; |
cash[1][index_addr+j]=1; |
return 0; |
} |
} |
srand(time(NULL)); |
int x=rand()%(type); |
cash[0][index_addr+x]=tag_addr; |
cash[1][index_addr+x]=1; |
capcity_misses++; |
return 0; |
}//end of set assciative |
else if (cash_type==2) // fully associative ************************************** |
{ |
if (type==0) // LRU ///////// |
{ |
if (block_counter < number_of_blocks) |
{ |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==addr >> shift_offset) |
{ |
detected=true; |
cash[1][i]=block_counter; |
block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
compulsry_misses++; |
cash[0][block_counter]=addr>>shift_offset; |
cash[1][block_counter]=block_counter; |
return false; //miss |
} |
} |
else // block counter is more than block size |
{ |
//check for existence |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==(addr >> shift_offset)) |
{ |
detected=true; |
cash[1][i]=block_counter; |
//block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
int compare=0; |
for (int i=1; i < number_of_blocks; i++) |
{ |
if (cash[1][compare] > cash[1][i]) |
compare=i; |
} |
cash[0][compare]=addr >> shift_offset; |
cash[1][compare]=block_counter; |
capcity_misses++; |
return false; //miss |
} |
} |
} // end of LRU |
else if (type==1) // LFU /////////////// |
{ |
if (block_counter < number_of_blocks) |
{ |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==addr >> shift_offset) |
{ |
detected=true; |
cash[1][i]=cash[1][i]+1; |
block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
cash[0][block_counter]=addr>>shift_offset; |
cash[1][block_counter]=-1; |
compulsry_misses++; |
return false; //miss |
} |
} |
else // block counter is more than block size |
{ |
//check for existence |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==(addr >> shift_offset)) |
{ |
detected=true; |
cash[1][i]++; |
block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
int compare2=0; |
for (int i=1; i < number_of_blocks; i++) |
{ |
if (cash[1][compare2] >= cash[1][i]) |
compare2=i; |
} |
cash[0][compare2]=addr >> shift_offset; |
cash[1][compare2]=-1; |
capcity_misses++; |
return false; //miss |
} |
} |
} // end if LFU |
else if (type==2) |
{ |
if (block_counter < number_of_blocks) |
{ |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==addr >> shift_offset) |
{ |
detected=true; |
block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
cash[0][block_counter]=addr>>shift_offset; |
cash[1][block_counter]=block_counter; |
compulsry_misses++; |
return false; //miss |
} |
} |
else // block counter is more than block size |
{ |
//check for existence |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==(addr >> shift_offset)) |
{ |
detected=true; |
//block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
int compare=0; |
for (int i=1; i < number_of_blocks; i++) |
{ |
if (cash[1][compare] > cash[1][i]) |
compare=i; |
} |
cash[0][compare]=addr >> shift_offset; |
cash[1][compare]=block_counter; |
capcity_misses++; |
return false; //miss |
} |
} |
}// end of FIFO |
else if (type==3) |
{ |
if (block_counter < number_of_blocks) |
{ |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==addr >> shift_offset) |
{ |
detected=true; |
block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
cash[0][block_counter]=addr>>shift_offset; |
compulsry_misses++; |
return false; //miss |
} |
} |
else // block counter is more than block size |
{ |
//check for existence |
for (int i=0; i < number_of_blocks; i++) |
{ |
if (cash[0][i]==(addr >> shift_offset)) |
{ |
detected=true; |
//block_counter--; |
return detected; //hit |
} |
} |
if (!detected) |
{ |
srand(time(NULL)); |
cash[0][rand()%number_of_blocks]=addr >> shift_offset; |
capcity_misses++; |
return 0; //miss |
} |
} |
}//end of RANDOM |
} // end of Fully associative |
return true; |
} |
char *msg[2] = {"Miss","Hit"}; |
/////////////////////////////////////////////////////////////////// |
int main(int argc, const char * argv[]) { |
int looper=1000000, addr, flag, shift; |
cout << "Please, enter 0 for Direct mapped, 1 for set associative, 2 for fully associative: " << endl; |
cin >> cash_type; |
cout << "Please, enter the size of the block as a Power of 2 between 4 and 128 byte :" << endl; |
cin >> block_size; |
cout << "Please, enter cache size: 1KB – 64KB; in steps that are power of 2: " << endl; |
cin >> cash_size; |
int cash[3][100000]; |
int block_counter=0; |
int hit_counter=0; |
int index_addr=0, tag_addr=0; |
/////////////////////////////////////////////////////////////////// |
if ( cash_type==0) //Direct_mapped ************** |
{ |
number_of_blocks= (cash_size*1024)/block_size; |
//////////////////// |
for (int i=0; i < 2; i++) // setting all the cash with -1 |
for (int j=0; j < number_of_blocks; j++) |
cash[i][j]=-1; |
////////////////// |
for(int i=0; i <looper ;i++) |
{ |
addr = memGen1(); |
shift= log2(block_size); |
index_addr= (addr >> shift)% number_of_blocks; |
shift= log2(number_of_blocks+block_size); |
tag_addr= addr >>shift; // shifted the amount the offset and the index sizes |
flag = cacheSim(addr, cash, 0,block_counter, index_addr, tag_addr); |
index_addr=0; |
tag_addr=0; |
cout <<"0x" << setfill('0') << setw(8) << hex << addr <<" ("<< msg[flag] <<")\n"; |
if (msg[flag]=="Hit") |
{ |
hit_counter++; |
} |
} |
cout << "Hits " << hit_counter<<endl << "Compulsry: " << compulsry_misses <<endl<< "Capcity: " << capcity_misses <<endl<< "Conflict: " << conflict_misses << endl; |
} |
/////////////////////////////////////////////////////////////////// |
else if (cash_type==2) // Fully associative************** |
{ |
int replacment_type; |
number_of_blocks= (cash_size*1024)/block_size; |
cout << "please, enter the type of replacment for the Fully Associative: LRU->0 , LFU->1, FIFO->2, RANDOM->3 :- " << endl; |
cin >> replacment_type; |
for (int i=0; i < 2; i++) // setting all the cash with -1 |
for (int j=0; j < number_of_blocks; j++) |
cash[i][j]=-10; |
for(int i=0; i <looper ;i++) |
{ |
addr = memGen4(); |
flag = cacheSim(addr, cash, replacment_type, block_counter, index_addr, tag_addr); |
// cout <<"0x" << setfill('0') << setw(8) << hex << addr <<" ("<< msg[flag] <<")\n"; |
if (msg[flag]=="Hit") |
{ |
hit_counter++; |
} |
block_counter++; |
} |
cout << "Hits " << hit_counter<<endl << "Compulsry: " << compulsry_misses <<endl<< "Capcity: " << capcity_misses <<endl<< "Conflict: " << conflict_misses << endl; |
} // end of fully associative main |
else if (cash_type==1) // set associative |
{ |
int number_of_ways; |
cout << "please, enter the number of ways for the set associative cash: 2,4,8,16" << endl; |
cin >> number_of_ways; |
number_of_blocks= (cash_size*1024)/(block_size*number_of_ways); |
for (int i=0; i < 3; i++) // setting all the cash with -1 |
for (int j=0; j < 100000; j++) |
cash[i][j]=-1; |
for(int i=0; i <looper ;i++) |
{ |
addr = memGen5(); |
shift= log2(block_size); |
index_addr= (addr >> shift)% (number_of_blocks); |
shift= log2(number_of_blocks+block_size); |
tag_addr= addr >>shift; |
flag = cacheSim(addr, cash, number_of_ways, block_counter, index_addr, tag_addr); |
// cout <<"0x" << setfill('0') << setw(8) << hex << addr <<" ("<< msg[flag] <<")\n"; |
index_addr=0; |
tag_addr=0; |
if (msg[flag]=="Hit") |
{ |
hit_counter++; |
} |
block_counter++; |
} |
cout << "Hits " << hit_counter<<endl << "Compulsry: " << compulsry_misses <<endl<< "Capcity: " << capcity_misses <<endl<< "Conflict: " << conflict_misses << endl; |
} |
} |
In: Electrical Engineering
Explain 6 factors which may be considered in allocating power generation to different power stations for optimum operation
In: Electrical Engineering
In: Electrical Engineering
Answer the following:
A. What does BJT means? and why is it called BJT?
B. What are the two types of BJT? Explain their difference and commonalities, as well as their basic operation.
C. What are the three basic configurations of BJT transistor? Explain its input and output characteristics.
In: Electrical Engineering
1. What do you mean by ‘Intrinsic strength’ of a solid dielectric?
2. What are the drawbacks of single stage circuit for the generation of very high impulse voltage?
3. What is a cascaded transformer?
4. What is the effect of nearby earthed objects on the measurements using sphere gaps?
In: Electrical Engineering
4. (a) (i) Explain with neat diagram how rod gaps can be used for measurement of high voltages. Compare its performance with a sphere gap.
(ii) Explain with neat diagram the principle of operation of an Electrostatic Voltmeter. Discuss its advantages and limitations for high voltage measurements.
Or
(b) A Rogowski coil is required to measure impulse current of 8 kA having rate of change of current of 1010 A/sec. The voltmeter is connected across the integrating circuit which reads 8 volts for full scale deflection. The input to the integrating circuit is from the Rogowski Coil. Determine the mutual inductance of coil, R and C of the integrating circuit.
In: Electrical Engineering
2. (a) (i) Explain clearly various processes which explain electric breakdown in vacuum.
(ii) Discuss about the properties of composite dielectrics.
Or
(b) (i) Explain briefly various theories of breakdown in liquid dielectrics.
(ii) Explain the Townsends criterion for a spark.
In: Electrical Engineering
6. Explain the design philosophy for the selection of various types of busbar arrangements in sub-stations. Which arrangement will you select for a remote rural area sub-station supplying a 10 MVA load through two 33/11 kV transformers? Give complete justification for your answer.
In: Electrical Engineering
1. What are the advantages of per unit system?
2. What is Jacobian matrix?
3. What is a slack bus?
4. Mention the objectives of short circuit analysis
In: Electrical Engineering
In: Electrical Engineering
The objective of this lab is to practice your Verilog coding and the design of a Finite State Machine. Lab Goal: For this lab, you will code a Verilog module to implement the FSM described in this document. This lab will also require that you use the Seven - Segment Display on the DE0 - CV FPGA board. Design Specifications for the FSM Implem ent the following simple state machine on the DE0 - CV FPGA board. This FSM will have 5 states. The clock to this FSM will be provided by yourself using KEY0 (one of the push buttons on the board). Include a debounce module in your code but do not use it. S o you write the code as described in the lecture, but there should be no debounce module instance. I want you to understand this module but it is unnecessary on our board. The transitions from any one state to another are determined by switches 0 through 4 of the board (SW0, SW1, SW2, SW3, and SW4) as shown in the state diagram below. This will be easier than using pushbuttons for the inputs to switch to states. That means you set the switch and then clock it using KEY0. It really only matters what the swi t ch positions are when the clock edge occurs. NOTE reiterating this use slide s witches not pushbuttons for input. Use KEY0 for the clock, and generate the clock signal by hand by pushing KEY0. Any input transition not explicitly referenced in the diagram keeps the machine in the same state. Moreover, if two or more switches are asserted simultaneous ly, no transition should occur. SW0 acts as the rese t and should reset the FSM to S 00 regardless of all other switches or the pushbutton. (note you could use K EY1 pushbutton instead but it isn’t clear that would be better). How to write your code: Study Lecture 9 section 3 on how to write a Finite State Machine in Verilog. Your code will have two parts. There will be a synchronous part which is the part models the flip flops. An example of this is Lecture 9 slide 33. The other part is the combinatorial part, which is the part that feeds the inputs to the flip flops, that is like the code in Lecture 9 slides 29 through 32. This i
In: Electrical Engineering
a) Sketch the symbols and show the respective equations to represent an adder, multiplier, delay, and memory.
b) Determine the Fourier Transform and Inverse Fourier Transform for an arbitrary periodic and aperiodic signal.
In: Electrical Engineering