Professional Documents
Culture Documents
Control Assignment One Signal Flow Graph
Control Assignment One Signal Flow Graph
Presents
Linear System Control
Assignment 1
Assignment 1
TA’S Notes :
1
index
• Intro 1
• Index 2
• Problem Statement 3
• System Analysis 4
• Main Features 4
• Main Modules 5
• SFG Solver 5
• Over all definition 5
• Input format 5
• Output format 5
• Data structures 6
• Algorithms 6
• SFG UI 9
• Over all definition 9
• Input format 9
• Output format 10
• Sample Runs 11
• User Guide 13
2
Problem
Statement
Given:
Signal flow graph representation of the system.
Assume that total number of nodes and numeric
branches gains are given.
Required:
1- Graphical interface.
2- Draw the signal flow graph showing nodes,
branches, gains, …
3- Listing all forward paths, individual loops, all
combination of n non-touching loops.
4- The values of ∆ , ∆1, …, ∆ m where m is
number of forward paths.
5- Overall system transfer function.
3
System
analysis
Main Features:
1. Support strings and doubles as gains.
2. Show all forward paths and loops (all
combinations ) to the user as an output.
3. Show all deltas.
4. Each of the UI and Solver is stand alone able.
5. Speech input (using speech recognition).
6. Speech output (using speech synthesizing).
7. Graphical dynamic output(using swing and AWT).
8. Extensive control commands.
1. Add & delete ( nodes | edges ).
2. Save & load project.
3. Save graph as image.
4. Restart command.
9. Error detection in the UI.
4
System
analysis
Main Modules :
• SFG Solver
SFG Solver is a stand alone able module that
solves a problem of the signal flow graph returning
all forward paths (nodes , String gain & double gain) ,
all single loops (nodes , String gain & double gain),
All combinations of untouched loops (nodes , String
gain & double gain) and all deltas .
• Input format:
The input to this module is a text file
named “Signal flow graph.in” . This file contains
the start node name , the end node name ,
number of all nodes , list of all nodes names ,
number of all edges and list of all edges .
• Output format:
The output of this module is a text file
named “Solution signal flow graph.out”. This file
contains list of all forward paths (nodes , String
gain & double gain) ,list of all single loops
(nodes , String gain & double gain), list of All
combinations of untouched loops (nodes ,
String gain & double gain) and list of all deltas .
5
System
analysis
Main Modules :
• SFG Solver
• Data structures:
• Hash Maps => to map the string named
nodes to integers .
• Graph adj.Matrix => to store the signal
flow graph.
• StringGain => to store and manipulate
String gains.
• Hash sets => to store forward paths and
loops (each hash set store one path)
• Vectors => to store all forward paths
and all single loops
• Vector of vectors => to store all
combinations of untouched loops .
• Algorithms:
• All forward paths:
• Algorithms:
• All Single loops:
DFS (){
loop (node a is element in the graph)
loop (node b in neighbor of a)
visit b
DFS(b,a, gain from a to b)
unvisit b
}
7
System
analysis
Main Modules :
• SFG Solver
• Algorithms:
• All combination of untouched loops:
• Delta
Set delta = 1;
Loop on all loops
if (level is even) delta – =loop gain
else delta +=loop gain
8
System
analysis
Main Modules :
• SFG UI
SFG UI is a stand alone able module that helps
the user to build up the desired signal flow graph to
solve it
• Input format:
The input to this module is speech
and voice commands.
• Start new project
To dump last data and initialize it from the start again
• Add node <letter>
to add node to the graph named by the specified letter
• Delete node <letter>
delete the specified node
• Add edge <letter><number> from <letter> to
<letter> value equals <number> . <number>
add the specified edge between two nodes with value
• Delete edge <letter><number>
delete specified edge
• Show graph
open up a new frame and show the graphs image
• Save graph as <letter><number>
save the graphs as an image
• Save project as <letter><number>
save the whole project data
• Load project <letter><number>
load a save before project
• Solve from <letter> to <letter>
prepare data to the solver and run it
• Close project
9
System
analysis
Main Modules :
• SFG UI
• Output format:
• Speech output
the machine response to the voice
commands telling you what does doing and
weather it faced any problems
• Graphical output
the figure of the graph dynamically
updated with speech input
• Image file output
saving the image of the graph
• Text file output
saving project or preparing data for the
solver
10
Sample
runs
11
Sample
runs
Printing all Forward Paths
a b c d e =>G1 * G10 * G4 * G5=134.4
A b d e =>G1 * G3 * G5=38.4
A e =>G6=2.0
Printing all Single Loops
B =>H86=3.0
B c =>G10 * H1=28.0
B c d =>G10 * G4 * H3=112.0
B d =>G3 * H3=32.0
C =>H2=5.0
C d =>G4 * H4=5.0
D =>H5=2.0
printing all 1 Loops
B =>H86=3.0
B c =>G10 * H1=28.0
B c d =>G10 * G4 * H3=112.0
B d =>G3 * H3=32.0
C =>H2=5.0
C d =>G4 * H4=5.0
D =>H5=2.0
printing all 2 Loops
B c =>H2 * H86=15.0
B c d =>G4 * H4 * H86=15.0
B d =>H5 * H86=6.0
C d =>H2 * H2=25.0
printing all 3 Loops
B c d =>H5 * H2 * H86=30.0
Printing Deltas
Delta = 1 - ( H86 + G10 * H1 + G10 * G4 * H3 + G3 * H3 + H2 + G4 * H4 + H5 ) + ( H2 *
H86 + G4 * H4 * H86 + H5 * H86 + H2 * H2 ) - ( H5 * H2 * H86 ) = -155.0
Printing delta m
Delta = 1 = 1.0
Printing delta m
Delta = 1 - ( H2 ) = -4.0
Printing delta m
Delta = 1 - ( H86 + G10 * H1 + G10 * G4 * H3 + G3 * H3 + H2 + G4 * H4 + H5 ) + ( H2 *
H86 + G4 * H4 * H86 + H5 * H86 + H2 * H2 ) - ( H5 * H2 * H86 ) = -155.0
11
User guide
13