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: 2bd0f6b2ed1bf89ef48dccf153ed40275948f091ea6314004931af0768ac2453
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: d1c22f2f2f 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: 2bd0f6b2ed 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: 4be02de99d 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
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,
lin(// parameters
    // 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
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,
lin(// parameters
    // 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,
lin(// parameters
    // 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
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 {
	  cerr << "* Error: __FILE__ does not cover this case" << endl;
	  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 ]