131 if (hasTimeDimension && hasFrequencyDimension) {
132 double startFrequency = (carrierFrequency - bandwidth / 2).
get();
133 double endFrequency = (carrierFrequency + bandwidth / 2).
get();
137 powerMapping->setValue(position, 0);
138 position.setTime(startTime);
139 powerMapping->setValue(position, 0);
140 position.setTime(endTime);
141 powerMapping->setValue(position, 0);
144 powerMapping->setValue(position, 0);
146 powerMapping->setValue(position, 0);
148 for (
const auto & timeGainEntry :
timeGains) {
150 switch (timeGainEntry.timeUnit) {
152 position.setTime(timeGainEntry.time >= 0 ? startTime + timeGainEntry.time : endTime - timeGainEntry.time);
155 position.setTime((1 - timeGainEntry.time) * startTime + timeGainEntry.time * endTime);
158 throw cRuntimeError(
"Unknown time unit");
162 switch (frequencyGainEntry.frequencyUnit) {
167 position.setArgValue(
Dimension::frequency, (1 - frequencyGainEntry.frequency) * startFrequency + frequencyGainEntry.
frequency * endFrequency);
170 throw cRuntimeError(
"Unknown frequency unit");
172 powerMapping->setValue(position, timeGainEntry.gain * frequencyGainEntry.gain * power.get());
176 position.setTime(startTime);
178 powerMapping->setValue(position, 0);
179 position.setTime(endTime);
181 powerMapping->setValue(position, 0);
182 position.setTime(endTime);
184 powerMapping->setValue(position, 0);
186 else if (hasTimeDimension) {
189 powerMapping->setValue(position, 0);
191 for (
const auto & timeGainEntry : timeGains) {
193 switch (timeGainEntry.timeUnit) {
195 position.setTime(timeGainEntry.time >= 0 ? startTime + timeGainEntry.time : endTime - timeGainEntry.time);
198 position.setTime((1 - timeGainEntry.time) * startTime + timeGainEntry.time * endTime);
201 throw cRuntimeError(
"Unknown time unit");
203 powerMapping->setValue(position, timeGainEntry.gain * power.get());
206 position.setTime(endTime);
207 powerMapping->setValue(position, 0);
209 else if (hasFrequencyDimension) {
210 double startFrequency = (carrierFrequency - bandwidth / 2).
get();
211 double endFrequency = (carrierFrequency + bandwidth / 2).
get();
214 powerMapping->setValue(position, 0);
216 for (
const auto & frequencyGainEntry : frequencyGains) {
218 switch (frequencyGainEntry.frequencyUnit) {
223 position.setArgValue(
Dimension::frequency, (1 - frequencyGainEntry.frequency) * startFrequency + frequencyGainEntry.
frequency * endFrequency);
226 throw cRuntimeError(
"Unknown frequency unit");
228 powerMapping->setValue(position, frequencyGainEntry.gain * power.get());
232 powerMapping->setValue(position, 0);
235 throw cRuntimeError(
"Unknown dimensions");
static const mapped_type MappedZero
Zero value of a Argument value.
Definition: MappingBase.h:427
bool hasDimension(const DimensionSet::value_type &d) const
Returns true if the passed Dimension is inside this DimensionSet.
Definition: MappingBase.h:282
static const Dimension time
Shortcut to the time Dimension, same as 'Dimension("time")', but spares the parsing of a string...
Definition: MappingBase.h:64
std::vector< TimeGainEntry > timeGains
Definition: DimensionalTransmitterBase.h:62
static Mapping * createMapping(const DimensionSet &domain=DimensionSet(Dimension::time), Mapping::InterpolationMethod intpl=Mapping::LINEAR)
Returns an appropriate changeable Mapping with the specified domain and the specified interpolation m...
Definition: MappingUtils.cc:103
DimensionSet dimensions
Definition: DimensionalTransmitterBase.h:60
static const Dimension frequency
Shortcut to the frequency Dimension, same as 'Dimension("frequency")', but spares the parsing of a st...
Definition: MappingBase.h:68
std::vector< FrequencyGainEntry > frequencyGains
Definition: DimensionalTransmitterBase.h:63
Mapping::InterpolationMethod interpolationMode
Definition: DimensionalTransmitterBase.h:61