Files
oopt-gnpy/gnpy/yang/conversion.py
Jan Kundrát 5f38db2d2f YANG: Reading and saving equipment catalog and simulation options from YANG files
To make sure that I get everything right, I built this code for
initializing the equipment library around the already existing JSON IO
loader. That is far from optimal because there is no type safety
whatsoever in these classes, and object properties are created in a
super ad-hoc manner at runtime. That is rather painful to work with
because there is no place anywhere in the code which would list all
properties that are *supposed* to be present.

Change-Id: Ibbfd97a5a949cf107fd98484b19b24bf9f4ca3e9
2021-06-06 12:22:51 +02:00

25 lines
818 B
Python

# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (C) 2020 Telecom Infra Project and GNPy contributors
# see LICENSE.md for a list of contributors
"""
Scaling factors for unit conversion
===================================
In YANG, the data model defines units for each possible value explicitly.
This makes it possible for users to input data using the customary, common units.
The :py:mod:`gnpy.yang.conversion` module holds scaling factors for conversion of SI units into YANG units and back.
By convention, each items is used for multiplication when going from YANG to the legacy JSON.
When converting from legacy JSON to YANG, use division.
"""
import math
FIBER_DISPERSION = 1e-6
FIBER_DISPERSION_SLOPE = 1e3
FIBER_GAMMA = 1e-3
FIBER_PMD_COEF = 1e-14 * math.sqrt(10)
THZ = 1e12
GIGA = 1000 * 1000 * 1000