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: 2b99562b306d7a1cc9fdaa9e17013da1ea10f4cfefaf2900f4be0b78b5a2ac99
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: f9fd1f0ee6 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: 2b99562b30 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: c832ca2971 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
#! /bin/sh

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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## 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.
##











>
>
>







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
#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 Matrix	AA (MTTNX, MTTNX);
  static ColumnVector	AAx (MTTNX);
  
  static ColumnVector	open_switches (MTTNX);

  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;








|
|
|
|

|
|

|







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, 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, 0.0);
  static ColumnVector	AAx (MTTNX, 0.0);
  
  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
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## 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







>
>
>







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









|



|



|



|



|



|



|



|



|



|



|



|







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_init="(MTTNX,MTTNX,0.0)"
	    ;;
	mttb)
	    arg_type="Matrix"
	    arg_init="(MTTNX,MTTNU,0.0)"
	    ;;
	mttc)
	    arg_type="Matrix"
	    arg_init="(MTTNY,MTTNX,0.0)"
	    ;;
	mttd)
	    arg_type="Matrix"
	    arg_init="(MTTNY,MTTNU,0.0)"
	    ;;
	mttax | mttdx | mttedx | mttx | mttopen)
	    arg_type="ColumnVector"
	    arg_init="(MTTNX,0.0)"
	    ;;
	mttpar)
	    arg_type="ColumnVector"
	    arg_init="(MTTNPAR,0.0)"
	    ;;
	mttsimpar_map)
	    arg_type="Octave_map"
	    arg_init="";
	    ;;
	mttu)
	    arg_type="ColumnVector"
	    arg_init="(MTTNU,0.0)"
	    ;;
	mttyz)
	    arg_type="ColumnVector"
	    arg_init="(MTTNYZ,0.0)"
	    ;;
	mtty)
	    arg_type="ColumnVector"
	    arg_init="(MTTNY,0.0)"
	    ;;
	mttt)
	    arg_type="const double"
	    arg_init=""
	    ;;
	nil)
	    arg_type="void *"
	    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
    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"
    done
}


return_DLD_outputs ()
{
    s=${1:-""}					# comma separated output list







|







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 "  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
    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"
 		;;
 	    *)
 		;;
 	esac

    cat <<EOF








|







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_init};\n"
 		;;
 	    *)
 		;;
 	esac

    cat <<EOF


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