Overview
Comment:Updated to reflect new CR format: component type is passed as the first argument.
Prepended std:: to iostream classes to satisfy g++.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: de2bcac636885545293fa50f90d3528e923dde0532b70baf9f038042c6a946fd
User & Date: geraint@users.sourceforge.net on 2004-08-09 17:50:56
Other Links: branch diff | manifest | tags
Context
2004-08-11
07:35:24
Fixed variable names in diy rep example: MTT_{OPT,SYS,LANG}. check-in: 2cde5146d9 user: geraint@users.sourceforge.net tags: origin/master, trunk
2004-08-09
17:50:56
Updated to reflect new CR format: component type is passed as the first argument.
Prepended std:: to iostream classes to satisfy g++.
check-in: de2bcac636 user: geraint@users.sourceforge.net tags: origin/master, trunk
17:49:52
string header file is required.
cmath is preferred to math.h
check-in: 110ca310cf user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/lib/cr/hh/lin.hh from [2e8f415433] to [a35639147a].

1
2
3
4
5

6
7
8
9

10
11
12
13
14
15
16
17
#ifndef LIN_HH
#define LIN_HH

#include <iostream>


// translated from lin.cr

// one 2-port, R/C/I; two 2-port, TF/GY
inline double

lin(// parameters
    const causality_t	gain_causality,
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,





>




>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef LIN_HH
#define LIN_HH

#include <iostream>

#include "components.hh"
// translated from lin.cr

// one 2-port, R/C/I; two 2-port, TF/GY
inline double
lin(const component_t	type,
    // parameters
    const causality_t	gain_causality,
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74
      }
    }
  }
}

// two 2-port, AE/AF
inline double

lin(// parameters
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
    const causality_t	in_causality,
    const int		in_port)
{
  return
    (out_port == 1) ? input * gain :
    input / gain;
}




// three 2-port, FMR
inline double

lin(// parameters
    const causality_t	gain_causality,
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,







>
|



















>
|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
      }
    }
  }
}

// two 2-port, AE/AF
inline double
lin(const component_t	type,
    // parameters
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
    const causality_t	in_causality,
    const int		in_port)
{
  return
    (out_port == 1) ? input * gain :
    input / gain;
}




// three 2-port, FMR
inline double
lin(const component_t	type,
    // parameters
    const causality_t	gain_causality,
    const double	gain,
    // output
    const causality_t	out_causality,
    const int		out_port,
    // input
    const double	input,
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
	if ((out_causality == gain_causality && out_port == 2)
	    ||(out_causality != gain_causality && out_port == 1)) {
	  return input * gain * modulation;
	} else if((out_causality != gain_causality && out_port == 2)
		  ||(out_causality == gain_causality && out_port == 1)) {
	  return input / (gain * modulation);
	} else {
	  cerr << "* Error: __FILE__ does not cover this case" << endl;
	  exit(-1);
	}
    } // EMTF
  } // bi-causal
}


#endif // LIN_HH







|








113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	if ((out_causality == gain_causality && out_port == 2)
	    ||(out_causality != gain_causality && out_port == 1)) {
	  return input * gain * modulation;
	} else if((out_causality != gain_causality && out_port == 2)
		  ||(out_causality == gain_causality && out_port == 1)) {
	  return input / (gain * modulation);
	} else {
	  std::cerr << "* Error: __FILE__ does not cover this case" << std::endl;
	  exit(-1);
	}
    } // EMTF
  } // bi-causal
}


#endif // LIN_HH


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