Page 1 of 1

DSC832 Script Problem

Posted: Mon Jun 15, 2009 9:41 pm
by bjlamarca
I just changed over to a newer PC for HB, running Windows 2003 Server. Now, when the alarm system sends a series of commands in a short period of time, the script does not processes every command. The log is below. Scott, any suggestions on how to troubleshoot this?

"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Warning","Script is already running. Ignoring request to run script."
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Warning","Script is already running. Ignoring request to run script."
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"
"6/15/2009","9:27:39 pm","Scr-DS832ControlScript","Warning","Script is already running. Ignoring request to run script."
"6/15/2009","9:27:40 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Running]"
"6/15/2009","9:27:40 pm","Scr-DS832ControlScript","Audit","[Scr-DS832ControlScript.State] has changed to [Stopped]"

Re: DSC832 Script Problem

Posted: Wed Jun 17, 2009 9:21 am
by ScottBot
I'm not really familiar with your script, but I'm guessing that the warning about not running the script because it is already running is causing the problem for you. There's probably some timing differences on the new machine, but it's hard to say exactly what would be causing this.

Again, I don't really know the script, but what you might want to try is to re-check and process the input data at the end of the script (actually have a loop that continues to check for new data until there is none). That way if new data is received while the script is running and the task won't run the script again, the running script will pick up the new data after it has processed existing data.

Make sense?

Re: DSC832 Script Problem

Posted: Sun Jul 05, 2009 2:19 pm
by bjlamarca
Thanks for the response.

First I tried to loop the script continuously. I have the script check if that data is different then the last loop. If so, it processes it. When I started the script, the CPU jumped to 100% and stayed there. So I went back to having a task fire the script, which then loops 1000 times to catch any data that comes quickly. Seems to be working.

Re: DSC832 Script Problem

Posted: Mon Jul 06, 2009 6:08 pm
by Richard Naninck
If you create a continuous running script, implement a "Sleep 1" in the loop and the cpu will go back to zero again.

A simple main loop could like somthing like this:

Code: Select all

Do
	Sleep 1
	'ActionReceive gets set by a task that triggers on a change in ReceivedData
	'This is done to accept duplicates in ReceivedData for being able to get multiple of the i.e. same Power State updates
	ActionReceive = GetPropertyValue("Receiver Status.Action Receive")
	If ActionReceive = "GetReceivedData" Then
		SetpropertyValue "Receiver Status.Action Receive", "Waiting"
		ReceivedData = GetPropertyValue("Receiver.Received Data")
		Call Handle_ReceivedData(ReceivedData)
		Sleep 200
	End If
	
	Action = GetPropertyValue("Receiver Status.Action")
	If Action <> "Waiting" Then
		If Action <> "" Then	
			Call Handle_SendData(Action)
		End If
		SetPropertyValue "Receiver Status.Action", "Waiting"
		Sleep 100
	End If
Loop