Overview
Comment: | Now uses mtt_cbg |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f9deba8c3b8fd02e7ea4adea802ebbe4 |
User & Date: | gawthrop@users.sourceforge.net on 2003-03-14 12:45:16 |
Other Links: | branch diff | manifest | tags |
Context
2003-03-14
| ||
12:49:50 | Reads the cbg data structure form a file check-in: 1722ffefcb user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
12:45:16 | Now uses mtt_cbg check-in: f9deba8c3b user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
2003-03-13
| ||
16:34:40 | New simple example of herachical rc circuit check-in: e8e3feec68 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/mtt_component_eqn.m from [adbc638c46] to [6345e1c4b6].
|
| | > | 1 2 3 4 5 6 7 8 9 | function [known] = mtt_component_eqn (fullname, port, causality, \ known, Cbg) ## function [known] = mtt_component_eqn (fullname, port, causality, known) ## ## Recursively finds the equations giving the signal of specified ## causality on the specified port of component named "name" within ## subsystem Name |
︙ | ︙ | |||
32 33 34 35 36 37 38 | endif eqn="## No equation -- something wrong"; # Default if length(known)<2 # Invalid known = " "; endif | | < < | < < < < < < | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | endif eqn="## No equation -- something wrong"; # Default if length(known)<2 # Invalid known = " "; endif cbg = mtt_cbg(Name); # Structure for this subsystem if struct_contains (cbg, "ports") ## Combine ports with the other subsystems for [component_structure, component] = cbg.ports eval(sprintf("cbg.subsystems.%s=cbg.ports.%s;",component,component)); endfor endif |
︙ | ︙ | |||
66 67 68 69 70 71 72 | if port>N_ports error(sprintf("port (%i) > N_ports (%i)", port, N_ports)); else # Get name and find equation name = deblank(cbg.portlist(port,:)); if DEBUG disp("----> lower-level system") endif | | > | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | if port>N_ports error(sprintf("port (%i) > N_ports (%i)", port, N_ports)); else # Get name and find equation name = deblank(cbg.portlist(port,:)); if DEBUG disp("----> lower-level system") endif known = mtt_component_eqn (mtt_fullname(Name,name), 1, \ causality, known, cbg); return endif endif ## Other causality representations if strcmp(causality,"effort") |
︙ | ︙ | |||
174 175 176 177 178 179 180 | port_index = i; break; endif endfor ## File containing data structure NAME = mtt_subname(Name); | < | < < < < < < < | | | > | 168 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 | port_index = i; break; endif endfor ## File containing data structure NAME = mtt_subname(Name); CBG = mtt_cbg(NAME); ## And to which component (at higher level) is it connected? [new_Name,new_name] = mtt_subname(Name); port_bond = eval(sprintf("CBG.subsystems.%s.connections(%i);", new_name, port_index)); [in_name, in_port, in_bond] = mtt_other_end (new_name,port_bond,CBG); ## Find its equation if DEBUG disp("----> higher level system") endif known = mtt_component_eqn (mtt_fullname(new_Name,in_name), \ in_port, causality, known, cbg); LHS = Source_seqn ("external",Name); RHS = varname(NAME, abs(in_bond), i_cause); eqn = sprintf("%s%s%s := %s;", LHS, SD, name, RHS); if !DEBUG comment = sprintf("%s PORT", CD); |
︙ | ︙ | |||
222 223 224 225 226 227 228 | ## Do the equations [eqn,insigs,innames] = eval(sprintf("%s_seqn (Name, name, cr, arg, outsig, insigs, innames);", comp_type)); else # Compound component new_NAME = Name; new_Name = mtt_fullname(Name,name); new_name = ""; | | < | < < < < < < | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | ## Do the equations [eqn,insigs,innames] = eval(sprintf("%s_seqn (Name, name, cr, arg, outsig, insigs, innames);", comp_type)); else # Compound component new_NAME = Name; new_Name = mtt_fullname(Name,name); new_name = ""; ## Get relevant data structure Cbg = mtt_cbg(new_Name); port_name = Cbg.portlist(port,:); LHS = varname(Name, outsig(1,1), outsig(1,2)); RHS = Sensor_seqn ("external",new_Name); eqn = sprintf("%s := %s%s%s;", LHS, RHS, SD, port_name); if DEBUG disp("----> same-level subsystem") endif [known] = mtt_component_eqn \ (mtt_fullname(new_Name,new_name), port, causality, known, cbg); endif endif comment = \ sprintf("%s Equation for %s signal on port %i of %s (%s), subsystem %s.", \ CD, causality, port, name, comp_type, Name); |
︙ | ︙ | |||
275 276 277 278 279 280 281 | other_name = deblank(innames(i,:)); if DEBUG disp("----> same-level component") endif [known] = mtt_component_eqn \ | | > | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | other_name = deblank(innames(i,:)); if DEBUG disp("----> same-level component") endif [known] = mtt_component_eqn \ (mtt_fullname(Name,other_name), other_port, other_causality, \ known, cbg); endfor endif ## Write this signal ##comment_2 = sprintf("Connected to:%s", in_component_list); if !DEBUG disp(sprintf("%s\n%s",comment, eqn)); endif endfunction |