diff --git a/docs/source/tutorial/section4_NetworkConfiguration.rst b/docs/source/tutorial/section4_NetworkConfiguration.rst index 0e287b6c..05c4fca9 100644 --- a/docs/source/tutorial/section4_NetworkConfiguration.rst +++ b/docs/source/tutorial/section4_NetworkConfiguration.rst @@ -91,7 +91,7 @@ We start with the simplest configuration file, one without any noise: :language: yaml :caption: examples/tutorial/4.2_network-configuration/1_perfect.yaml -The network requires two types of objects to be specified: stacks and links. +The network requires three types of objects to be specified: stacks, links and clinks. Stacks are the end nodes of the network and run applications. Each stack requires a name, this name will be used by the links and applications for reference. @@ -101,10 +101,16 @@ The various stack types are discussed in :ref:`label_stack_types`. Links connect the stacks with a way of generating EPR pairs between the two nodes. A link requires references to the two stacks it is to connect. -This is done by registering the names of the stacks in the fields ``node1`` and ``node2``. +This is done by registering the names of the stacks in the fields ``stack1`` and ``stack2``. The model type of the link is specified using the ``typ`` field. The various settings for the model are defined inside ``cfg``. +Clinks are shorthand for classical links. These are similar to links, but for classical message communication. +A clink requires references to the two stacks it is to connect with a classical link. +This is done by registering the names of the stacks in the fields ``stack1`` and ``stack2``. +The model type of the clink is specified using the ``typ`` field. +The various settings for the model are defined inside ``cfg``. + .. _label_stack_types: Stack types @@ -203,6 +209,31 @@ The heralded link uses the double click model as developed and described by this :language: yaml :caption: examples/tutorial/4.2_network-configuration/5_heralded_link.yaml +Clink types ++++++++++++ + +instant clink +---------------- +The instant clink is a classical link model where all classical communication is instant. +It does not have any configuration options. + +.. literalinclude:: ../../../examples/tutorial/4.2_network-configuration/1_perfect.yaml + :language: yaml + :caption: examples/tutorial/4.2_network-configuration/1_perfect.yaml + :lines: 19-22 + + +default clink +---------------- +The default clink is a classical link model where classical communication is delayed by exactly the delay specified in +the configuration. + +.. literalinclude:: ../../../examples/tutorial/4.2_network-configuration/6_default.yaml + :language: yaml + :caption: examples/tutorial/4.2_network-configuration/1_perfect.yaml + :lines: 19-24 + + Parameter sweeping ===================== Often it will be desired to simulate not a single network configuration, but a range of parameters. diff --git a/examples/tutorial/4.2_network-configuration/6_default.yaml b/examples/tutorial/4.2_network-configuration/6_default.yaml new file mode 100644 index 00000000..e83a77e1 --- /dev/null +++ b/examples/tutorial/4.2_network-configuration/6_default.yaml @@ -0,0 +1,24 @@ +# A 2 node network, perfect except for classical communication using a default model that has communication delay +stacks: + - name: Alice + qdevice_typ: generic + qdevice_cfg: + dummy: null + - name: Bob + qdevice_typ: generic + qdevice_cfg: + dummy: null + +links: + - stack1: Alice + stack2: Bob + typ: perfect + cfg: + dummy: null + +clinks: + - stack1: Alice + stack2: Bob + typ: default + cfg: + delay: 20 \ No newline at end of file diff --git a/squidasm/run/stack/build.py b/squidasm/run/stack/build.py index 61648d40..70dc05fe 100644 --- a/squidasm/run/stack/build.py +++ b/squidasm/run/stack/build.py @@ -1,12 +1,13 @@ from __future__ import annotations -from typing import Dict +from typing import Dict, TYPE_CHECKING from netsquid_netbuilder.base_configs import NetworkConfig from netsquid_netbuilder.builder.network_builder import NetworkBuilder, NodeBuilder from netsquid_netbuilder.run import get_default_builder -from squidasm.sim.stack.stack import StackNode +if TYPE_CHECKING: + from squidasm.sim.stack.stack import StackNode class StackNodeBuilder(NodeBuilder):