PISDK behavior: exe vs windows service

Discussion created by ygalipeau on Apr 17, 2010
Latest reply on Apr 21, 2010 by ken

good morning everyone,


I am working on a multithread windows service application that use SDK to generate some events in my Ekho application suite. here is the case: i am using the event pipe to subscribe to pi tags (it's currently working with 974 subscriptions for wind turbines and that is great!!!)


when i receive event from the pipe, i need to do some action (including gathering additional pi tag values with the arcvalue method). what i am experiencing is that when i am requesting a pi tag and that pi tag was one of my tag subscribed in the event pipe, i am not able to retreive the value. the pointvalue object is frozen or something else. To add more strangeness to that, this is the case only when the code is running as a windows service. if it's a regular exe, no problem.


i am attaching a very simple project that reproduce this behavior. it's constitued of 3 vb.net project and you can run it as exe and compile and install it as service as well. in the project i am subscribing to the tag BA:Active.1 and when i receive and event for it, i go back to the archive to request it's value. so i you start the UI project and use SMT to insert a new value into ba:active.1 and you open UI\bin\Debug\Log\eeg.log you will see


116 DEBUG 9 [Root] Starting Windows App
894 INFO 9 [TestPI.PIEventListener] PI Event Pipe was successfully initialize with BA:Active.1
15967 DEBUG 10 [TestPI.PIEventListener] BA:ACTIVE.1 = Inactive    timestamp : 1271511499
15970 INFO 6 [TestPI.PIEventListener] Starting thread
16024 DEBUG 6 [TestPI.PIPointReader] Points read : 1
16030 DEBUG 6 [TestPI.PIPointReader] BA:ACTIVE.1 = Inactive ********* reading OK
16030 INFO 6 [TestPI.PIEventListener] Ending thread


which means everything is ok.


now simply run the BuildAndInstall.cmd to compile the same code as a service and install it under the name _Test_Read_PI_. now start it and put a new value for the ba.active.1 tag and the log under WindowsService1\bin\Debug\Log\eeg.log. will show:


90 INFO 4 [Root] Starting service
869 INFO 4 [TestPI.PIEventListener] PI Event Pipe was successfully initialize with BA:Active.1
10960 DEBUG 5 [TestPI.PIEventListener] BA:ACTIVE.1 = Active    timestamp : 1271511546
10963 INFO 4 [TestPI.PIEventListener] Starting thread
10979 DEBUG 4 [TestPI.PIPointReader] Points read : 1


and its never able to give me the value. and it's the same code. also this is a very simplified version of the real one, but it can easily reproduce the problems. also i know that i have already the value in the event pipe so why reading it again, but it could be 2 different process that don't know each other and one trigger on the TagA and the other one trigger on Tag b, but need the value of Tag A at the trigger time.


do not hesitate if you have question as i know it's hard to explain everything clearly by text.


and also Go Habs Go!


have a nice weekend


yannick galipeau