Overview
Comment:Statically declare outputs and initialise to zero.
This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u" (Reduce:see NERO)).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 3a7b40741080b6603bf744ac9c10922a6f7135da0ad106da9485a0ce92b87acf
User & Date: geraint@users.sourceforge.net on 2002-04-15 10:54:31
Other Links: branch diff | manifest | tags
Context
2002-04-16
09:18:29
Added timestamp to std::cerr message when solver fails to converge. check-in: 51fbfa2ec3 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-04-15
10:54:31
Statically declare outputs and initialise to zero.
This is necessary to prevent spurious values from being output when no assignments are made (i.e. when "y(i) := 0 for all u" (Reduce:see NERO)).
check-in: 3a7b407410 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-04-09
12:04:25
Replaced ios:: with std::ios:: for g++-3.0 compatability. check-in: 2720268445 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [a8e7b1c826] to [6009f95c6f].

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21











+
+
+







#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
    ######################################

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.67  2002/04/09 12:04:21  geraint
## Replaced ios:: with std::ios:: for g++-3.0 compatability.
##
## Revision 1.66  2002/03/26 11:58:58  geraint
## Added cputime monitoring.
##
## Revision 1.65  2001/11/15 06:24:11  geraint
## Updated (-i dassl) residual function to use new DAEFunc (octave-2.1.35).
## YZ residual dependency on Ui still requires some work.
##
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066




1067
1068
1069


1070
1071

1072
1073
1074
1075
1076
1077
1078
1059
1060
1061
1062
1063
1064
1065




1066
1067
1068
1069
1070


1071
1072
1073

1074
1075
1076
1077
1078
1079
1080
1081







-
-
-
-
+
+
+
+

-
-
+
+

-
+







#ifndef STANDALONE
      break;
    default:
      usage("${sys}_ode2odes (x par simpar)", nargin);
      error("aborting.");
    }
#endif // STANDALONE
  static ColumnVector	dx (MTTNX);
  static ColumnVector	x (MTTNX);
  static ColumnVector	u (MTTNU);
  static ColumnVector	y (MTTNY);
  static ColumnVector	dx (MTTNX, 0.0);
  static ColumnVector	x (MTTNX, 0.0);
  static ColumnVector	u (MTTNU, 0.0);
  static ColumnVector	y (MTTNY, 0.0);

  static Matrix	AA (MTTNX, MTTNX);
  static ColumnVector	AAx (MTTNX);
  static Matrix	AA (MTTNX, MTTNX, 0.0);
  static ColumnVector	AAx (MTTNX, 0.0);
  
  static ColumnVector	open_switches (MTTNX);
  static ColumnVector	open_switches (MTTNX, 0.0);

  register double t	= 0.0;

  const double	ddt	= dt / stepfactor;
  const int	ilast	= static_cast<int> (round ((last - first) / ddt)) + 1;
  const int	nrows	= static_cast<int> (round ((last - first) / dt)) + 1;

Modified mttroot/mtt/bin/trans/mtt_header from [a0d03d6db5] to [9b53c3c771].

8
9
10
11
12
13
14



15
16
17
18
19
20
21
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24







+
+
+







# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.38  2001/07/23 23:43:15  gawthrop
## header only version does not need to compute sizes from _def.r
##
## Revision 1.37  2001/07/13 04:54:04  geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.36  2001/07/12 04:00:51  gawthrop
## Now zeros y correctly - ie Ny NOT Nx elements
##
## Revision 1.35  2001/06/13 10:39:51  gawthrop
602
603
604
605
606
607
608
609

610
611
612
613

614
615
616
617

618
619
620
621

622
623
624
625

626
627
628
629

630
631
632
633

634
635
636
637

638
639
640
641

642
643
644
645

646
647
648
649

650
651
652
653

654
655
656
657
658
659
660
605
606
607
608
609
610
611

612
613
614
615

616
617
618
619

620
621
622
623

624
625
626
627

628
629
630
631

632
633
634
635

636
637
638
639

640
641
642
643

644
645
646
647

648
649
650
651

652
653
654
655

656
657
658
659
660
661
662
663







-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+



-
+







# Argument specific stuff
get_arg_specific_stuff ()
{
    arg_name=${1:-""}
    case ${arg_name} in
	mtta | mtte)
	    arg_type="Matrix"
	    arg_size="(MTTNX,MTTNX)"
	    arg_init="(MTTNX,MTTNX,0.0)"
	    ;;
	mttb)
	    arg_type="Matrix"
	    arg_size="(MTTNX,MTTNU)"
	    arg_init="(MTTNX,MTTNU,0.0)"
	    ;;
	mttc)
	    arg_type="Matrix"
	    arg_size="(MTTNY,MTTNX)"
	    arg_init="(MTTNY,MTTNX,0.0)"
	    ;;
	mttd)
	    arg_type="Matrix"
	    arg_size="(MTTNY,MTTNU)"
	    arg_init="(MTTNY,MTTNU,0.0)"
	    ;;
	mttax | mttdx | mttedx | mttx | mttopen)
	    arg_type="ColumnVector"
	    arg_size="(MTTNX)"
	    arg_init="(MTTNX,0.0)"
	    ;;
	mttpar)
	    arg_type="ColumnVector"
	    arg_size="(MTTNPAR)"
	    arg_init="(MTTNPAR,0.0)"
	    ;;
	mttsimpar_map)
	    arg_type="Octave_map"
	    arg_size="";
	    arg_init="";
	    ;;
	mttu)
	    arg_type="ColumnVector"
	    arg_size="(MTTNU)"
	    arg_init="(MTTNU,0.0)"
	    ;;
	mttyz)
	    arg_type="ColumnVector"
	    arg_size="(MTTNYZ)"
	    arg_init="(MTTNYZ,0.0)"
	    ;;
	mtty)
	    arg_type="ColumnVector"
	    arg_size="(MTTNY)"
	    arg_init="(MTTNY,0.0)"
	    ;;
	mttt)
	    arg_type="const double"
	    arg_size=""
	    arg_init=""
	    ;;
	nil)
	    arg_type="void *"
	    arg_size="(0x0)"
	    arg_init="(0x0)"
	    ;;
	*)
	    echo "Argument ${arg} not supported - sorry"; exit 1
    esac
}


763
764
765
766
767
768
769
770

771
772
773
774
775
776
777
766
767
768
769
770
771
772

773
774
775
776
777
778
779
780







-
+







    s=${1:-""}					# comma separated output list
    c=`get_field ${s} 0`			# count of outputs
    i=0
    while [ ${i} -lt ${c} ]; do
	i=`expr ${i} + 1`
	w=`get_field ${s} ${i}`		# argument name
	get_arg_specific_stuff ${w}
	printf "  ${arg_type}\t${w}\t${arg_size};\n"
	printf "  static ${arg_type}\t${w}\t${arg_init};\n"
    done
}


return_DLD_outputs ()
{
    s=${1:-""}					# comma separated output list
866
867
868
869
870
871
872
873

874
875
876
877
878
879
880
869
870
871
872
873
874
875

876
877
878
879
880
881
882
883







-
+







    write_DLD_header
    map_DLD_inputs ${args}
    undeclared=`get_extra_fields ${args:-"nil"} ${output:-"nil"}`
    declare_DLD_outputs ${undeclared}
    array2constant
 	case ${arg_type} in
 	    Matrix)
 		printf "  ${w}\t\t\t= zeros ${arg_size};\n"
 		printf "  ${w}\t\t\t= zeros ${arg_init};\n"
 		;;
 	    *)
 		;;
 	esac

    cat <<EOF


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]