locked
Non-recognition of services already started RRS feed

  • Question

  • Hi.

    I must implement a closed loop control. I try to implement in some diferents services whit feedback.


    When I run "Scope", start the other service, but "Control" and "Plant" start two times.
    I use Partner to conect service.

    // Partner with control
            [Partner("Control", Contract = control.Contract.Identifier,
                CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate, Optional = false)]
            private control.ControladorOperations _controlPort = new control.ControlOperations();

    Why happend this? What I do to solved this problem?

    Thanks in advance.


    Wednesday, May 23, 2012 8:08 PM

Answers

  • Using separate solutions is fine (though circular refs between their builds is generally not). Using separate DSS hosts is fine (though some misconfig is likely causing new instances to spin up rather than remoting across nodes).

    However, your set of solutions *cannot be built* from a clean state because of the circular dependencies on DLLs. That is making it difficult for the forum to help you repro and diagnose your configuration.

    Friday, June 15, 2012 7:42 PM
    Moderator

All replies

  • Sorry. The colsed loop control is:

    Entry-|-->Control--->Plant-|-->Scope

              |<----- Sensor-----<-|

    Thursday, May 24, 2012 8:29 PM
  • The attached image is not visible, can you try to attach it again?

    Are you using a manifest to describe which services to start and the partner relationship between them?

    To properly diagnose your problem I may need to see the whole project... do you have a drop-box location or something similar to share the code?

    Thursday, May 24, 2012 9:16 PM
  • I haven't a drop-box or simular.

    I implemented all service in separate solutions, and all is similar like this:

    My manifest:

    <?xml version="1.0" ?>
    <Manifest
        xmlns="http://schemas.microsoft.com/xw/2004/10/manifest.html"
        xmlns:dssp="http://schemas.microsoft.com/xw/2004/10/dssp.html"
        >
        <CreateServiceList>
            <ServiceRecordType>
                <dssp:Contract>http://localhost:50000/plant.html</dssp:Contract>
            </ServiceRecordType>
            <ServiceRecordType>
              <dssp:Contract>http://localhost:50000/Control.html</dssp:Contract>
            </ServiceRecordType>
          </CreateServiceList>
    </Manifest>

    My .cs declarations:

    class PlantaService : DsspServiceBase
        {
            /// <summary>
            /// Service state
            /// </summary>
            [ServiceState]
            PlantState _state = new PlantaState();

            /// <summary>
            /// Main service port
            /// </summary>
            [ServicePort("/Plant", AllowMultipleInstances = true)]
            PlantOperations _mainPort = new PlantOperations();
            // Partner with control
            [Partner("Control", Contract = control.Contract.Identifier,
                CreationPolicy = PartnerCreationPolicy.UseExistingOrCreate, Optional = false)]
            private control.ControlOperations _controlPort = new control.ControlOperations();

            [SubscriptionManagerPartner]
            submgr.SubscriptionManagerPort _submgrPort = new submgr.SubscriptionManagerPort();


            /// <summary>
            /// Service constructor
            /// </summary>
            public PlantService(DsspServiceCreationPort creationPort)
                : base(creationPort)
            {
            }

            /// <summary>
            /// Service start
            /// </summary>
            protected override void Start()
            {
                      Implementation...........

    And Types.cs:

    /// <summary>
        /// Plant contract class
        /// </summary>
        public sealed class Contract
        {
            /// <summary>
            /// DSS contract identifer for Planta
            /// </summary>
            [DataMember]
            public const string Identifier = "http://localhost:50000/plant.html";
        }

        /// <summary>
        /// Plant state
        /// </summary>
        [DataContract]
        public class PlantState
        {
            private float[] _OutputSignal;   
            [DataMember]
            public float[] OutputSignal
            {
                get { return _OutputSignal; }
                set { _OutputSignal = value; }
            }

            private float[] _InputSignal;     
            [DataMember]
            public float[] InputSignal
            {
                get { return _InputSignal; }
                set { _InputSignal = value; }
            }
        }

    and default fuctions...

    The close loop is :

    Entry-|-->Control--->Plant-|-->Scope

              |<----- Sensor-----<-|

    Sensor take output signal to Plant and gives to Control to less this signal to Entry signal.

    At this moment I only try to conect all services and Í don't implement nothing especific. Only give a incremental signal across the services.

    Thanks

    Saturday, May 26, 2012 8:48 AM
  • So, just to make sure the issue is clear, you're finding that there are literally two instances of the Plant and Control services running after you start up the Scope service? Seems like there could be a sequencing or timing issue, but it's hard to tell without seeing each of the services and manifests in their entirety...

    Art

    Thursday, May 31, 2012 8:15 PM
    Moderator
  • Could you put your project on any file share and send the path?

    Usually in the manifest, when you drag your service partners which implement the contract, dssme asks you to choose whether you want to use the same instance or create a new instance. You may have choosen create new instance, instead of use existing.

    Friday, June 1, 2012 7:43 PM
    Moderator
  • Yes,Iliterallyfound twoControls and two Plants and receipt display the results of the two simultaneously but with aslight delay.

    I hung up the folder:

    https://www.dropbox.com/sh/kzndp0ouihsat0e/hP-KjgrGMA

    Now there is a project "shocks"(Perturbacioes) to alter the values ​​of "Control", "Plant" and "Sensors".
    The other services Entity = Entrada and Scope = Visor.

    Thanks

    Saturday, June 2, 2012 8:37 AM
  • Thanks for posting your project. However, I see that there is a circular reference between the solutions and I cannot build. Controlador -> Sensor -> Planta -> Controlador -> ...  That is:

    Controlador.csproj references Sensor.Y2012.M04.Proxy.dll, which is built by:
    Sensor.csproj, referencing Planta.Y2012.M04.Proxy.dll, which is built by:
    Planta.csproj, referencing Controlador.Y2012.M04.Proxy.dll, which is built by Controlador.csproj above

    But of course, Constrolador.csproj can't be built because Sensor hasn't been built because Planta hasn't been built because Controlador hasn't been built, and around we go...

    Having completely separate solutions for each service and referencing DLLs rather than projects is making this possible. I imagine you got into this state by bootstrapping things before the dependencies were introduced.  Your build probably works as long as you don't clean \bin. Still, this is a very messy build and each service could easily be built against one version of a DLL only to have the DLL swapped out from under it by another solution.

    I don't think this is the source of your "multiple instance" problem but it makes it difficult to repro. Just looking at your manifests, I can't see the issue. I'm assuming that each of your projects is spinning up a separate DSSHost instance just for debugging? Otherwise that too seems strange and you could easily end up with multiple instances of your services under different hosts. For example, Visor and Sensor both reference Planta, but one in a DssHost on port 50000 and another on port 50004.

    Monday, June 11, 2012 10:05 PM
    Moderator
  • Thanks to reply.

    Yes. The services are called to be a circular feedback loop, but, when run "Visual" run all in order Visor-> Planta-> Controlador-> Sensor and this should find the service "Planta" had already been created but actually re-start it, and that's my problem.

    Did services in separate solutions is to can replace one service without changing the set, so that the sensor can be replaced by a different one. For that reason the possible change .DLL in the \ bin is what I wanted.

    On the other hand, as separate services, also wanted to explore the possibility of executing on different nodes, or computers. For that reason some services have defined the port 50004. Although I have not managed to find my services running on different nodes.

    Thursday, June 14, 2012 6:15 PM
  • Using separate solutions is fine (though circular refs between their builds is generally not). Using separate DSS hosts is fine (though some misconfig is likely causing new instances to spin up rather than remoting across nodes).

    However, your set of solutions *cannot be built* from a clean state because of the circular dependencies on DLLs. That is making it difficult for the forum to help you repro and diagnose your configuration.

    Friday, June 15, 2012 7:42 PM
    Moderator
  • OK. Thanks anyway.
    Left the project in that direction for a while if there is any solution.

    Tuesday, June 19, 2012 9:51 AM
  • I has been a while since the last post.  If you continue to have this problem and are able to post a buildable project we can continue the investigation.  In the meantime I will mark this thread answered.  If you do have a question, please start a new thread as answered threads do not get immediate attention.

    Friday, July 6, 2012 6:58 PM