Floating point formatting of elements' operational parameters

The current JSON data loader preserves (some) integers as integers. When
printed, the value might not contain any decimal points. The YANG patch
series, however, forces floats when floats are expected (while still
allowing None). This makes the output subtly different.

Change-Id: I0e0c013eb3abddb4aeac1ba43bf0d473fed731d4
This commit is contained in:
Jan Kundrát
2021-06-04 22:36:06 +02:00
parent ad9cbb8a93
commit 21ca54c89c
4 changed files with 53 additions and 53 deletions

View File

@@ -217,7 +217,7 @@ class Roadm(_Node):
return '\n'.join([f'{type(self).__name__} {self.uid}', return '\n'.join([f'{type(self).__name__} {self.uid}',
f' effective loss (dB): {self.effective_loss:.2f}', f' effective loss (dB): {self.effective_loss:.2f}',
f' pch out (dBm): {self.effective_pch_out_db!r}']) f' pch out (dBm): {self.effective_pch_out_db:.2f}'])
def propagate(self, pref, *carriers, degree): def propagate(self, pref, *carriers, degree):
# pin_target and loss are read from eqpt_config.json['Roadm'] # pin_target and loss are read from eqpt_config.json['Roadm']
@@ -346,7 +346,7 @@ class Fiber(_Node):
f' total loss (dB): {self.loss:.2f}', f' total loss (dB): {self.loss:.2f}',
f' (includes conn loss (dB) in: {self.params.con_in:.2f} out: {self.params.con_out:.2f})', f' (includes conn loss (dB) in: {self.params.con_in:.2f} out: {self.params.con_out:.2f})',
f' (conn loss out includes EOL margin defined in eqpt_config.json)', f' (conn loss out includes EOL margin defined in eqpt_config.json)',
f' pch out (dBm): {self.pch_out_db!r}']) f' pch out (dBm): {self.pch_out_db:.2f}'])
@property @property
def loss(self): def loss(self):
@@ -614,9 +614,9 @@ class Edfa(_Node):
f' pad att_in (dB): {self.att_in:.2f}', f' pad att_in (dB): {self.att_in:.2f}',
f' Power In (dBm): {self.pin_db:.2f}', f' Power In (dBm): {self.pin_db:.2f}',
f' Power Out (dBm): {self.pout_db:.2f}', f' Power Out (dBm): {self.pout_db:.2f}',
f' Delta_P (dB): {self.delta_p!r}', f' Delta_P (dB): ' + f'{self.delta_p:.2f}' if self.delta_p is not None else 'None',
f' target pch (dBm): {self.target_pch_out_db!r}', f' target pch (dBm): ' + f'{self.target_pch_out_db:.2f}' if self.target_pch_out_db is not None else 'None',
f' effective pch (dBm): {self.effective_pch_out_db!r}', f' effective pch (dBm): {self.effective_pch_out_db:.2f}',
f' output VOA (dB): {self.out_voa:.2f}']) f' output VOA (dB): {self.out_voa:.2f}'])
def interpol_params(self, frequencies, pin, baud_rates, pref): def interpol_params(self, frequencies, pin, baud_rates, pref):

View File

@@ -16,7 +16,7 @@ Transceiver trx_Stockholm
PMD (ps): 0.00 PMD (ps): 0.00
Roadm roadm_Stockholm Roadm roadm_Stockholm
effective loss (dB): 22.00 effective loss (dB): 22.00
pch out (dBm): -20 pch out (dBm): -20.00
Edfa Edfa_booster_roadm_Stockholm_to_fiber (Stockholm → Norrköping)_(1/2) Edfa Edfa_booster_roadm_Stockholm_to_fiber (Stockholm → Norrköping)_(1/2)
type_variety: openroadm_mw_mw_booster type_variety: openroadm_mw_mw_booster
effective gain(dB): 22.00 effective gain(dB): 22.00
@@ -26,9 +26,9 @@ Edfa Edfa_booster_roadm_Stockholm_to_fiber (Stockholm → Norrköping)_(1/2)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): -0.18 Power In (dBm): -0.18
Power Out (dBm): 21.82 Power Out (dBm): 21.82
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Fiber fiber (Stockholm → Norrköping)_(1/2) Fiber fiber (Stockholm → Norrköping)_(1/2)
type_variety: SSMF type_variety: SSMF
@@ -47,9 +47,9 @@ Edfa Edfa_fiber (Stockholm → Norrköping)_(1/2)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): 5.51 Power In (dBm): 5.51
Power Out (dBm): 21.84 Power Out (dBm): 21.84
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Fiber fiber (Stockholm → Norrköping)_(2/2) Fiber fiber (Stockholm → Norrköping)_(2/2)
type_variety: SSMF type_variety: SSMF
@@ -68,13 +68,13 @@ Edfa Edfa_preamp_roadm_Norrköping_from_fiber (Stockholm → Norrköping)_(2/2)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): 5.53 Power In (dBm): 5.53
Power Out (dBm): 21.87 Power Out (dBm): 21.87
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Roadm roadm_Norrköping Roadm roadm_Norrköping
effective loss (dB): 22.00 effective loss (dB): 22.00
pch out (dBm): -20 pch out (dBm): -20.00
Edfa Edfa_booster_roadm_Norrköping_to_fiber (Norrköping → Linköping) Edfa Edfa_booster_roadm_Norrköping_to_fiber (Norrköping → Linköping)
type_variety: openroadm_mw_mw_booster type_variety: openroadm_mw_mw_booster
effective gain(dB): 22.00 effective gain(dB): 22.00
@@ -84,9 +84,9 @@ Edfa Edfa_booster_roadm_Norrköping_to_fiber (Norrköping → Linköping)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): -0.18 Power In (dBm): -0.18
Power Out (dBm): 21.82 Power Out (dBm): 21.82
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Fiber fiber (Norrköping → Linköping) Fiber fiber (Norrköping → Linköping)
type_variety: SSMF type_variety: SSMF
@@ -95,7 +95,7 @@ Fiber fiber (Norrköping → Linköping)
total loss (dB): 11.00 total loss (dB): 11.00
(includes conn loss (dB) in: 0.00 out: 0.00) (includes conn loss (dB) in: 0.00 out: 0.00)
(conn loss out includes EOL margin defined in eqpt_config.json) (conn loss out includes EOL margin defined in eqpt_config.json)
pch out (dBm): -9.0 pch out (dBm): -9.00
Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping) Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping)
type_variety: openroadm_mw_mw_preamp type_variety: openroadm_mw_mw_preamp
effective gain(dB): 11.00 effective gain(dB): 11.00
@@ -105,13 +105,13 @@ Edfa Edfa_preamp_roadm_Linköping_from_fiber (Norrköping → Linköping)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): 10.83 Power In (dBm): 10.83
Power Out (dBm): 21.83 Power Out (dBm): 21.83
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Roadm roadm_Linköping Roadm roadm_Linköping
effective loss (dB): 22.00 effective loss (dB): 22.00
pch out (dBm): -20 pch out (dBm): -20.00
Edfa Edfa_booster_roadm_Linköping_to_fiber (Linköping → Jönköping) Edfa Edfa_booster_roadm_Linköping_to_fiber (Linköping → Jönköping)
type_variety: openroadm_mw_mw_booster type_variety: openroadm_mw_mw_booster
effective gain(dB): 22.00 effective gain(dB): 22.00
@@ -121,9 +121,9 @@ Edfa Edfa_booster_roadm_Linköping_to_fiber (Linköping → Jönköping)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): -0.18 Power In (dBm): -0.18
Power Out (dBm): 21.82 Power Out (dBm): 21.82
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Fiber fiber (Linköping → Jönköping) Fiber fiber (Linköping → Jönköping)
type_variety: SSMF type_variety: SSMF
@@ -132,7 +132,7 @@ Fiber fiber (Linköping → Jönköping)
total loss (dB): 26.80 total loss (dB): 26.80
(includes conn loss (dB) in: 0.00 out: 0.00) (includes conn loss (dB) in: 0.00 out: 0.00)
(conn loss out includes EOL margin defined in eqpt_config.json) (conn loss out includes EOL margin defined in eqpt_config.json)
pch out (dBm): -24.8 pch out (dBm): -24.80
Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping) Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping)
type_variety: openroadm_mw_mw_preamp type_variety: openroadm_mw_mw_preamp
effective gain(dB): 26.80 effective gain(dB): 26.80
@@ -142,13 +142,13 @@ Edfa Edfa_preamp_roadm_Jönköping_from_fiber (Linköping → Jönköping)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): -4.97 Power In (dBm): -4.97
Power Out (dBm): 21.86 Power Out (dBm): 21.86
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Roadm roadm_Jönköping Roadm roadm_Jönköping
effective loss (dB): 22.00 effective loss (dB): 22.00
pch out (dBm): -20 pch out (dBm): -20.00
Edfa Edfa_booster_roadm_Jönköping_to_fiber (Jönköping → Borås) Edfa Edfa_booster_roadm_Jönköping_to_fiber (Jönköping → Borås)
type_variety: openroadm_mw_mw_booster type_variety: openroadm_mw_mw_booster
effective gain(dB): 22.00 effective gain(dB): 22.00
@@ -158,9 +158,9 @@ Edfa Edfa_booster_roadm_Jönköping_to_fiber (Jönköping → Borås)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): -0.18 Power In (dBm): -0.18
Power Out (dBm): 21.82 Power Out (dBm): 21.82
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Fiber fiber (Jönköping → Borås) Fiber fiber (Jönköping → Borås)
type_variety: SSMF type_variety: SSMF
@@ -179,13 +179,13 @@ Edfa Edfa_preamp_roadm_Borås_from_fiber (Jönköping → Borås)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): 4.01 Power In (dBm): 4.01
Power Out (dBm): 21.84 Power Out (dBm): 21.84
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Roadm roadm_Borås Roadm roadm_Borås
effective loss (dB): 22.00 effective loss (dB): 22.00
pch out (dBm): -20 pch out (dBm): -20.00
Edfa Edfa_booster_roadm_Borås_to_fiber (Borås → Gothenburg) Edfa Edfa_booster_roadm_Borås_to_fiber (Borås → Gothenburg)
type_variety: openroadm_mw_mw_booster type_variety: openroadm_mw_mw_booster
effective gain(dB): 22.00 effective gain(dB): 22.00
@@ -195,9 +195,9 @@ Edfa Edfa_booster_roadm_Borås_to_fiber (Borås → Gothenburg)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): -0.18 Power In (dBm): -0.18
Power Out (dBm): 21.82 Power Out (dBm): 21.82
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Fiber fiber (Borås → Gothenburg) Fiber fiber (Borås → Gothenburg)
type_variety: SSMF type_variety: SSMF
@@ -216,13 +216,13 @@ Edfa Edfa_preamp_roadm_Gothenburg_from_fiber (Borås → Gothenburg)
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): 8.30 Power In (dBm): 8.30
Power Out (dBm): 21.84 Power Out (dBm): 21.84
Delta_P (dB): 0 Delta_P (dB): 0.00
target pch (dBm): 2.0 target pch (dBm): 2.00
effective pch (dBm): 2.0 effective pch (dBm): 2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Roadm roadm_Gothenburg Roadm roadm_Gothenburg
effective loss (dB): 22.00 effective loss (dB): 22.00
pch out (dBm): -20 pch out (dBm): -20.00
Transceiver trx_Gothenburg Transceiver trx_Gothenburg
GSNR (0.1nm, dB): 18.90 GSNR (0.1nm, dB): 18.90
GSNR (signal bw, dB): 14.88 GSNR (signal bw, dB): 14.88

View File

@@ -21,7 +21,7 @@ Fiber Span1
total loss (dB): 17.00 total loss (dB): 17.00
(includes conn loss (dB) in: 0.50 out: 0.50) (includes conn loss (dB) in: 0.50 out: 0.50)
(conn loss out includes EOL margin defined in eqpt_config.json) (conn loss out includes EOL margin defined in eqpt_config.json)
pch out (dBm): -17.0 pch out (dBm): -17.00
Edfa Edfa1 Edfa Edfa1
type_variety: std_low_gain type_variety: std_low_gain
effective gain(dB): 15.00 effective gain(dB): 15.00
@@ -31,9 +31,9 @@ Edfa Edfa1
pad att_in (dB): 0.00 pad att_in (dB): 0.00
Power In (dBm): 1.81 Power In (dBm): 1.81
Power Out (dBm): 16.82 Power Out (dBm): 16.82
Delta_P (dB): -2 Delta_P (dB): -2.00
target pch (dBm): -2.0 target pch (dBm): -2.00
effective pch (dBm): -2.0 effective pch (dBm): -2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Transceiver Site_B Transceiver Site_B
GSNR (0.1nm, dB): 31.17 GSNR (0.1nm, dB): 31.17

View File

@@ -31,9 +31,9 @@ Edfa Edfa1
pad att_in (dB): 2.26 pad att_in (dB): 2.26
Power In (dBm): 11.07 Power In (dBm): 11.07
Power Out (dBm): 16.82 Power Out (dBm): 16.82
Delta_P (dB): -2 Delta_P (dB): -2.00
target pch (dBm): -2.0 target pch (dBm): -2.00
effective pch (dBm): -2.0 effective pch (dBm): -2.00
output VOA (dB): 0.00 output VOA (dB): 0.00
Transceiver Site_B Transceiver Site_B
GSNR (0.1nm, dB): 31.43 GSNR (0.1nm, dB): 31.43