%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MDS Modular Design System 1.00 2007 % Th. Fetz, M. Möderl % http://techmath.uibk.ac.at/fetz/downloads/mds.zip % % readme.txt % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Installation: ============= PLEASE ADD THE DIRECTORY mds TO YOUR MATLAB PATH! Generating moduls: ================== 1. By a matrix describing the graph: ------------------------------------ MDS = mds(graph) module defined by matrix graph graph(i,j) defines the connections to and from node (i,j) in the rectangular grid. The connections to the neighbor-nodes are binary coded: 0 no connections 1 connection to the right node 2 connection to the upper node 4 connection to the left node 8 connection to the lower node Example: -o- | is coded by 1+4+8 = 13 2. By generating empty modules and inserting existing modules: -------------------------------------------------------------- Empty modules: MDS = mds(m,n) empty module, size m x n MDS = mds(m,n,dx,dy) empty module, size m x n, gridsize dx, dy Inserting modules: MDS(i,j) = M inserting the module M into module MDS where the upper left node of M is inserted at (i,j) of MDS. Concatenating modules: Column-wise or row-wise concatenating in the same way as matlab matrices but with overlapping columns and rows, respectively, and using operator "or". Example: N = o-o-o M = o-o | | . o-o o-o N = mds([1 5 4; 0 3 4]) M = mds([1 4; 1 6]) MDS = [N, M] = o-o-o-o = [1 5 bitor(4,1) 4; 0 3 bitor(4,1) 6] | | . o-o-o = [1 5 5 4; 0 3 5 6]; Rotating modules: ================= M = rotate(N,1) 90° counterclockwise M = rotate(N,2) 180° counterclockwise M = rotate(N,3) 270° counterclockwise Setting the types of the nodes: =============================== Setting the type of all nodes of the graph: ------------------------------------------- module.nodes.type = TYPE TYPE can be either a value or a matrix of the same size as the module. Allowed values for TYPE: JUNCTIONS RESERVOIRS AUTOCONNECT NONE as defined in mdstypes (this m-file should always be called at the beginning) Nodes are junctions by default. Setting the type of single node (i,j): -------------------------------------- modules.nodes.type(i,j) = TYPE Setting the types of the arcs (connections): ============================================ Arcs are always pipes so far. Setting properties: =================== Setting a property of all nodes of the same type: ------------------------------------------------- module.type.property = value types: junctions, reservoirs properties: as in epanet Example: M.junctions.elev = 10 Setting a property of node (i,j): --------------------------------- module.type.property(i,j) = values Setting a property of all pipes: -------------------------------- module.pipes.property = value properties: as in epanet Example: M.pipes.roughness = 0.4 Setting a property of a single pipe (i,j): ------------------------------------------ horizontal pipes: pipe between node node (i,j) and node (i,j+1) module.hpipes.property(i,j) = value vertical pipes: pipe between node node (i,j) and node (i-1,j) module.vpipes.property(i,j) = value Auto-connecting feature: ======================== Auto-connecting node A: ----------------------- An auto-connecting node is junction with only one connection C to a neighbor node. Applying the function "connect" junctions and pipes are inserted between the auto-connecting node A and the first node reached in the opposite direction of the connection C. The properties of A and C are inherited to the new pipes and junctions inserted. o-A . . . . . . o-o | o N = mds([1 4]); N.nodes.type = [JUNCTIONS AUTOCONNECT]; M = mds([1 12;0 2]); MDS = mds(2,10); MDS(1,1) = N; MDS(9,1) = M; Result: o-A . . . . . . o-o | . . . . . . . . . o MDS = connect(MDS); Result: o-A-o-o-o-o-o-o-o-o | . . . . . . . . . o