Overview
Comment: | Added checking of unit consistency at ports |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
288900023b60589e88ed84157a57f917 |
User & Date: | gawthrop@users.sourceforge.net on 2000-11-16 12:54:14 |
Other Links: | branch diff | manifest | tags |
Context
2000-11-16
| ||
13:11:06 | Included PAR and UNITS declarations check-in: b1b80ff2c0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
12:54:14 | Added checking of unit consistency at ports check-in: 288900023b user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
10:00:57 | *** empty log message *** check-in: 30c700bc08 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/cbg2ese.m from [8e7282c25e] to [8a034728b2].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Structure matrix [states,nonstates,inputs,outputs,zero_outputs] ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ ## ## Revision 1.37 2000/11/12 16:45:57 peterg ## ## Close ese file before recursive call of cbg2ese -- reopen when ## ## finished. ## ## THis prevents a new file being opened for each subsystem which fails ## ## when > 1K files opened ## ## ## ## Revision 1.36 2000/10/13 10:54:47 peterg | > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ## Structure matrix [states,nonstates,inputs,outputs,zero_outputs] ## ############################################################### ## ## Version control history ## ############################################################### ## ## $Id$ ## ## $Log$ ## ## Revision 1.38 2000/11/16 10:00:57 peterg ## ## *** empty log message *** ## ## ## ## Revision 1.37 2000/11/12 16:45:57 peterg ## ## Close ese file before recursive call of cbg2ese -- reopen when ## ## finished. ## ## THis prevents a new file being opened for each subsystem which fails ## ## when > 1K files opened ## ## ## ## Revision 1.36 2000/10/13 10:54:47 peterg |
︙ | ︙ | |||
145 146 147 148 149 150 151 | ## ## ## ############################################################# ## disp("cbg2ese"); ## system_name, system_type, full_name, repetition pc = "%"; | > > | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ## ## ## ############################################################# ## disp("cbg2ese"); ## system_name, system_type, full_name, repetition pc = "%"; unit_error = "Component %s connects inconsistent ports with units %s and %s" unit_info = "Component %s connects ports with units %s and %s" ## Set up the names corresponding to the structure matrix. structure_name = [ "state ", "nonstate ", "input ", "output ", "zero_output ", |
︙ | ︙ | |||
201 202 203 204 205 206 207 | ## eval(["[junk,components]=", abg_name, ";"]); ## Find number of bonds [n_bonds,columns] = size(CBG.bonds); if (columns ~= 2)&(n_bonds>0) error("Incorrect bonds matrix: must have 2 columns"); endif; | | > > > > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | ## eval(["[junk,components]=", abg_name, ";"]); ## Find number of bonds [n_bonds,columns] = size(CBG.bonds); if (columns ~= 2)&(n_bonds>0) error("Incorrect bonds matrix: must have 2 columns"); endif; ## Set up initial bond units for i=1:n_bonds bond_effort_unit(i,:)="null"; bond_flow_unit(i,:)="null"; endfor ## ## Find number of components ## [n_components,columns] = size(components); ## n_components = n_components ## Set up the first dummy bond number - needed for repetative components ## next_bond = max(max(abs(components)))+1; next_bond = n_bonds+1; |
︙ | ︙ | |||
332 333 334 335 336 337 338 | structure = cbg2ese(comp_name, subsystem.type, subsystem.cr, subsystem.arg, ... full_name, full_name_repetition, ... k, structure, structure_file, infofilenum); disp("---POP---"); ese_file = fopen(ese_name, "a") # open file (again) | > > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | structure = cbg2ese(comp_name, subsystem.type, subsystem.cr, subsystem.arg, ... full_name, full_name_repetition, ... k, structure, structure_file, infofilenum); disp("---POP---"); ese_file = fopen(ese_name, "a") # open file (again) eval(["subABG = ",subsystem.type , "_abg;"]); # Get the information ## Link up the bonds for this compound component fprintf(ese_file, ... "\n\t%s Equations linking up subsystem %s (%s)\n\n", ... pc, comp_name, subsystem.type); name_comp_name = sprintf("%s_%s_%d", ... full_name_repetition, comp_name, k); printf("\n\t%s Equations linking up subsystem %s (%s)\n\n",\ pc, comp_name, subsystem.type); u_index = 0; y_index = 0; ## Count the inputs and outputs for port_number=1:length(bond_list) port_bond_number = bond_list(port_number); this_bond_effort_unit = \ deblank(bond_effort_unit(port_bond_number,:)); this_bond_flow_unit = \ deblank(bond_flow_unit(port_bond_number,:)); ## Extract the unit/domain stuff this_port_name = subABG.portlist(port_number,:); eval(sprintf("this_port = subABG.ports.%s;", \ this_port_name)); if struct_contains(this_port,"units") eval(["effort_unit = \ subABG.ports.",this_port_name,".units.effort;"]); eval(["flow_unit = \ subABG.ports.",this_port_name,".units.flow;"]); else effort_unit = "none"; flow_unit = "none"; endif ## and check consistency ## Efforts if strcmp(this_bond_effort_unit,"null") # set bond_effort_unit = \ [bond_effort_unit(1:port_bond_number-1,:) effort_unit bond_effort_unit(port_bond_number+1:n_bonds,:) ] else # check mtt_info(sprintf(unit_info,full_name, effort_unit, \ this_bond_effort_unit), infofilenum); if !strcmp(this_bond_effort_unit,effort_unit) error_string = sprintf(unit_error, full_name,\ effort_unit, \ this_bond_effort_unit); mtt_error(error_string); endif endif ## Flows if strcmp(this_bond_flow_unit,"null") # set bond_flow_unit = \ [bond_flow_unit(1:port_bond_number-1,:) flow_unit bond_flow_unit(port_bond_number+1:n_bonds,:) ] else # check mtt_info(sprintf(unit_info,full_name, flow_unit, \ this_bond_flow_unit), infofilenum); if !strcmp(this_bond_flow_unit,flow_unit) error_string = sprintf(unit_error, full_name,\ flow_unit, \ this_bond_flow_unit); mtt_error(error_string); endif endif ## Effort if comp_bonds(port_number,1)==1 # Source u_index = u_index + 1; fprintf(ese_file, "%s_MTTu%d := %s;\n", ... name_comp_name, u_index, varname(name_r, ... bond_list(port_number),1)); else # Sensor |
︙ | ︙ |