Overview
Comment: | Added aliasing and causality (vectorisation is still to do). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ea5ae4fbd13558ffaee72e12135f3e43 |
User & Date: | geraint@users.sourceforge.net on 2003-01-31 11:49:22 |
Other Links: | branch diff | manifest | tags |
Context
2003-02-06
| ||
20:28:40 | Added -ibg switch to aid testing during development of ibg2abg.m check-in: 20a748db45 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2003-01-31
| ||
11:49:22 | Added aliasing and causality (vectorisation is still to do). check-in: ea5ae4fbd1 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2003-01-29
| ||
23:31:58 | Started adding rbg2abg functionality to ibg2abg. check-in: 02c5ae953c user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/ibg2abg.m from [55f6b30f06] to [eef811202d].
︙ | ︙ | |||
15 16 17 18 19 20 21 | for i = 1:n_bonds eval(sprintf("bond = bonds.b%i", i)); ## heads head_type_name = bond.head.component; head_type_name = deblank(split(head_type_name, ":")); | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | for i = 1:n_bonds eval(sprintf("bond = bonds.b%i", i)); ## heads head_type_name = bond.head.component; head_type_name = deblank(split(head_type_name, ":")); head_type = deblank(head_type_name(1,:)); head_name = deblank(head_type_name(2,:)); if (exist("component_struct")) if (struct_contains(component_struct, head_name)) ## create a copy to work on - clearer than eval(sprintf(...)) ## (pointers would be better still!) eval(sprintf("head = component_struct.%s;", head_name)); endif endif |
︙ | ︙ | |||
45 46 47 48 49 50 51 | head.n_bonds) eval(sprintf("component_struct.%s = head", head_name)); clear head; ## tails tail_type_name = bond.tail.component; tail_type_name = deblank(split(tail_type_name, ":")); | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | head.n_bonds) eval(sprintf("component_struct.%s = head", head_name)); clear head; ## tails tail_type_name = bond.tail.component; tail_type_name = deblank(split(tail_type_name, ":")); tail_type = deblank(tail_type_name(1,:)); tail_name = deblank(tail_type_name(2,:)); if (exist("component_struct")) if (struct_contains(component_struct, tail_name)) ## create a copy to work on - clearer than eval(sprintf(...)) tail = eval(sprintf("tail = component_struct.%s", tail_name)); endif endif tail.type = tail_type; |
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | eval(sprintf("tail.ports.bond%i.name = '%s'", i, bond.tail.ports)); eval(sprintf("tail.ports.bond%i.sign = '[out]'", i)); max_bonds_on_component = max(max_bonds_on_component, \ tail.n_bonds); eval(sprintf("component_struct.%s = tail", tail_name)); clear tail; endfor ## Get component indices from sys_cmp.m [n_components, junk] = size(struct_elements(component_struct)); for i = 1:n_components [comp_type, comp_name] = eval(sprintf("%s_cmp(%i)", name, i)); eval(sprintf("component_struct.%s.index = %i", comp_name, i)); endfor ## Create the connections matrix (components) components = zeros(n_components, max_bonds_on_component); for [comp, comp_name] = component_struct components(comp.index,1:comp.n_bonds) = comp.bonds; endfor for [comp, comp_name] = component_struct | > > > > > > > > > > > > > > > > > | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | eval(sprintf("tail.ports.bond%i.name = '%s'", i, bond.tail.ports)); eval(sprintf("tail.ports.bond%i.sign = '[out]'", i)); max_bonds_on_component = max(max_bonds_on_component, \ tail.n_bonds); eval(sprintf("component_struct.%s = tail", tail_name)); clear tail; ## causality if (bond.causality.effort == "head") causality(i,1) = +1; elseif (bond.causality.effort == "tail") causality(i,1) = -1; else causality(i,1) = 0; endif if (bond.causality.flow == "head") causality(i,2) = -1; elseif (bond.causality.flow == "tail") causality(i,2) = +1; else causality(i,2) = 0; endif endfor ## Get component indices from sys_cmp.m [n_components, junk] = size(struct_elements(component_struct)); for i = 1:n_components [comp_type, comp_name] = eval(sprintf("%s_cmp(%i)", name, i)); eval(sprintf("component_struct.%s.index = %i", comp_name, i)); endfor ## Create the connections matrix (components) components = zeros(n_components, max_bonds_on_component); for [comp, comp_name] = component_struct components(comp.index,1:comp.n_bonds) = comp.bonds; endfor for [comp, comp_name] = component_struct ## default port names if ((strcmp(deblank(comp.type), "0")) || (strcmp(deblank(comp.type), "1"))) disp("---- default junctions ----"); if (comp.named_ports == 1) # one named port for [port, bond_number] = comp.ports if (!strcmp(port.name,"[]")) junction_port_name = port.name; endif |
︙ | ︙ | |||
152 153 154 155 156 157 158 | deblank(comp.type) ")"], infofile); eval(sprintf("comp.ports.%s.name = \ unlabelled_port2.sign", bond_number2)); mtt_info(["Defaulting port name [" unlabelled_port2.sign "]\t on component " comp_name " (" \ deblank(comp.type) ")"], infofile); endif | > | > > > > > > > > > > > > > > > > | > > | | > > > > > > > > | > > > > > > | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | deblank(comp.type) ")"], infofile); eval(sprintf("comp.ports.%s.name = \ unlabelled_port2.sign", bond_number2)); mtt_info(["Defaulting port name [" unlabelled_port2.sign "]\t on component " comp_name " (" \ deblank(comp.type) ")"], infofile); endif endif ## strip port names of blanks and [] for [port, port_name] = comp.ports eval(sprintf("comp.ports.%s.name = \ mtt_strip_name(comp.ports.%s.name)", port_name, port_name)); endfor ## replace aliases eval(sprintf("alias = %s_alias", comp.type)) if (is_struct(alias)) for [port, port_name] = comp.ports if (struct_contains(alias,port_name)) eval(sprintf("new_port_name = alias.%s", port.name)) mtt_info(sprintf("Aliasing name [%s]\t on component %s (%s) to \ [%s]", port.name, comp_name, comp.type, new_port_name), \ infofile); eval(sprintf("comp.ports.%s.name = new_port_name", port_name)) endif endfor endif endif eval(sprintf("component_struct.%s = comp", comp_name)); endfor ## All ports should bow be labelled disp("--- Completed portnames and the corresponding bonds ---"); ## Create list of bonds bonds = causality; ## Find number of bonds on each component BEFORE vectorisation for [comp, comp_name] = component_struct n_vector_bonds(comp.index) = comp.n_bonds; endfor ## Now expand vector ports disp("Expanding vector ports"); disp("... but not today!"); ## ??? components; n_vector_bonds = 1; endfunction |