def interpol_params(self, frequencies, pin, baud_rates, pref):
        """interpolate SI channel frequencies with the edfa dgt and gain_ripple frquencies from JSON
        """
        # TODO|jla: read amplifier actual frequencies from additional params in json
        self.channel_freq = frequencies

        amplifier_freq = arrange_frequencies(len(self.params.dgt),
                                             self.params.f_min,
                                             self.params.f_max)  # Hz
        self.interpol_dgt = interp(self.channel_freq, amplifier_freq,
                                   self.params.dgt)

        amplifier_freq = arrange_frequencies(len(self.params.gain_ripple),
                                             self.params.f_min,
                                             self.params.f_max)  # Hz
        self.interpol_gain_ripple = interp(self.channel_freq, amplifier_freq,
                                           self.params.gain_ripple)

        amplifier_freq = arrange_frequencies(len(self.params.nf_ripple),
                                             self.params.f_min,
                                             self.params.f_max)  # Hz
        self.interpol_nf_ripple = interp(self.channel_freq, amplifier_freq,
                                         self.params.nf_ripple)

        self.nch = frequencies.size
        self.pin_db = lin2db(sum(pin * 1e3))
        # The following should be changed when we have the new spectral information including slot widths.
        # For now, with homogeneous spectrum, we can calculate it as the difference between neighbouring channels.
        self.slot_width = self.channel_freq[1] - self.channel_freq[0]
        """in power mode: delta_p is defined and can be used to calculate the power target
        This power target is used calculate the amplifier gain"""
        if self.delta_p is not None:
            self.target_pch_out_db = round(self.delta_p + pref.p_span0, 2)
            self.effective_gain = self.target_pch_out_db - pref.p_spani
        """check power saturation and correct effective gain & power accordingly:"""
        self.effective_gain = min(
            self.effective_gain,
            self.params.p_max - (pref.p_spani + pref.neq_ch))
        #print(self.uid, self.effective_gain, self.operational.gain_target)
        self.effective_pch_out_db = round(pref.p_spani + self.effective_gain,
                                          2)
        """check power saturation and correct target_gain accordingly:"""
        #print(self.uid, self.effective_gain, self.pin_db, pref.p_spani)
        self.nf = self._calc_nf()
        self.gprofile = self._gain_profile(pin)

        pout = (pin + self.noise_profile(baud_rates)) * db2lin(self.gprofile)
        self.pout_db = lin2db(sum(pout * 1e3))
Beispiel #2
0
    def interpol_params(self, frequencies, pin, baud_rates, pref):
        """interpolate SI channel frequencies with the edfa dgt and gain_ripple frquencies from JSON
        """
        # TODO|jla: read amplifier actual frequencies from additional params in json
        self.channel_freq = frequencies

        amplifier_freq = arrange_frequencies(len(self.params.dgt),
                                             self.params.f_min,
                                             self.params.f_max)  # Hz
        self.interpol_dgt = interp(self.channel_freq, amplifier_freq,
                                   self.params.dgt)

        amplifier_freq = arrange_frequencies(len(self.params.gain_ripple),
                                             self.params.f_min,
                                             self.params.f_max)  # Hz
        self.interpol_gain_ripple = interp(self.channel_freq, amplifier_freq,
                                           self.params.gain_ripple)

        amplifier_freq = arrange_frequencies(len(self.params.nf_ripple),
                                             self.params.f_min,
                                             self.params.f_max)  # Hz
        self.interpol_nf_ripple = interp(self.channel_freq, amplifier_freq,
                                         self.params.nf_ripple)

        self.nch = frequencies.size
        self.pin_db = lin2db(sum(pin * 1e3))
        """in power mode: delta_p is defined and can be used to calculate the power target
        This power target is used calculate the amplifier gain"""
        if self.delta_p is not None:
            self.target_pch_out_db = round(self.delta_p + pref.p_span0, 2)
            self.effective_gain = self.target_pch_out_db - pref.p_spani
        """check power saturation and correct effective gain & power accordingly:"""
        self.effective_gain = min(
            self.effective_gain,
            self.params.p_max - (pref.p_spani + pref.neq_ch))
        #print(self.uid, self.effective_gain, self.operational.gain_target)
        self.effective_pch_out_db = round(pref.p_spani + self.effective_gain,
                                          2)
        """check power saturation and correct target_gain accordingly:"""
        #print(self.uid, self.effective_gain, self.pin_db, pref.p_spani)
        self.nf = self._calc_nf()
        self.gprofile = self._gain_profile(pin)

        pout = (pin + self.noise_profile(baud_rates)) * db2lin(self.gprofile)
        self.pout_db = lin2db(sum(pout * 1e3))