diff --git a/ML_Model_Booster_rd1_co1/keras_metadata.pb b/ML_Model_Booster_rd1_co1/keras_metadata.pb new file mode 100644 index 00000000..afbdb7e3 --- /dev/null +++ b/ML_Model_Booster_rd1_co1/keras_metadata.pb @@ -0,0 +1,10 @@ + +=root"_tf_keras_sequential*={"name": "sequential", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "normalization_input"}}, {"class_name": "Normalization", "config": {"name": "normalization", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}}, {"class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc4", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}, "shared_object_id": 20, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, null]}, "ndim": 2, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, null]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, null]}, "float32", "normalization_input"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, null]}, "float32", "normalization_input"]}, "keras_version": "2.7.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "normalization_input"}, "shared_object_id": 0}, {"class_name": "Normalization", "config": {"name": "normalization", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}, "shared_object_id": 1}, {"class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4}, {"class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7}, {"class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10}, {"class_name": "Dense", "config": {"name": "fc4", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13}, {"class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 14}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 15}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 16}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 17}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 18}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 19}]}}, "training_config": {"loss": "customLoss", "metrics": null, "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.009999999776482582, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}2 +root.layer_with_weights-0"_tf_keras_layer*{"name": "normalization", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "stateful": false, "must_restore_from_config": true, "class_name": "Normalization", "config": {"name": "normalization", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}, "shared_object_id": 1, "build_input_shape": {"class_name": "TensorShape", "items": [null, 189]}}2 +root.layer_with_weights-1"_tf_keras_layer*{"name": "fc1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 189}}, "shared_object_id": 22}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 189]}}2 +root.layer_with_weights-2"_tf_keras_layer*{"name": "fc2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 191}}, "shared_object_id": 23}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 191]}}2 +root.layer_with_weights-3"_tf_keras_layer*{"name": "fc3", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 256}}, "shared_object_id": 24}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 256]}}2 +root.layer_with_weights-4"_tf_keras_layer*{"name": "fc4", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc4", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 25}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +root.layer_with_weights-5"_tf_keras_layer*{"name": "fc5", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 14}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 15}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 16, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 26}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +root.layer_with_weights-6"_tf_keras_layer*{"name": "dense", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 17}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 18}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 19, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 27}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +broot.keras_api.metrics.0"_tf_keras_metric*{"class_name": "Mean", "name": "loss", "dtype": "float32", "config": {"name": "loss", "dtype": "float32"}, "shared_object_id": 28}2 \ No newline at end of file diff --git a/ML_Model_Booster_rd1_co1/saved_model.pb b/ML_Model_Booster_rd1_co1/saved_model.pb new file mode 100644 index 00000000..2b3592e6 Binary files /dev/null and b/ML_Model_Booster_rd1_co1/saved_model.pb differ diff --git a/ML_Model_Booster_rd1_co1/variables/variables.data-00000-of-00001 b/ML_Model_Booster_rd1_co1/variables/variables.data-00000-of-00001 new file mode 100644 index 00000000..f8fc9893 Binary files /dev/null and b/ML_Model_Booster_rd1_co1/variables/variables.data-00000-of-00001 differ diff --git a/ML_Model_Booster_rd1_co1/variables/variables.index b/ML_Model_Booster_rd1_co1/variables/variables.index new file mode 100644 index 00000000..60a30eaf Binary files /dev/null and b/ML_Model_Booster_rd1_co1/variables/variables.index differ diff --git a/ML_Model_LineAmp1/keras_metadata.pb b/ML_Model_LineAmp1/keras_metadata.pb new file mode 100644 index 00000000..17a06205 --- /dev/null +++ b/ML_Model_LineAmp1/keras_metadata.pb @@ -0,0 +1,10 @@ + +>root"_tf_keras_sequential*={"name": "sequential_46", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "class_name": "Sequential", "config": {"name": "sequential_46", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "normalization_46_input"}}, {"class_name": "Normalization", "config": {"name": "normalization_46", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}}, {"class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc4", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_46", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}, "shared_object_id": 20, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, null]}, "ndim": 2, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, null]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, null]}, "float32", "normalization_46_input"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, null]}, "float32", "normalization_46_input"]}, "keras_version": "2.7.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential_46", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "normalization_46_input"}, "shared_object_id": 0}, {"class_name": "Normalization", "config": {"name": "normalization_46", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}, "shared_object_id": 1}, {"class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4}, {"class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7}, {"class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10}, {"class_name": "Dense", "config": {"name": "fc4", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13}, {"class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 14}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 15}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 16}, {"class_name": "Dense", "config": {"name": "dense_46", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 17}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 18}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 19}]}}, "training_config": {"loss": "customLoss", "metrics": null, "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.009999999776482582, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}2 +root.layer_with_weights-0"_tf_keras_layer*{"name": "normalization_46", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "stateful": false, "must_restore_from_config": true, "class_name": "Normalization", "config": {"name": "normalization_46", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}, "shared_object_id": 1, "build_input_shape": {"class_name": "TensorShape", "items": [null, 189]}}2 +root.layer_with_weights-1"_tf_keras_layer*{"name": "fc1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 189}}, "shared_object_id": 22}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 189]}}2 +root.layer_with_weights-2"_tf_keras_layer*{"name": "fc2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 191}}, "shared_object_id": 23}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 191]}}2 +root.layer_with_weights-3"_tf_keras_layer*{"name": "fc3", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 256}}, "shared_object_id": 24}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 256]}}2 +root.layer_with_weights-4"_tf_keras_layer*{"name": "fc4", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc4", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 25}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +root.layer_with_weights-5"_tf_keras_layer*{"name": "fc5", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 14}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 15}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 16, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 26}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +root.layer_with_weights-6"_tf_keras_layer*{"name": "dense_46", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense_46", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 17}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 18}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 19, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 27}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +broot.keras_api.metrics.0"_tf_keras_metric*{"class_name": "Mean", "name": "loss", "dtype": "float32", "config": {"name": "loss", "dtype": "float32"}, "shared_object_id": 28}2 \ No newline at end of file diff --git a/ML_Model_LineAmp1/saved_model.pb b/ML_Model_LineAmp1/saved_model.pb new file mode 100644 index 00000000..41c334bf Binary files /dev/null and b/ML_Model_LineAmp1/saved_model.pb differ diff --git a/ML_Model_LineAmp1/variables/variables.data-00000-of-00001 b/ML_Model_LineAmp1/variables/variables.data-00000-of-00001 new file mode 100644 index 00000000..7eab20d6 Binary files /dev/null and b/ML_Model_LineAmp1/variables/variables.data-00000-of-00001 differ diff --git a/ML_Model_LineAmp1/variables/variables.index b/ML_Model_LineAmp1/variables/variables.index new file mode 100644 index 00000000..41781bb3 Binary files /dev/null and b/ML_Model_LineAmp1/variables/variables.index differ diff --git a/ML_Model_Preamp_rd2_co1/keras_metadata.pb b/ML_Model_Preamp_rd2_co1/keras_metadata.pb new file mode 100644 index 00000000..94df6f37 --- /dev/null +++ b/ML_Model_Preamp_rd2_co1/keras_metadata.pb @@ -0,0 +1,9 @@ + +6root"_tf_keras_sequential*6{"name": "sequential_5", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "class_name": "Sequential", "config": {"name": "sequential_5", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "normalization_5_input"}}, {"class_name": "Normalization", "config": {"name": "normalization_5", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}}, {"class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_5", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}, "shared_object_id": 17, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, null]}, "ndim": 2, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, null]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, null]}, "float32", "normalization_5_input"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, null]}, "float32", "normalization_5_input"]}, "keras_version": "2.7.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential_5", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "normalization_5_input"}, "shared_object_id": 0}, {"class_name": "Normalization", "config": {"name": "normalization_5", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}, "shared_object_id": 1}, {"class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4}, {"class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7}, {"class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10}, {"class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13}, {"class_name": "Dense", "config": {"name": "dense_5", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 14}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 15}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 16}]}}, "training_config": {"loss": "customLoss", "metrics": null, "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.009999999776482582, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}2 +root.layer_with_weights-0"_tf_keras_layer*{"name": "normalization_5", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "stateful": false, "must_restore_from_config": true, "class_name": "Normalization", "config": {"name": "normalization_5", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, null]}, "dtype": "float32", "axis": {"class_name": "__tuple__", "items": [-1]}, "mean": null, "variance": null}, "shared_object_id": 1, "build_input_shape": {"class_name": "TensorShape", "items": [null, 189]}}2 +root.layer_with_weights-1"_tf_keras_layer*{"name": "fc1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc1", "trainable": true, "dtype": "float32", "units": 191, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 2}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 3}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 4, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 189}}, "shared_object_id": 19}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 189]}}2 +root.layer_with_weights-2"_tf_keras_layer*{"name": "fc2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc2", "trainable": true, "dtype": "float32", "units": 256, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 5}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 6}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 7, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 191}}, "shared_object_id": 20}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 191]}}2 +root.layer_with_weights-3"_tf_keras_layer*{"name": "fc3", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc3", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 8}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 9}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 10, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 256}}, "shared_object_id": 21}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 256]}}2 +root.layer_with_weights-4"_tf_keras_layer*{"name": "fc5", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "fc5", "trainable": true, "dtype": "float32", "units": 128, "activation": "relu", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 11}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 12}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 13, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 22}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +root.layer_with_weights-5"_tf_keras_layer*{"name": "dense_5", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense_5", "trainable": true, "dtype": "float32", "units": 94, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 14}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 15}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 16, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 128}}, "shared_object_id": 23}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 128]}}2 +Vroot.keras_api.metrics.0"_tf_keras_metric*{"class_name": "Mean", "name": "loss", "dtype": "float32", "config": {"name": "loss", "dtype": "float32"}, "shared_object_id": 24}2 \ No newline at end of file diff --git a/ML_Model_Preamp_rd2_co1/saved_model.pb b/ML_Model_Preamp_rd2_co1/saved_model.pb new file mode 100644 index 00000000..17859628 Binary files /dev/null and b/ML_Model_Preamp_rd2_co1/saved_model.pb differ diff --git a/ML_Model_Preamp_rd2_co1/variables/variables.data-00000-of-00001 b/ML_Model_Preamp_rd2_co1/variables/variables.data-00000-of-00001 new file mode 100644 index 00000000..91965129 Binary files /dev/null and b/ML_Model_Preamp_rd2_co1/variables/variables.data-00000-of-00001 differ diff --git a/ML_Model_Preamp_rd2_co1/variables/variables.index b/ML_Model_Preamp_rd2_co1/variables/variables.index new file mode 100644 index 00000000..9470eee6 Binary files /dev/null and b/ML_Model_Preamp_rd2_co1/variables/variables.index differ diff --git a/ML_models.py b/ML_models.py new file mode 100644 index 00000000..49c3ea9e --- /dev/null +++ b/ML_models.py @@ -0,0 +1,32 @@ +# The TensorFLow library is needed to use ML models. +import tensorflow as tf +from tensorflow import keras +from tensorflow.keras.models import load_model +from tensorflow import math as TFmath + + +# Custom loss function +def customLoss(y_actual, y_pred): + loaded_size = tf.dtypes.cast(TFmath.count_nonzero(y_actual), tf.float32) + y_pred_cast_unloaded_to_zero = TFmath.divide_no_nan(TFmath.multiply(y_pred, y_actual), y_actual) + error = TFmath.abs(TFmath.subtract(y_pred_cast_unloaded_to_zero, y_actual)) + custom_loss = TFmath.divide(TFmath.reduce_sum(error), loaded_size) + return custom_loss + + +# Function for the prediction of WDG +def predictWDG(input_features, ML_model): + if ML_model == 'ML_1': + model_name = 'ML_Model_Booster_rd1_co1' + elif ML_model == 'ML_2': + model_name = 'ML_Model_Preamp_rd2_co1' + elif ML_model == 'ML_3': + model_name = 'ML_Model_LineAmp1' + + # Load the model and use a custom loss function + model = load_model( + model_name, + custom_objects={"customLoss": customLoss} + ) + return model.predict(input_features) + diff --git a/mnoptical/edfa_params.py b/mnoptical/edfa_params.py index 2db8a020..44a476ac 100644 --- a/mnoptical/edfa_params.py +++ b/mnoptical/edfa_params.py @@ -1,5 +1,3 @@ - - ripple_functions = { "linear": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, @@ -37,5 +35,97 @@ 0.135829787234041, 0.141276595744682, 0.148425531914892, 0.157617021276597, 0.169531914893618, 0.185872340425533, 0.205617021276598, 0.227744680851064, 0.252255319148937, 0.278468085106383, 0.303659574468085, 0.328170212765958, 0.34927659574468, 0.369929078014184, 0.382978723404253 - ] + ], + + #rd1-co1 booster amplifier in the COSMOS testbed - version1 + "CM": [ + 0.11304348, 0.01304348, 0.01304348, 0.11304348, 0.01304348, + -0.08695652, 0.01304348, 0.11304348, 0.11304348, 0.11304348, + 0.11304348, 0.21304348, 0.01304348, 0.11304348, 0.01304348, + 0.11304348, 0.01304348, 0.11304348, 0.11304348, 0.11304348, + -0.08695652, 0.01304348, 0.01304348, 0.01304348, 0.11304348, + 0.11304348, 0.11304348, 0.11304348, 0.01304348, 0.11304348, + 0.11304348, 0.11304348, 0.01304348, 0.01304348, 0.11304348, + 0.01304348, 0.01304348, 0.01304348, -0.08695652, -0.08695652, + -0.18695652, -0.08695652, -0.08695652, -0.18695652, -0.08695652, + 0.01304348, 0.01304348, -0.08695652, 0.01304348, 0.01304348, + 0.01304348, 0.01304348, 0.11304348, 0.11304348, 0.11304348, + 0.21304348, 0.31304348, 0.21304348, 0.21304348, 0.21304348, + 0.21304348, 0.31304348, 0.41304348, 0.31304348, 0.31304348, + 0.21304348, 0.21304348, 0.11304348, 0.11304348, 0.11304348, + -0.08695652, -0.18695652, -0.18695652, -0.18695652, -0.18695652, + -0.28695652, -0.28695652, -0.18695652, -0.18695652, -0.38695652, + -0.28695652, -0.38695652, -0.38695652, -0.28695652, -0.38695652, + -0.38695652, -0.28695652, -0.28695652, -0.28695652, -0.18695652, + -0.08695652, 0.01304348 + + ], + + # rd1-co1 booster amplifier in the COSMOS testbed + "CM2": [0.163, 0.063, 0.063, 0.063, 0.063, 0.063, 0.163, 0.163, + 0.163, 0.163, 0.163, 0.163, 0.063, 0.263, 0.163, 0.263, + 0.163, 0.063, 0.263, 0.163, 0.163, 0.063, 0.163, 0.163, + 0.163, 0.263, 0.363, 0.263, 0.263, 0.363, 0.163, 0.263, + 0.163, 0.263, 0.163, 0.163, 0.263, 0.163, 0.063, 0.063, + 0.063, -0.037, -0.037, -0.037, -0.037, -0.137, 0.063, 0.063, + -0.037, -0.037, -0.037, 0.063, 0.063, 0.163, 0.063, 0.063, + 0.163, 0.163, 0.263, 0.163, 0.263, 0.263, 0.163, 0.163, + 0.263, 0.163, 0.063, 0.063, 0.063, -0.037, -0.037, -0.137, + -0.237, -0.337, -0.337, -0.437, -0.337, -0.337, -0.437, -0.437, + -0.337, -0.437, -0.437, -0.537, -0.537, -0.537, -0.637, -0.537, + -0.537, -0.637], + + + # rd2-co1 pre-amplifier in the COSMOS testbed + "CM3": [0.487, 0.487, 0.387, 0.387, 0.387, 0.487, 0.587, 0.487, 0.487, + 0.487, 0.387, 0.487, 0.387, 0.487, 0.487, 0.587, 0.487, 0.487, + 0.587, 0.587, 0.587, 0.587, 0.487, 0.387, 0.587, 0.487, 0.487, + 0.487, 0.387, 0.387, 0.387, 0.387, 0.387, 0.487, 0.587, 0.587, + 0.487, 0.587, 0.587, 0.587, 0.587, 0.687, 0.587, 0.587, 0.587, + 0.587, 0.687, 0.687, 0.687, 0.687, 0.687, 0.687, 0.587, 0.687, + 0.787, 0.887, 0.787, 0.787, 0.787, 0.787, 0.887, 0.787, 0.787, + 0.687, 0.687, 0.587, 0.687, 0.587, 0.487, 0.587, 0.487, 0.387, + 0.387, 0.387, 0.287, 0.387, 0.387, 0.487, 0.487, 0.387, 0.487, + 0.587, 0.587, 0.487, 0.487, 0.487, 0.387, 0.587, 0.587, 0.687], + + # In-Line amplifier in OpenIreland's ROADM2 + "CM4": [0.28374269, 0.18374269, 0.08374269, -0.01625731, -0.11625731, + -0.01625731, 0.08374269, 0.08374269, -0.01625731, -0.01625731, + 0.08374269, 0.08374269, 0.28374269, -0.01625731, -0.01625731, + 0.08374269, 0.08374269, 0.08374269, 0.08374269, 0.08374269, + -0.11625731, -0.01625731, -0.01625731, 0.08374269, 0.08374269, + -0.01625731, -0.11625731, -0.01625731, -0.01625731, 0.18374269, + 0.18374269, 0.08374269, 0.08374269, 0.18374269, 0.08374269, + 0.18374269, 0.08374269, -0.01625731, -0.01625731, -0.01625731, + 0.08374269, -0.01625731, -0.11625731, -0.11625731, -0.11625731, + -0.11625731, -0.11625731, -0.01625731, -0.11625731, -0.21625731, + -0.21625731, -0.01625731, -0.11625731, -0.11625731, -0.01625731, + -0.11625731, -0.01625731, -0.01625731, 0.18374269, 0.08374269, + -0.01625731, 0.08374269, 0.08374269, 0.08374269, 0.18374269, + 0.18374269, 0.08374269, 0.08374269, 0.08374269, -0.01625731, + 0.08374269, -0.01625731, -0.01625731, -0.01625731, -0.01625731, + -0.01625731, -0.01625731, -0.11625731, -0.31625731, -0.21625731, + -0.11625731, -0.21625731, -0.11625731, -0.21625731, -0.11625731, + -0.21625731, -0.11625731, -0.21625731, -0.01625731, -0.11625731] + } + +# wavelength dependent gain values +fibre_spectral_attenuation = { + "SMF": [0.2087 , 0.20876, 0.20883, 0.20889, 0.20895, 0.20901, 0.20907, + 0.20913, 0.20919, 0.20925, 0.20932, 0.20938, 0.20944, 0.2095 , + 0.20956, 0.20962, 0.20968, 0.20974, 0.2098 , 0.20986, 0.20992, + 0.20998, 0.21005, 0.21011, 0.21017, 0.21023, 0.21029, 0.21035, + 0.21041, 0.21047, 0.21053, 0.21059, 0.21065, 0.21071, 0.21077, + 0.21083, 0.21089, 0.21095, 0.21102, 0.2111 , 0.21118, 0.21126, + 0.21134, 0.21142, 0.2115 , 0.21158, 0.21166, 0.21174, 0.21182, + 0.2119 , 0.21198, 0.21206, 0.21214, 0.21222, 0.21229, 0.21237, + 0.21245, 0.21253, 0.21261, 0.21269, 0.21277, 0.21285, 0.21293, + 0.21301, 0.21309, 0.21317, 0.21325, 0.21333, 0.2134 , 0.21348, + 0.21356, 0.21364, 0.21372, 0.2138 , 0.21388, 0.21396, 0.21404, + 0.21411, 0.21419, 0.21427, 0.21435, 0.21443, 0.21451, 0.21459, + 0.21466, 0.21474, 0.21482, 0.2149 , 0.21498, 0.21508, 0.2152 , + 0.21532, 0.21543 + ] +} + diff --git a/mnoptical/link.py b/mnoptical/link.py index f5ae532d..f6da8a6b 100644 --- a/mnoptical/link.py +++ b/mnoptical/link.py @@ -3,6 +3,8 @@ from pprint import pprint from numpy import errstate from mnoptical.node import LineTerminal, Roadm, Amplifier +from mnoptical.edfa_params import fibre_spectral_attenuation +import math SpanTuple = namedtuple('Span', 'span amplifier') @@ -171,6 +173,7 @@ def propagate(self, is_last_port=False, safe_switch=False): first_span.propagate(is_last_port=is_last_port, safe_switch=safe_switch) + class Span(object): ids = 1 @@ -186,10 +189,10 @@ def __init__(self, fibre_type='SMF', length=20.0, debugger=False): Span.ids += 1 self.fibre_type = fibre_type self.length = length * km - self.fibre_attenuation = 0.22 / km # fiber attenuation in decibels/km - self.alpha = self.fibre_attenuation / (20 * np.log10(np.e)) # linear value fibre attenuation + self.fibre_attenuation = (self.get_fibre_spectral_attenuation())[::-1] + self.alpha = (self.fibre_attenuation) / (20 * np.log10(np.e)) # fibre attenuation self.effective_length = (1 - np.exp(-2 * self.alpha * self.length)) / (2 * self.alpha) - self.non_linear_coefficient = 1.27 / km # gamma fiber non-linearity coefficient [W^-1 km^-1] + self.non_linear_coefficient = 1.2 / km # gamma fiber non-linearity coefficient [W^-1 km^-1] self.dispersion = 1.67e-05 self.dispersion_coefficient = self.beta2() # B_2 dispersion coefficient [ps^2 km^-1] self.dispersion_slope = 0.1452 * (ps ** 3 / km) # B_3 dispersion slope in (ps^3 km^-1) @@ -214,7 +217,26 @@ def __repr__(self): def reset(self): self.optical_signals = [] - def attenuation(self): + def get_fibre_spectral_attenuation(self): + """ + Retrieve the WDL of the single mode fibre + :return: WDL of the SMF + """ + self.attenuation_values = list(fibre_spectral_attenuation['SMF']) + + for i in range(0, len(self.attenuation_values)): + self.attenuation_values[i] = self.attenuation_values[i] / km + # self.attenuation_values[i] = 0.22 / km # for linear attenuation + + return self.attenuation_values + + def attenuation(self, signal_index=1): + """ + Returns the attenuation value for each wavelength by the signal's index + :param signal_index: + """ + self.attenuation_values = self.get_fibre_spectral_attenuation() + self.fibre_attenuation = self.attenuation_values[92 - signal_index] return db_to_abs(self.fibre_attenuation * self.length) def beta2(self, ref_wavelength=1550e-9): @@ -275,11 +297,15 @@ def propagate(self, is_last_port=False, safe_switch=False): if self.link.srs_effect: if len(self.optical_signals) > 1: self.srs_effect_model() + # self.Zirngibl_General_Method() + # self.Sylvestre_SRS_model() + # self.Bigo_SRS_model() + # self.capacity_length_product() for optical_signal in self.optical_signals: - power_out = optical_signal.loc_out_to_state[self]['power'] / self.attenuation() - ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] / self.attenuation() - nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] / self.attenuation() + power_out = optical_signal.loc_out_to_state[self]['power'] / self.attenuation(optical_signal.index) + ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] / self.attenuation(optical_signal.index) + nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] / self.attenuation(optical_signal.index) self.include_optical_signal_out(optical_signal, power=power_out, ase_noise=ase_noise_out, nli_noise=nli_noise_out) @@ -318,8 +344,10 @@ def propagate(self, is_last_port=False, safe_switch=False): def srs_effect_model(self): """ Computation taken from : M. Zirngibl Analytical model of Raman gain effects in massive - wavelength division multiplexed transmission systems, 1998. - Equations 7,8. + wavelength division multiplexed transmission systems, 1998. - Equation 10. """ + # Note: The computation is done in the frequency domain which returns a positive SRS tilt + min_wavelength_index = 90 max_wavelength_index = 0 min_signal = None @@ -340,22 +368,212 @@ def srs_effect_model(self): total_power = 0 # Total input power calculated by following loop for optical_signal in self.optical_signals: total_power += optical_signal.loc_out_to_state[self]['power'] - + i = 0 # Calculate delta P for each channel for optical_signal in self.optical_signals: frequency = optical_signal.frequency - with errstate(divide='ignore'): - r1 = beta * total_power * effective_length * (frequency_max - frequency_min) * math.e ** ( - beta * total_power * effective_length * (frequency - frequency_min)) # term 1 - r2 = math.e ** (beta * total_power * effective_length * (frequency_max - frequency_min)) - 1 # term 2 + with errstate(divide='ignore'): + i = i+1 + r1 = beta * total_power * effective_length[i] * (frequency_max - frequency_min) * math.e ** ( + beta * total_power * effective_length[i] * (frequency - frequency_min)) # term 1 + r2 = math.e ** (beta * total_power * effective_length[i] * (frequency_max - frequency_min)) - 1 # term 2 delta_p = float(r1 / r2) - power_out = optical_signal.loc_out_to_state[self]['power'] * delta_p - ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] * delta_p - nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] * delta_p + power_out = optical_signal.loc_out_to_state[self]['power'] / delta_p + ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] / delta_p + nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] / delta_p self.include_optical_signal_out(optical_signal, power=power_out, ase_noise=ase_noise_out, nli_noise=nli_noise_out) + def Zirngibl_General_Method(self): + """ + The general form of the SRS model as proposed by M. Zirngibl in + Analytical model of Raman gain effects in massive wavelength division + multiplexed transmission systems, 1998." - Equation 7 + """ + + beta = self.raman_coefficient # (mWHz)^-1 + effective_length = self.effective_length # SMF effective length (km) + alpha = self.alpha # fibre attenuation in dB/km + + power_array = [] # to store the power level of each channel + channels_frequency = [] # to store the frequency of each channel + total_power = 0 + i = 0 + counter = 1 + + # Iterate through all the signals + for optical_signal in self.optical_signals: + current_ch_power = optical_signal.loc_out_to_state[self]['power'] + # Sum the power across the channels + total_power += current_ch_power + power_array.append(current_ch_power) + + # Store each channel's frequency + frequency = (optical_signal.frequency) + channels_frequency.append(frequency) + + # Calculate delta P for each channel + for optical_signal in self.optical_signals: + num = power_array[i] * (total_power) * math.e ** (- alpha[i] * (self.length)) + den = 0 + for j in range(0, len(power_array)): + den = power_array[j] * math.e ** (beta * total_power * effective_length[i] * (channels_frequency[j] - channels_frequency[i])) + den_sum += den + i += 1 + + with errstate(divide='ignore'): + delta_p = float(num / den_sum) + + counter += 1 + + # Update the current values + power_out = optical_signal.loc_out_to_state[self]['power'] / delta_p + ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] / delta_p + nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] / delta_p + self.include_optical_signal_out(optical_signal, power=power_out, + ase_noise=ase_noise_out, nli_noise=nli_noise_out) + + def capacity_length_product(self, system_capacity=4450e9, amplifier_spacing=50e3): + """ + CLP analytical model by Hyun Deok Kim and Chang-Hee Lee in + Capacities of WDM Transmission Systems and Networks Limited by + Stimulated Raman Scattering, 2001. - Equations 1 and 2 + """ + max_wavelength_index = 0 + + # get the frequency of the shortest wavelength + max_signal = None + no_of_signals = 0 + for optical_signal in self.optical_signals: + if optical_signal.index > max_wavelength_index: + max_signal = optical_signal + max_wavelength_index = optical_signal.index + no_of_signals += 1 + frequency_max = max_signal.frequency # shortest wavelength + + # calculate K + NF = 5.6 # dB + plank_constant = 6.62607015e-34 # (Joule second) + photon_energy = (plank_constant * frequency_max) # shortest wavelength + fibre_attenuation = 0.22 / 1000 # dB/km + optical_resolution_bandwidth = 12.5e9 # Hz + amplifier_spacing = 50e3 # m + exp_val = np.exp(fibre_attenuation * amplifier_spacing) - 1 + # K is a constant for the defined expression + K = (NF * photon_energy * optical_resolution_bandwidth * exp_val) + K = np.power(K, -1) + effective_area = 72e-6 # um + + # transmission_length, L -> No of spans * length of each span + length = self.length * 2 + fibre_attenuation = 0.22 / 1000 + alpha = fibre_attenuation / (20 * np.log10(np.e)) # linear attenuation + effective_length = (1 - np.exp(- alpha * length)) / (alpha) + channel_spacing = 50e9 # Hz + transmission_bandwidth = channel_spacing * (no_of_signals - 1) + raman_gain_coef = 5.9e-27 # slope of the Raman gain profile + bit_rate = 10e9 # bps + CLPs = [] + OSNR_values = [10, 20, 30, 40, 50, 60, 70] + for OSNR in OSNR_values: + n1 = (2.6 * effective_area) / (raman_gain_coef * effective_length) + n2 = bit_rate / OSNR + n3 = system_capacity / transmission_bandwidth + CLP = amplifier_spacing * np.sqrt(K * n1 * n2 * n3) + CLPs.append(CLP) + + def Sylvestre_SRS_model(self): + """ + SRS model proposed in 'Raman-Induced Power Tilt in Arbitrarily + Large Wavelength-Division-MUltiplexed Systems' by T. Sylvestre et al., 2005 + - Equation 6 + """ + F_j = [-1.5690, 5.6979, -6.5340, 4.7408, -2.0005, 0.1426, 5.9511, -3.2483, -2.4842, 0.4010] + omega_j = [0.0532, 4.1560, 5.2066, 6.4445, 7.2368, 14.9782, 15.7841, 16.3591, 18.2431, 24.4251] + delta_j = [1.2745, 7.4252, 5.2615, 4.8111, 3.7719, 0.6586, 4.2635, 2.2120, 5.4013, 1.3313] + + for i in range(0, len(F_j)): + omega_j[i] = omega_j[i] * (2 * math.pi) + delta_j[i] = delta_j[i] * (2 * math.pi) + + channel_spacing = 0.05 # THz + delta_w = 2 * math.pi * channel_spacing + + length = self.length / km + total_power = 0 # Total input power calculated by following loop + no_of_channels = 0 + for optical_signal in self.optical_signals: + total_power += optical_signal.loc_out_to_state[self]['power'] + no_of_channels += 1 + average_input_power = total_power / no_of_channels + + f_R = 0.18 # f_R raman_polarisation + non_linearity = 0.78 # W^-1 km^-1 at 1550nm + effective_length = self.effective_length # SMF effective distance + n_R = 10 + ind = 0 + + # Calculate delta P for each channel + for optical_signal in self.optical_signals: + total_sum = 0 + # change no_of_channels to the signal.index + # repeat iteratively for each individual channel + for k in range(1, optical_signal.index - 1): + for j in range(1, n_R): + numerator = k * delta_w * F_j[j] * omega_j[j] * (delta_j[j]**2) + denominator1 = ((delta_j[j] ** 2) + (omega_j[j] ** 2))**2 + denominator2 = (k * delta_w) ** 2 + denominator3 = ((k * delta_w) ** 2) + (2 * (delta_j[j] ** 2)) - (2 * (omega_j[j] ** 2)) + + denominator = denominator1 + (denominator2 * denominator3) + div = numerator / denominator + total_sum += div + delta_p = 34.74 * average_input_power * effective_length[ind] * non_linearity * f_R * total_sum + ind += 1 + delta_p_linear = db_to_abs(delta_p) # convert to linear + + # Update the current values + power_out = optical_signal.loc_out_to_state[self]['power'] / delta_p_linear + ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] * delta_p_linear + nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] * delta_p_linear + self.include_optical_signal_out(optical_signal, power=power_out, + ase_noise=ase_noise_out, nli_noise=nli_noise_out) + + def Bigo_SRS_model(self): + """ + SRS model proposed in the paper tilted: + 'Experimental Investigation of Stimulated Raman Scattering + Limitation on WDM Transmission Over Various Types of Fiber + Infrastructures' by S.Bigo et al., 1999 - Equation 1 + """ + + channel_spacing = 50e9 + total_power = 0 + no_of_channels = 0 + for optical_signal in self.optical_signals: + # sum the total power across the channels + total_power += optical_signal.loc_out_to_state[self]['power'] + no_of_channels += 1 + + average_input_power = total_power / no_of_channels # average channel power + g_Aeff = 8.2e-17 # estimated Raman gain coefficient for a 50 km span + + # Calculate delta P for each channel using the model + for optical_signal in self.optical_signals: + + delta_p = 2.17 * (g_Aeff) * average_input_power * no_of_channels * (optical_signal.index - 1) * self.effective_length[optical_signal.index] * channel_spacing + print("delta_p: ", delta_p) + delta_p_linear = db_to_abs(delta_p) # convert to linear + print("delta_p_linear: ", delta_p_linear) + + # Update the current values + power_out = optical_signal.loc_out_to_state[self]['power'] / delta_p_linear + ase_noise_out = optical_signal.loc_out_to_state[self]['ase_noise'] / delta_p_linear + nli_noise_out = optical_signal.loc_out_to_state[self]['nli_noise'] / delta_p_linear + self.include_optical_signal_out(optical_signal, power=power_out, + ase_noise=ase_noise_out, nli_noise=nli_noise_out) + def output_nonlinear_noise(self): """ Compute GN model and updates state data structures @@ -384,6 +602,8 @@ def gn_model(self): gamma = self.non_linear_coefficient effective_length = self.effective_length asymptotic_length = 1 / (2 * alpha) + + index = 0 for optical_signal in self.optical_signals: channel_under_test = optical_signal.index symbol_rate_cut = optical_signal.symbol_rate @@ -392,16 +612,20 @@ def gn_model(self): g_cut = pwr_cut / bw_cut # G is the flat PSD per channel power (per polarization) g_nli = 0 + i = 0 for ch in self.optical_signals: + symbol_rate_ch = ch.symbol_rate bw_ch = symbol_rate_ch pwr_ch = ch.loc_out_to_state[self]['power'] g_ch = pwr_ch / bw_ch # G is the flat PSD per channel power (per polarization) - psi = self.psi_factor(optical_signal, ch, beta2=beta2, asymptotic_length=asymptotic_length) + psi = self.psi_factor(optical_signal, ch, beta2=beta2, asymptotic_length=asymptotic_length[i]) g_nli += g_ch ** 2 * g_cut * psi + i += 1 with errstate(divide='ignore'): - g_nli *= (16.0 / 27.0) * (gamma * effective_length) ** 2 / (2 * np.pi * abs(beta2) * asymptotic_length) + g_nli *= (16.0 / 27.0) * (gamma * effective_length[index]) ** 2 / (2 * np.pi * abs(beta2) * asymptotic_length[index]) + index = index + 1 signal_under_test = index_to_signal[channel_under_test] nonlinear_noise_struct[signal_under_test] = g_nli * bw_cut @@ -427,3 +651,4 @@ def psi_factor(carrier, interfering_carrier, beta2, asymptotic_length): psi -= np.arcsinh(np.pi ** 2 * asymptotic_length * abs(beta2) * bw_cut * (delta_f - 0.5 * bw_ch)) return psi + diff --git a/mnoptical/node.py b/mnoptical/node.py index 1c4ac480..dc59d15a 100755 --- a/mnoptical/node.py +++ b/mnoptical/node.py @@ -7,6 +7,7 @@ from collections import namedtuple from scipy.special import erfc from math import sqrt +import ML_models # for three ML models -> 'ML_1', 'ML_2', 'ML_3' class Node(object): @@ -300,7 +301,6 @@ def assoc_channel(self, transceiver, channel, out_port): self.tx_to_channel[out_port] = {'optical_signal': optical_signal, 'transceiver': transceiver} self.optical_signals_out += 1 - def disassoc_tx_to_channel(self, out_port): """ Disassociate a transmitter transceiver (tx) to an output port @@ -427,7 +427,7 @@ def receiver(self, optical_signal, in_port): else: self.receiver_callback(in_port, signalInfoDict) if self.debugger: - print("*** %s.receiver rx_to_channel: %s" %(self, self.rx_to_channel) ) + print("*** %s.receiver rx_to_channel: %s" %(self, self.rx_to_channel)) print("warning: @%s, input port: %s not configured correctly for " "optical signal: %s in LineTerminal.\n" "You can configure it with %s.assoc_rx_to_channel() before launching transmission." % @@ -565,7 +565,7 @@ def assoc_loc_out(self, loc, power=None, ase_noise=None, nli_noise=None): power = self.power if ase_noise is None: ase_noise = self.ase_noise - if nli_noise is None: + if nli_noise is None: nli_noise = self.nli_noise # XXX: We probably shouldn't update the default/launch state to # some random input state in the network, should we? @@ -1133,6 +1133,7 @@ def route(self, out_port, safe_switch): :param safe_switch: boolean, indicates whether it needs to check for switch feasibility. """ + link = self.port_to_link_out[out_port] link.propagate(is_last_port=True, safe_switch=safe_switch) @@ -1196,12 +1197,37 @@ def __init__(self, name, amplifier_type='EDFA', target_gain=17.6, :param boost: OBSOLETE; kept for backwards compatibility """ Node.__init__(self, name) + if wdg_id in ['ML_1', 'ML_2', 'ML_3']: + model = AmplifierModels() + parameters = model.ML_Model_1() + self.noise_figure = parameters["noise_figure"] + self.bandwidth = parameters["bandwidth"] + noise_figure_function = None + self.noise_figure = self.get_noise_figure(self.noise_figure, noise_figure_function) + self.ML_model = wdg_id + + elif wdg_id in ['CM', 'CM2', 'CM3', 'CM4']: + model = AmplifierModels() + parameters = model.CM_Model() + self.noise_figure = parameters["noise_figure"] + self.bandwidth = parameters["bandwidth"] + noise_figure_function = None + self.noise_figure = self.get_noise_figure(self.noise_figure, noise_figure_function) + self.wavelength_dependent_gain = ( + self.load_wavelength_dependent_gain(wdg_id)) + self.ML_model = None + + else: + self.bandwidth = bandwidth + self.noise_figure = self.get_noise_figure(noise_figure, noise_figure_function) + self.wavelength_dependent_gain = ( + self.load_wavelength_dependent_gain(wdg_id)) + self.ML_model = None + self.target_gain = target_gain self.system_gain = target_gain - self.noise_figure = self.get_noise_figure(noise_figure, noise_figure_function) - self.bandwidth = bandwidth - self.wavelength_dependent_gain = ( - self.load_wavelength_dependent_gain(wdg_id)) + self.propagating_optical_signals = [] + self.DNN_predictions = [] if monitor_mode: self.monitor = Monitor(name + "-monitor", component=self, mode=monitor_mode) @@ -1243,13 +1269,109 @@ def set_ripple_function(self, wdg_id): self.wavelength_dependent_gain = ( self.load_wavelength_dependent_gain(wdg_id)) + def get_optical_signals(self): + all_optical_signals = [] + similar_signals = [] + + # Read the current signal + for in_port, optical_signals in self.port_to_optical_signal_in.items(): + for optical_signal in optical_signals: + all_optical_signals.append(optical_signal.loc_in_to_state[self]) + current_signal_label = list(optical_signal.loc_in_to_state.keys())[0] + if optical_signal not in self.propagating_optical_signals: + self.propagating_optical_signals.append(optical_signal) + + all_optical_signals_in_system = self.propagating_optical_signals + + # Check for signals propagating through + if len(all_optical_signals_in_system) > 0: + for i in range(0, len(all_optical_signals_in_system)): + prev_signals_labels = list(all_optical_signals_in_system[i].loc_in_to_state.keys()) + if len(prev_signals_labels) > 0: + if str(current_signal_label) == str(prev_signals_labels[0]): + similar_signals.append(all_optical_signals_in_system[i]) + + return similar_signals + + # This function is used by the machine learning model for prediction + def predict_wavelength_dependent_gain(self, signal_index): + + # Check for the wavelength dependent gain of the signal + if len(self.DNN_predictions) > 0: + if len(self.DNN_predictions) >= signal_index: + prediction = self.DNN_predictions[signal_index-1] + return prediction + + # Store the input power and index of each channel + input_powers = [] + input_signals = self.get_optical_signals() + channel_indices = [] + for i in range(0, len(input_signals)): + input_powers.append(input_signals[i].loc_in_to_state[self]['power']) + channel_indices.append(input_signals[i].index) + + # Set the initial power level of each channel to zero + all_input_powers = np.zeros(94) + channel_index = 0 + for i in (channel_indices): + all_input_powers[i] = input_powers[channel_index] + channel_index += 1 + all_input_powers = all_input_powers.tolist() + + if len(all_input_powers) < 94: + no_inactive_channels = 94 - len(all_input_powers) + inactive_channels_power = (np.zeros(no_inactive_channels, dtype='float32')).tolist() + all_input_powers.extend(inactive_channels_power) + + # Set the initial status of each channel to zero + channels_status = np.zeros(94) + + # Assign the status of active channels to 1 + for i in (channel_indices): + channels_status[i] = 1 + channels_status = channels_status.tolist() + input_powers_and_status = [] + + # Assign the status of each channel + for i in range(0, 94): + input_powers_and_status.append(all_input_powers[i]) + input_powers_and_status.append(channels_status[i]) + + # Inputs to be fed into the network + target_gain = self.target_gain + model_input = [target_gain] + model_input.extend(input_powers_and_status) + model_input = [model_input] + + # Load the ML model to perform inference + model_pred = ML_models.predictWDG(model_input, self.ML_model) + model_pred_dB = abs_to_db(model_pred) + wavelength_dependent_gain = model_pred_dB - np.average(model_pred_dB) + wavelength_dependent_gain = wavelength_dependent_gain.tolist() + + # Store the previous predictions of the model + self.DNN_predictions.append(wavelength_dependent_gain) + + # Return the prediction values + return wavelength_dependent_gain + + def get_wavelength_dependent_gain(self, signal_index): """ Retrieve WDG by signal index :param signal_index: :return: WDG of signal """ - return self.wavelength_dependent_gain[signal_index - 1] + model = self.ML_model + # Check the model type + if model in ['ML_1', 'ML_2', 'ML_3']: + wavelength_dependent_gain = self.predict_wavelength_dependent_gain(signal_index) + self.wavelength_dependent_gain = wavelength_dependent_gain + # return the predicted wavelength dependent gain values for each signal + return self.wavelength_dependent_gain[0][signal_index - 1] + + else: + return self.wavelength_dependent_gain[signal_index - 1] @staticmethod def get_noise_figure(noise_figure, noise_figure_function): @@ -1300,7 +1422,6 @@ def nli_compensation(self, optical_signal): system_gain_linear = db_to_abs(self.system_gain) wavelength_dependent_gain_linear = db_to_abs( self.get_wavelength_dependent_gain(optical_signal.index)) - # the NLI noise als gets affected nli_noise_in = optical_signal.loc_in_to_state[self]['nli_noise'] nli_noise_out = nli_noise_in * system_gain_linear * wavelength_dependent_gain_linear @@ -1417,6 +1538,23 @@ def mock_amp_gain_adjust(self, new_gain): self.system_gain = new_gain +# A class that contains different amplifier models +class AmplifierModels(): + # A function for a ML model + def ML_Model_1(self): + bandwidth = 50.0e9 + noise_figure = (5.6, 94) + parameters = {"noise_figure":noise_figure, "bandwidth":bandwidth} + return parameters + + # A function for the centre of mass model + def CM_Model(self): + bandwidth = 50.0e9 + noise_figure = (5.6, 94) + parameters = {"noise_figure":noise_figure, "bandwidth":bandwidth} + return parameters + + class Monitor(Node): """ This implementation of Monitors could be used for ROADMs and Amplifiers. @@ -1626,7 +1764,6 @@ def __repr__(self): self.name, self.component, self.mode) - class SignalTracing: """Routines for Signal tracing and debugging""" @@ -1660,7 +1797,7 @@ def signal_path(node, signal): if not link or signal not in link.optical_signals: break path.append(link) - node = node.port_to_node_out.get( port, None ) + node = node.port_to_node_out.get(port, None) port = SignalTracing.get_port(node, signal, in_out='in') return path @@ -1678,7 +1815,7 @@ def channel_paths(node, channel=None): return {signal: SignalTracing.signal_path(node, signal) for signal in signals} - pathEntry = namedtuple( 'pathEntry', 'location instate outstate' ) + pathEntry = namedtuple('pathEntry', 'location instate outstate') @staticmethod def path_state(signal, path, missing=None): @@ -1698,7 +1835,7 @@ class NodeAuditing: @staticmethod def check_roadm_propagation(roadm): "Check ROADM propagation and report errors" - print( f'*** Checking ROADM {roadm} signal propagation' ) + print(f'*** Checking ROADM {roadm} signal propagation') switch_table = roadm.switch_table errcount = 0 for port in sorted(roadm.port_to_optical_signal_in): @@ -1713,10 +1850,10 @@ def check_roadm_propagation(roadm): outport = switch_table[(port, ch)] if sig not in roadm.port_to_optical_signal_out[outport]: print( - f'*** ERROR {roadm}: {sig} missing on outport {outport}' ) + f'*** ERROR {roadm}: {sig} missing on outport {outport}') errcount += 1 continue - outlink = roadm.port_to_link_out.get( outport, None ) + outlink = roadm.port_to_link_out.get(outport, None) if outlink and sig not in outlink.optical_signals: print(f'*** ERROR {roadm}: {sig} missing on ' f'output port {outport} link {outlink}') @@ -1724,7 +1861,7 @@ def check_roadm_propagation(roadm): continue else: print(f'{roadm}: {sig} present on ' - f'output port {outport} link {outlink}' ) + f'output port {outport} link {outlink}') print(f'{roadm} channel {ch} inport {port} -> outport {outport}') print(f'*** {roadm}: {errcount} propagation errors detected') return errcount @@ -1744,7 +1881,7 @@ def check_link_propagation(link): for sig in linksigs: if sig not in ampsigs: print(f'*** ERROR: {sig} missing ' - f'at {amp}' ) + f'at {amp}') errcount += 1 if amp not in sig.loc_in_to_state: print(f'**** ERROR: {sig} input state ' @@ -1764,3 +1901,4 @@ def check_link_propagation(link): errcount += len(missing) print(f'{errcount} propagation errors detected') return errcount + diff --git a/tests/SRS_Test.py b/tests/SRS_Test.py new file mode 100644 index 00000000..93676919 --- /dev/null +++ b/tests/SRS_Test.py @@ -0,0 +1,145 @@ +""" +This script can be used to check the SRS effect in the link class +in the EDFA class. + +This script requires the SRS flag in the link.py script to be turned on. +It uses the flat spectrum which ensures the end-to-end tilt at the input +of each amplifier is the same at its output. There is no amplifier tilt. + +""" + +from mnoptical.topo.linear_params import LinearTopology +from scipy.optimize import curve_fit +import numpy as np +import math +import unittest + +power_dBm = 0 +span_length_km = 50 +span_no = 3 +hop_no = 2 + +wdg_id = 'linear' +signal_no = 90 + +net = LinearTopology.build(power_dBm=power_dBm, span_length_km=span_length_km, + span_no=span_no, hop_no=hop_no, signal_no=signal_no, + wdg_id='linear') + + +# convert the watts values to dBm +def wattsTodBm(value): + conv = 10 * np.log10(value) + 30 + return conv + + +# basis function for end to end tilt +def basisFunction(x, m, b): + return m * x + b + + +# calculate the end to end tilt +def computeEndToEndTilt(values): + data_len = len(values) + x = np.arange(1, data_len+1, 1) + y = values + popt, _ = curve_fit(basisFunction, x, y) + # summarize the parameter values + a, b = popt + x_line = np.arange(min(x), max(x), 1) + y_line = basisFunction(x_line, a, b) + tilt = max(y_line) - min(y_line) + return tilt + + +def configure_terminals(): + tx = net.name_to_node['tx'] + rx = net.name_to_node['rx'] + for p, c in enumerate(range(1, signal_no + 1), start=1): + # configure transmitter terminal + tx_transceiver = tx.id_to_transceivers[c] + tx.assoc_tx_to_channel(tx_transceiver, c, out_port=p) + # configure receiver terminal + rx_transceiver = rx.id_to_transceivers[1] + rx.assoc_rx_to_channel(rx_transceiver, c, in_port=1) + + +def configure_roadms(): + in_port = out_port = 0 + for i, r in enumerate(net.roadms): + + if i == 0: + # case for first ROADM + for in_port, c in enumerate(range(1, signal_no + 1), start=1): + r.install_switch_rule(in_port, out_port, c) + elif i == len(net.roadms) - 1: + in_port = 0 + # case for last ROADM + for out_port, c in enumerate(range(1, signal_no + 1), start=1): + r.install_switch_rule(in_port, 1, c) + else: + # case for intermediate ROADM + in_port = out_port = 0 + for c in range(1, signal_no + 1): + r.install_switch_rule(in_port, out_port, c) + + # returns two ROADM objects + return net.roadms[0], net.roadms[1] + + +def launch_transmission(): + tx = net.name_to_node['tx'] + tx.turn_on() + + +configure_terminals() +r = configure_roadms() +launch_transmission() +optical_signals = r[1].get_optical_signals() + +# declare some arrays to store the computed values +r2_preamp_in = [] +amp1_in = [] +amp2_in = [] +preamp_in = [] + +# read the monitored values +for i in range(0, len(optical_signals)): + for k, v in list(optical_signals[i].loc_in_to_state.items()): + if str(k) == "": # amp1's input + amp1_in.append(wattsTodBm(v['power'])) + elif str(k) == "": # amp2's input + amp2_in.append(wattsTodBm(v['power'])) + elif str(k) == "": # input of R2's pre-amp + preamp_in.append(wattsTodBm(v['power'])) + + +# compute the end-to-end tilt for each input +amp1_in_dBm_tilt = computeEndToEndTilt(amp1_in) +amp2_in_dBm_tilt = computeEndToEndTilt(amp2_in) +preamp_in_dBm_tilt = computeEndToEndTilt(preamp_in) + +# round the values to 2 decimal places +amp1_in_dBm_tilt = round(amp1_in_dBm_tilt, 2) +amp2_in_dBm_tilt = round(amp2_in_dBm_tilt, 2) +preamp_in_dBm_tilt = round(preamp_in_dBm_tilt, 2) + +# combine the results for each input +actual_result = [amp1_in_dBm_tilt, amp2_in_dBm_tilt, preamp_in_dBm_tilt] + +print("amp1_in_dBm_tilt: ", amp1_in_dBm_tilt) +print("amp2_in_dBm_tilt: ", amp2_in_dBm_tilt) +print("preamp_in_dBm_tilt: ", preamp_in_dBm_tilt) + + +# This class defines a unit test to validate the results obtained +# in the SRS test above +class TestSRS(unittest.TestCase): + + def test_SRS(self): + expected_result = [0.62, 1.33, 2.15] + self.assertEqual(actual_result, expected_result) + +if __name__ == '__main__': + unittest.main() +