Ejemplo n.º 1
0
        static void CreateOneToN(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var oneToN = new Model.Node(nodeNumber, router, "oneToN")
            {
                Description = "Linear 1:N",
            };

            var labels = new Model.Node(1, oneToN, "labels")
            {
                SchemaIdentifier = "de.l-s-b.emberplus.matrix.labels"
            };

            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int number = 0; number < 200; number++)
            {
                var targetParameter = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("SDI-T", number),
                };

                targets.Add(new Model.Signal(number, targetParameter));

                var sourceParameter = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("SDI-S", number),
                };

                sources.Add(new Model.Signal(number, sourceParameter));
            }

            var matrix = new Model.OneToNMatrix(
                2,
                oneToN,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels)
            {
                SchemaIdentifier = "de.l-s-b.emberplus.samples.oneToN"
            };

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
        }
Ejemplo n.º 2
0
        static void CreateSparse(Model.Node router, int nodeNumber, Dispatcher dispatcher)
        {
            var sparse = new Model.Node(nodeNumber, router, "sparse")
            {
                Description = "Linear 1:N with Sparse Signals",
            };

            var labels       = new Model.Node(1, sparse, "labels");
            var targetLabels = new Model.Node(1, labels, "targets");
            var sourceLabels = new Model.Node(2, labels, "sources");

            var targets = new List <Model.Signal>();
            var sources = new List <Model.Signal>();

            for (int number = 3; number < 200; number += 2)
            {
                var targetParameter = new Model.StringParameter(number, targetLabels, IdentOf("t", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("Sparse-T", number),
                };

                targets.Add(new Model.Signal(number, targetParameter));

                var sourceParameter = new Model.StringParameter(number, sourceLabels, IdentOf("s", number), dispatcher, isWriteable: true)
                {
                    Value = IdentOf("Sparse-S", number),
                };

                sources.Add(new Model.Signal(number, sourceParameter));
            }

            var matrix = new Model.OneToNMatrix(
                2,
                sparse,
                "matrix",
                dispatcher,
                targets,
                sources,
                labels,
                targetCount: 1000,
                sourceCount: 1000);

            foreach (var target in matrix.Targets)
            {
                matrix.Connect(target, new[] { matrix.GetSource(target.Number) }, null);
            }
        }