Forcing Tags to WonderWare SQL

chrisj91

Member
Join Date
Nov 2010
Location
England
Posts
33
Just a quick question really (I hope).

I have mainly worked with Allen Bradley and FactoryTalk so WonderWare seems quite different to use for me at the moment.

I've installed the IndustrialSQL Server on to my server and have imported tags which will only get updated once they are 'Forced'.

Now, am I correct in thinking that this 'action' which will 'force' the tags to be updated can be achieved by, say, someone pushing a button in WindowViewer? I have an idea on what it may be and have posted a screenshot, but I'm unsure as to what to put in the ConnectionID area as I thought the name of the server would go here, but I only want one tag to be updated.

Any help would be much appreciated.

WWScreenshot.png
 
Chris,

When you configured your tags in InSQL, you should have had the option to set them up logging as either cyclic (time-based) or delta (on change). I'm assuming from your post that they are configured for delta. You do not need to configure any SQL statements in your InTouch app because InSQL should always be watching the tag and waiting for it to change and then it will log the new value. In other words, you do not need to do anything special in your app for InSQL. If InSQL is watching the tag, it will log the data per the configuration in InSQL.

Jeff
 
Hi Jeff,

Thanks for the reply. When I configured my tags in InSQL, there were three options, cyclic and delta as you described, but also a 'force' which I thought would get tag values when 'told to' through some sort of HMI command.

The delta option would be good in most cases but I want a way of capturing the user logged on at the time that an alarm is quarantined, and not just each time they are logged on. I can then report these in excel using the ActiveFactory Add-In.

So, in a bit of a simpler way I guess, if a user writes a value to a tag named Alm_Qtne for instance, then, I want it to record the value of the tag Alm_Qtne and the user logged on by recording the value of the built-in tag $Operator at the same time.

Hope that makes sense. . .

Many Thanks
 
Chris,

You should be able to do that through delta logging. If you're logging both the alarm tag and the $Operator tag as delta, InSQL will capture each when they change. When you perform your query for the alarm condition, you would include the $Operator tag in the query, and the query will return whatever the value of the $Operator tag was at that particular time. For example:

SELECT Alm_Qtne, $Operator FROM ...
WHERE Alm_Qtne = .... (or whatever your where clause should be)

Is that what you're looking for?
 
Jeff,

I did think of that option, but the Alm_Qtne and $Operator Values will not line up to the correct date as people may log on and off without quarantining an alarm, so this would end up with two seperate lists of different lengths if you see what I'm saying. . .

I need a way of when the value of Alm_Qtne changes, it also logs the $Operator at the same time and that time only if possible?

So in a table, it may appear like:


Date and Time | Tag Name | Tag Description a| Tag Value |User ($Operator)
aaaaaaaaaaaal| aaaaaaaa l|aaaaaaaaaaaaaala|aaaaaaalaa|
24/04/10 23:00| Alm_Qtne | Alarm Quarantine | 1 or On aa| Charlie


Quite a tricky one. . .

Thanks for your help so far
 
Explaining my thoughts a little further. . .

I have a button which will quarantine an alarm, I was thinking if there were any way of putting an action on that same button which also records the values of the tags Alm_Qtne and $Operator in InSQL at that time, and if possible, that time only.

If this is not possible, I wondered if there were any other ways to achieve the same or a similar outcome?

Many Thanks
 
Chris,

The value of the $Operator tag does not need to be "hard logged" each time the value of Alm_Qtne is set. InSQL will retain the last value of $Operator until it is changed. So when you query for all the instances when Alm_Qtne = 1, the query will return the value of $Operator at that exact moment in time when Alm_Qtne = 1.

In other words, you can query for any tag's value at any particular moment in time, and InSQL will return that value for you. Just because there may not have been a change in the tag value at the particular instant in time you are interested in does not mean that InSQL can't return the value. It will return whatever the last value was that it saw the tag change to.
 
Jeff,

I'm with you now and see what you're saying. So, instead of searching $Operator with a time and date, I can actually search using an expression, like you said, when Alm_Qtne = 1. . . Interesting. . .

I shall change my tags back to Delta logging as you suggested then so a value will be recorded each time they change, and then I can just query these tags as explained.

Thank you for your time and your help Jeff
 
Hi Jeff,

Sorry to start bothering you again. I've been playing around a little, got my tags retrieving values like I wanted. . . But I can't seem to find or figure out a way to query $Operator for all the instances when Alm_Qtne = 1.

There doesn't seem to be any nice and easy 'search' or 'expression' boxes so would I be correct in thinking that I need to add it to a line of the SQL code? And if so, would you have an idea of how to write that? The code I see so far is this:

SET NOCOUNT ON
DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
SET @StartDate = DateAdd(mi,-5,GetDate())
SET @EndDate = GetDate()
SET NOCOUNT OFF
SELECT TagName, DateTime = convert(nvarchar, DateTime, 21), Value, vValue, Quality, QualityDetail = History.QualityDetail, QualityString
FROM History
LEFT JOIN QualityMap ON QualityMap.QualityDetail = History.QualityDetail
WHERE TagName IN ('$Operator', 'Alm_Qtne_Boost_Set_Lo_Press')
AND wwRetrievalMode = 'Delta'
AND wwVersion = 'Latest'
AND DateTime >= @StartDate
AND DateTime <= @EndDate

I may be off the mark a little here, but I haven't really used SQL before, all a nice big learning curve for me.

Thanks again
 
Last edited:
Chris,

I'm assuming you built that query with the Query tool in Active Factory? I did the same with the query below based on one of my discrete tags and a message tag, but I'll substitue your tagnames in so maybe you can just copy and paste:

SET QUOTED_IDENTIFIER OFF
SELECT TOP 5000 * FROM OPENQUERY(INSQL, "SELECT DateTime = convert(nvarchar, DateTime, 21), [Alm_Qtne_Boost_Set_Lo_Press], [$Operator]
FROM WideHistory
WHERE [Alm_Qtne_Boost_Set_Lo_Press] = 1
AND wwRetrievalMode = 'Delta'
AND wwVersion = 'Latest'
AND DateTime >= DateAdd(hh,-4,GetDate())
AND DateTime <= GetDate()")
ORDER BY DateTime ASC

Give that a try.
 
Well Jeff,

I just gave that a go and it works like a dream!! Thank you so much for your help. When I first set about this I never thought I'd be able to solve it, but you've been a massive help. Thank God for plcs.net and people like you.

Thanks once again,

Chris
 
I definitely will, just reading the previous threads has helped me out no end of times before.

I hope one day I will :)
 

Similar Topics

Dear Fellows; I am working on a very old machine which is designed in GE 90-30 PLC system. I have some difficulties like 1. How a force to...
Replies
3
Views
298
Hi. This is the first time I do a project with Rockwell PLC from scratch. I started a bit just building some AOI for a couple things I need to...
Replies
2
Views
532
Hello, when trying to force two outputs nothing happened. The text ON appeared by the adress. It was also possible to force off, which also...
Replies
17
Views
4,742
In GX developer, is there a way of forcing a digital input to ON (e.g. X070 to TRUE/On). I've just installed a QX10 module and I want to check...
Replies
15
Views
4,844
Hello, Controllogix 5572 with Studio 5000 v33 and FactoryTalk View SE v12. Is there a way to force I/O bits using HMI pushbuttons? I've tried...
Replies
6
Views
2,826
Back
Top Bottom