Overview
Comment: | Added interface definition rep: _ICD.(txt|c|cc|m). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
16076f51bd70b10c5dff0e72abfd6141 |
User & Date: | geraint@users.sourceforge.net on 2001-04-15 21:15:41 |
Other Links: | branch diff | manifest | tags |
Context
2001-04-16
| ||
22:22:06 | *** empty log message *** check-in: 3fbc81b491 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2001-04-15
| ||
21:15:41 | Added interface definition rep: _ICD.(txt|c|cc|m). check-in: 16076f51bd user: geraint@users.sourceforge.net tags: origin/master, trunk | |
21:09:49 | Corrected number of columns in SciGraphica worksheet. check-in: f8458c2a6a user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/mtt from [3480cd940d] to [218ee5d996].
︙ | ︙ | |||
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | rm -f *_cseo.cc *_input.cc *_simpar.cc *_smxax.cc rm -f *_csex.cc *_numpar.cc *_smxa.cc *_state.cc rm -f *_ode.cc *_odeo.cc rm -f *_logic.m *_logic.cc *_logic.oct rm -f *_state.m *_state.cc *_state.oct rm -f *_ode2odes.* *.dat2 MTT.core rm -f *_modpar.txt *_modpar.r rm -fR *_rep MTT_work exit fi # Clean up named system if [ "$2" = "Clean" ] && [ "$3" = "" ]; then echo 'Removing all generated files for system ' $1 | > | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | rm -f *_cseo.cc *_input.cc *_simpar.cc *_smxax.cc rm -f *_csex.cc *_numpar.cc *_smxa.cc *_state.cc rm -f *_ode.cc *_odeo.cc rm -f *_logic.m *_logic.cc *_logic.oct rm -f *_state.m *_state.cc *_state.oct rm -f *_ode2odes.* *.dat2 MTT.core rm -f *_modpar.txt *_modpar.r rm -f *_ICD.txt *_ICD.c *_ICD.cc *_ICD.m rm -fR *_rep MTT_work exit fi # Clean up named system if [ "$2" = "Clean" ] && [ "$3" = "" ]; then echo 'Removing all generated files for system ' $1 |
︙ | ︙ | |||
1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | rm -f $1_cseo.cc $1_input.cc $1_simpar.cc $1_smxax.cc rm -f $1_csex.cc $1_numpar.cc $1_smxa.cc $1_state.cc rm -f $1_ode.cc $1_odeo.cc rm -f $1_logic.m $1_logic.cc $1_logic.oct rm -f $1_state.m $1_state.cc $1_state.oct rm -f $1_ode2odes.* $1.dat2 rm -f $1_modpar.txt $1_modpar.r rm -fR $1_rep MTT_work exit fi if [ "$2" = "rep" ]; then documenttype=article # See if we are making a book -- ie representation rep on a directory | > | 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | rm -f $1_cseo.cc $1_input.cc $1_simpar.cc $1_smxax.cc rm -f $1_csex.cc $1_numpar.cc $1_smxa.cc $1_state.cc rm -f $1_ode.cc $1_odeo.cc rm -f $1_logic.m $1_logic.cc $1_logic.oct rm -f $1_state.m $1_state.cc $1_state.oct rm -f $1_ode2odes.* $1.dat2 rm -f $1_modpar.txt $1_modpar.r rm -f $1_ICD.txt $1_ICD.c $1_ICD.cc $1_ICD.m rm -fR $1_rep MTT_work exit fi if [ "$2" = "rep" ]; then documenttype=article # See if we are making a book -- ie representation rep on a directory |
︙ | ︙ | |||
1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 | #SUMMARY modpar name modulated parameters for each subsystem (r) $1_modpar.r: $1_modpar.txt $1_struc.txt modpar_txt2r $1 #SUMMARY alias name aliases for each subsystem (m) $1_alias.m: $1_alias.txt alias_txt2m $1 #SUMMARY cr constitutive relationship for each subsystem (txt) $1_cr.txt: $1_abg.m $1_sub.sh abg2cr_m2txt $1 if [ "$level" = "0" ]; then \ mv $1_cr.txt MTT_cr.txt; \ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 | #SUMMARY modpar name modulated parameters for each subsystem (r) $1_modpar.r: $1_modpar.txt $1_struc.txt modpar_txt2r $1 #SUMMARY alias name aliases for each subsystem (m) $1_alias.m: $1_alias.txt alias_txt2m $1 ##SUMMARY ICD interface definition for system (c) ##SUMMARY ICD interface definition for system (cc) ##SUMMARY ICD interface definition for system (m) ##SUMMARY ICD interface definition for system (txt) $1_ICD.c: $1_ICD.txt ICD_txt2lang.sh $1 c $1_ICD.cc: $1_ICD.txt ICD_txt2lang.sh $1 cc $1_ICD.m: $1_ICD.txt ICD_txt2lang.sh $1 m $1_ICD.txt: $1_icd.txt2 icd2ICD_txt22txt.sh $1 $1_icd.txt2: $1_cbg.m touch $1_icd.txt2 #SUMMARY ICD interface definitions for each subsystem (m) $1_icd.m: $1_icd.txt icd_txt2m.sh $1 #SUMMARY ICD interface definitions for each subsystem (txt) $1_icd.txt: $1_lbl.txt lbl2icd_txt2txt.sh $1 #SUMMARY cr constitutive relationship for each subsystem (txt) $1_cr.txt: $1_abg.m $1_sub.sh abg2cr_m2txt $1 if [ "$level" = "0" ]; then \ mv $1_cr.txt MTT_cr.txt; \ |
︙ | ︙ | |||
2282 2283 2284 2285 2286 2287 2288 | sub_sh2tex -l $1 endif #SUMMARY abg acausal bond graph (m) #Raw bond graph to acausal bond graph: mfile ifneq ($start_at_abg,yes) | | | 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | sub_sh2tex -l $1 endif #SUMMARY abg acausal bond graph (m) #Raw bond graph to acausal bond graph: mfile ifneq ($start_at_abg,yes) $1_abg.m: $1_rbg.m $1_alias.m $1_cmp.m $1_icd.m cmp2sub_m2sh $1 (sh $1_sub.sh "mtt $mtt_switches -q -u -l $level+1 " ' abg m null || exit 1') || exit 1 rbg2abg_m $info_switch $1 endif #SUMMARY cbg* causal bond graph (m) #Acausal bond graph to causal bond graph: mfile |
︙ | ︙ | |||
2310 2311 2312 2313 2314 2315 2316 | #SUMMARY def definitions - system orders etc. (r) #SUMMARY def definitions - system orders etc. (m) #SUMMARY def definitions - system orders etc. (h) #SUMMARY struc* structure - list of inputs, outputs and states (txt) #SUMMARY struc structure - list of inputs, outputs and states (tex) #SUMMARY struc* structure - list of inputs, outputs and states (view) #Elementary system equations + definitions | | | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 | #SUMMARY def definitions - system orders etc. (r) #SUMMARY def definitions - system orders etc. (m) #SUMMARY def definitions - system orders etc. (h) #SUMMARY struc* structure - list of inputs, outputs and states (txt) #SUMMARY struc structure - list of inputs, outputs and states (tex) #SUMMARY struc* structure - list of inputs, outputs and states (view) #Elementary system equations + definitions ${sys}_ese.r: ${sys}_cbg.m cbg2ese_m2r $partition $info_switch $Subsystem; #ese_tidy $1 $1_def.r: $1_ese.r touch $1_def.r $1_struc.txt: $1_ese.r touch $1_struc.txt $1_aliased.txt: $1_ese.r |
︙ | ︙ |
Added mttroot/mtt/bin/trans/ICD_txt2lang.sh version [456d58a25f].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #! /bin/sh sys=$1 lang=$2 ICD=${sys}_ICD.${lang} txt=${sys}_ICD.txt struc=${sys}_struc.txt case ${lang} in c) lb='['; rb=']'; offset=0; comment='//';; cc) lb='('; rb=')'; offset=1; comment='//';; m) lb='('; rb=')'; offset=0; comment='#';; *) echo Language ${lang} not yet supported.; exit -1;; esac echo Creating ${ICD} cat <<EOF > ${ICD} ${comment} Interface Control Definition mappings for system ${sys} ${comment} ${ICD}: Generated by MTT `date` EOF # ICD.txt Format: # Input|Output ICD_Name PortName Causality: causality Units: units # $1 $2 $3 $4 $5 $6 $7 cat <<EOF >> ${ICD} ${comment} Inputs EOF for name in `cat ${txt} | awk '($1 == "Input:") { print $3 }'` do num=`grep ${name} ${struc} | awk '($1 == "input") { print $2 }'` grep ^Input ${txt} |\ awk '($3 == name) { printf ("\tmttu%c%d%c\t= %s;\n", lb, num-offset, rb, $2) }'\ lb=${lb} rb=${rb} name=${name} num=${num} offset=${offset} >> ${ICD} done cat <<EOF >> ${ICD} ${comment} Outputs EOF for name in `cat ${txt} | awk '($1 == "Output:") { print $3 }'` do num=`grep ${name} ${struc} | awk '($1 == "output") { print $2 }'` grep ^Output ${txt} |\ awk '($3 == name) { printf ("\t%-30s = mtty%c%d%c;\n", $2, lb, num-offset, rb) }'\ lb=${lb} rb=${rb} name=${name} num=${num} offset=${offset} >> ${ICD} done |
Added mttroot/mtt/bin/trans/icd2ICD_txt22txt.sh version [2134e4a645].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #! /bin/sh sys=$1 icd=${sys}_*_icd.txt2 ICD=${sys}_ICD.txt echo Creating ${ICD} # lbl.txt ICD Format: # [#|%]ICD PortName EffortName,EffortUnit;FlowName,FlowUnit # $1 $2 $3 # Comma / Semi-colon distinction unenforced # icd.txt Format # PortName EffortName,EffortUnit;FlowName,FlowUnit input|output,input|output # $1 $2 $3 $4 $5 $6 $7 cat <<EOF > ${ICD} ## Interface Control Definition for System ${sys} ## ${ICD}: Generated by MTT `date` EOF cat ${icd} |\ sed 's/[\,\;]/\ /g' |\ awk ' ($2 != "null" && $6 == "input") { printf ("Input: %-30s %-30s Causality: Effort Units: %s\n", $2, $1, $3) } ($4 != "null" && $7 == "input") { printf ("Input: %-30s %-30s Causality: Flow Units: %s\n", $4, $1, $5) } ($2 != "null" && $6 == "output") { printf ("Output: %-30s %-30s Causality: Effort Units: %s\n", $2, $1, $3) } ($4 != "null" && $7 == "output") { printf ("Output: %-30s %-30s Causality: Flow Units: %s\n", $4, $1, $5) } ' | sort >> ${ICD} |
Added mttroot/mtt/bin/trans/icd_txt2m.sh version [cb0a719b07].
> > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #! /bin/sh # Inform user echo Creating $1_icd.m #Create the component ICD file complete with headers. echo "function icd = $1_icd" > $1_icd.m echo "%% Component icd file ($1_icd.m)" >> $1_icd.m echo "%% Generated by MTT at `date`" >> $1_icd.m #Write out the variables awk '{ if (NF==2) {i++; print "icd."$1 "\t = \""$2"\";"} } END{ if (i==0) print "icd = 0;" }' $1_icd.txt >> $1_icd.m |
Added mttroot/mtt/bin/trans/lbl2icd_txt2txt.sh version [90cc5ce192].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: lbl2icd_txt2txt # Creates the component ICDs in text form # Adapted from lbl2alias_txt2txt sys=$1 icd=${sys}_icd.txt lbl=${sys}_lbl.txt # Inform user echo Creating ${icd} #Create the ICD file complete with headers. echo "# Component ICD file ($1_icd.txt)" > ${icd} echo "# Generated by MTT at `date`" >> ${icd} #Write out the variables grep '[%|#]ICD' ${lbl} |\ awk '{ if (match($3,"/")==0){ if (match($2,"\\$")==0){ icd=$2; name =$3 } else{ icd=$3; name =$2 } n=split(icd,a,"|"); for (i=1; i<=n; i++) print a[i] "\t" name; } } END{ print "###_END_OF_ICD_###" }' >> ${icd} |
Modified mttroot/mtt/bin/trans/m/cbg2ese.m from [0f84dd5371] to [332487e2b1].
︙ | ︙ | |||
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.40 2000/12/16 08:10:55 geraint ## ## No unit type comparison at ports if either is "none". ## ## ## ## Revision 1.39 2000/11/16 12:54:14 peterg ## ## Added checking of unit consistency at ports ## ## ## ## Revision 1.38 2000/11/16 10:00:57 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.40 2001/02/05 01:50:29 geraint ## ## No unit type comparison at ports if either is "none". ## ## ## ## Revision 1.40 2000/12/16 08:10:55 geraint ## ## No unit type comparison at ports if either is "none". ## ## ## ## Revision 1.39 2000/11/16 12:54:14 peterg ## ## Added checking of unit consistency at ports ## ## ## ## Revision 1.38 2000/11/16 10:00:57 peterg |
︙ | ︙ | |||
192 193 194 195 196 197 198 | disp([cbg_name, " does not exist"]); return end; ## Setup files ese_name = [full_name_repetition, "_ese.r"]; ese_file = fopen(ese_name, "w") # open file (first time) | > | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | disp([cbg_name, " does not exist"]); return end; ## Setup files ese_name = [full_name_repetition, "_ese.r"]; ese_file = fopen(ese_name, "w") # open file (first time) icd_file = fopen([full_name_repetition,"_icd.txt2"],"w") fprintf(ese_file, "\n%s%s Equation file for system %s (file %s)\n", ... pc, pc, full_name_repetition, ese_name); fprintf(ese_file, "%s%s Generated by MTT\n\n", pc, pc); ## Evaluate the system function to get the bonds eval(["CBG = ", cbg_name, ";"]); ##eval(["[bonds,status,system_type,components] = ", cbg_name, ";"]); |
︙ | ︙ | |||
283 284 285 286 287 288 289 | if AliasingCRs # Alias the CR list if appropriate message = sprintf("\tfor component %s (%s) within %s",\ comp_name,subsystem.type,full_name); if struct_contains(CBG,"alias") subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name); endif; endif; | | | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | if AliasingCRs # Alias the CR list if appropriate message = sprintf("\tfor component %s (%s) within %s",\ comp_name,subsystem.type,full_name); if struct_contains(CBG,"alias") subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name); endif; endif; ## Substitute positional ($1 etc) arguments subsystem.cr = subs_arg(subsystem.cr,system_cr, ... "lin",full_name,subsystem.type,comp_name,infofilenum); subsystem.arg = subs_arg(subsystem.arg,system_args, ... "1",full_name,subsystem.type,comp_name,infofilenum); ## change name of 0 and 1 components -- matlab doesn't like numbers here |
︙ | ︙ | |||
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | structure_name(which_index,:), value-k+1, ... comp_name, full_name_repetition, comp_name, repetition); endfor; endfor; endif; endif endfor endfor # [subsystem,comp_name] = CBG_field endif # struct_contains(CBG,field) endfor # i=1:2 fclose(ese_file); # Close endfunction | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | structure_name(which_index,:), value-k+1, ... comp_name, full_name_repetition, comp_name, repetition); endfor; endfor; endif; endif endfor ## component interface definition if struct_contains(CBG,"icd") if struct_contains(CBG.icd,comp_name) if AliasingArguments subsystem.icd = alias_args(eval(["CBG.icd.",comp_name]),CBG.alias,";",message,infofilenum,full_name); endif endif if (struct_contains(subsystem,"icd")) subsystem.icd = subs_arg(subsystem.icd,system_args, ... "null",full_name,subsystem.type,comp_name,infofilenum); fprintf(icd_file,"%s_%s\t%s\t",full_name_repetition,comp_name,subsystem.icd); if (comp_bonds(1) == 1) fprintf(icd_file,"output,"); elseif (comp_bonds(1) == -1) fprintf(icd_file,"input,"); endif if (comp_bonds(2) == 1) fprintf(icd_file,"input\n"); elseif (comp_bonds(2) == -1) fprintf(icd_file,"output\n"); endif endif endif # End of component interface definition endfor # [subsystem,comp_name] = CBG_field endif # struct_contains(CBG,field) endfor # i=1:2 fclose(icd_file); fclose(ese_file); # Close endfunction |
Modified mttroot/mtt/bin/trans/m/write_abg.m from [c42598280f] to [e3b347e99b].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function write_abg(system_name,bonds,connections,n_vector_bonds); ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.7 1999/10/18 05:16:51 peterg ## Now vectorises 0 and 1 junctions !! ## ## Revision 1.6 1998/09/02 11:35:20 peterg ## Removed port.index field ## ## Revision 1.5 1998/09/02 10:30:30 peterg | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function write_abg(system_name,bonds,connections,n_vector_bonds); ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.8 1999/10/18 22:41:41 peterg ## Corrected vector junction expansion ## ## Revision 1.7 1999/10/18 05:16:51 peterg ## Now vectorises 0 and 1 junctions !! ## ## Revision 1.6 1998/09/02 11:35:20 peterg ## Removed port.index field ## ## Revision 1.5 1998/09/02 10:30:30 peterg |
︙ | ︙ | |||
76 77 78 79 80 81 82 | SubsystemList = [SubsystemList; new_name]; fprintf(fid,"\n# Component %s\n", new_name); fprintf(fid,Sformat,system_name,new_name,"type",comp_type); fprintf(fid,Sformat,system_name,new_name,"cr",cr); fprintf(fid,Sformat,system_name,new_name,"arg",arg); fprintf(fid,Iformat,system_name,new_name,"repetitions",repetitions); fprintf(fid,Iformat,system_name,new_name,"status",-1); | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | SubsystemList = [SubsystemList; new_name]; fprintf(fid,"\n# Component %s\n", new_name); fprintf(fid,Sformat,system_name,new_name,"type",comp_type); fprintf(fid,Sformat,system_name,new_name,"cr",cr); fprintf(fid,Sformat,system_name,new_name,"arg",arg); fprintf(fid,Iformat,system_name,new_name,"repetitions",repetitions); fprintf(fid,Iformat,system_name,new_name,"status",-1); ##Connections fprintf(fid,Cformat,system_name,new_name); ## Each vector junction has n*m bonds ## n - dimension of vector ## m - number of bonds ## The first m bonds (in c) correspond to the first vector element |
︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | fprintf(fid,PSformat,system_name,name_i,"arg",arg); fprintf(fid,PIformat,system_name,name_i,"repetitions",repetitions); fprintf(fid,PIformat,system_name,name_i,"status",-1); fprintf(fid,PCformat,system_name,name_i); fprintf(fid,"%i ", c(i_port)); fprintf(fid,"];\n"); endfor; endif; endfor; [N,M]=size(PortList); if N>0 # Put name in list fprintf(fid,"\n# Ordered list of Port names\n"); | > | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | fprintf(fid,PSformat,system_name,name_i,"arg",arg); fprintf(fid,PIformat,system_name,name_i,"repetitions",repetitions); fprintf(fid,PIformat,system_name,name_i,"status",-1); fprintf(fid,PCformat,system_name,name_i); fprintf(fid,"%i ", c(i_port)); fprintf(fid,"];\n"); endfor; endif; endfor; [N,M]=size(PortList); if N>0 # Put name in list fprintf(fid,"\n# Ordered list of Port names\n"); |
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 | fprintf(fid,"# A double underscore __ represents a comma \n"); eval(["alias = ", system_name, "_alias;"]); if is_struct(alias) for [val,key] = alias fprintf(fid,"%s.alias.%s = \"%s\";\n", system_name,key,val); endfor endif fclose(fid); | > > > > > > > > > | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | fprintf(fid,"# A double underscore __ represents a comma \n"); eval(["alias = ", system_name, "_alias;"]); if is_struct(alias) for [val,key] = alias fprintf(fid,"%s.alias.%s = \"%s\";\n", system_name,key,val); endfor endif fprintf(fid,"\n# Interface Definition\n"); eval(["icd = ",system_name, "_icd;"]); if is_struct(icd) for [val,key] = icd fprintf(fid,"%s.icd.%s = \"%s\";\n",system_name,key,val); endfor endif fclose(fid); |