Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Close
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
84248members
353348posts

[Imported] Converting whole database

EcoStruxure Geo SCADA Expert Forum

Find out how SCADA systems and networks, like EcoStruxure Geo SCADA Expert, help industrial organizations maintaining efficiency, processing data for smarter decision making with IoT, RTU and PLC devices.

sbeadle
Janeway Janeway
Janeway
0 Likes
0
432

[Imported] Converting whole database

>>Message imported from previous forum - Category:Scripts and Tips<<
User: mchartrand, originally posted: 2018-10-25 19:46:35 Id:288
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.

_______

**_scadacrush:
Long time lurker but now I am stuck.
I was told by CMI that the OPC driver is "not supported" and to get full features and functionality, I would need to convert my database to Advanced OPC. As of now the system I am working on is not live but has almost 4,000 OPC points added. I have been working on a script to do this but this is a little advanced for me. If you can look at what I have thrown together and give me some tips I would be grateful._**

_option explicit
sub ConvertPoints
Dim Qry
Dim oObj
Dim objServer
Dim Rows
Dim r
Set Qry = Server.Query("SELECT FullName, Name, Id FROM COpcDigitalPoint")
If Not(Qry.Error) Then
Rows = Qry.Rows
For r = 0 To Ubound(Rows, 1)
set oObj = objServer.Id (Rows(r,2))
oObj.Convert ("CAdvOPCDigital")
Next
Else
Msgbox Qry.ErrorMessage, vbCritical + vbOKOnly, "Error in SQL Command"
End If
End Sub_

___________________________

nminchin:
Instead of objServer.Id (you haven't instantiated this), use:

_Set oObj = Server.FindObject(Rows(r,0))_

Remove the () from .Convert as well since you're not assigning the result to anything
e.g. oObj.Convert "CAdv..."

___________________

**_scadacrush:
Thanks nminchin,
I get an error using the the .findobject. I read it does not support .convert method. I was trying to get the row ID (ServerObject.Id) from the SQL query and use the .convert method. Unless I am reading it wrong in the help file?_**

_______

bevanweiss:
There's a few items that might need attention here...

a) When you say 'CMI' told you the OPC driver is 'not supported', who was it that said such? My understanding was that both the Simple OPC and Advanced OPC would continue to be supported for a few more releases at least. I would expect more warning from Schneider if they were going to just remove it.

b) If you are using a query, then I'd recommend a few things...
First, you should really include the Id, it helps the query performance a little
Second, once you have the ID, then you most as well use this for the lookup instead of the fullname
Third, you really want to include the templates also, since I expect that a lot of your points will be from the template. So you will want to use "SELECT WITH TEMPLATES Id FROM COpcDigitalPoint". Then you would use the LookupObject(id) method to return the ScxV6Object reference

c) If you are just using the inbuilt ViewX script engine, then you are not able to use the Convert method (I believe, at least not this way... via .Interface.Convert might work). You would need to create an Automation Interface (as a COM object) via a CreateObject("ScxV6DBClient.ScxV6Server") call (or Dim srv as ScxV6DBClient.ScxV6Server, Set srv = new ScxV6DBClient.ScxV6Server)

__________________________


AWoodland:
I've flagged this to Brad as the product manager, afaik it is fully supported still. But I can understand why it could be recommended to use the advanced OPC driver over the simple driver but I doubt that recommendation equates to converting existing production databases, perhaps more towards the new configurations.

Will see what he says.:

______________________________

bshaw:
To clarify, the Advanced OPC driver that was introduced in ClearSCADA 2014 R1 is an alternative to the existing 'Simple' OPC driver, but does not mean that the Simple OPC driver is unsupported. The Simple OPC driver in ClearSCADA is still fully supported, and there are no plans for this to change.

The Advanced OPC driver is recommended for new users on new projects, but existing implementations of the Simple OPC driver are not required to upgrade/migrate. Existing Simple OPC objects can be converted to Advanced OPC objects if desired.

If you have received information from Schneider Electric employees to the contrary, please kindly inform them (or show them this post).

__________________________

**_scadacrush:
Maybe I am phrasing this incorrectly. Its obvious that the drive works but I was told any new features are going to be in the advanced opc and yes it was recommended that I switch to the advanced driver. This is the script support sent me but this will only do ONE point at a time._**

_sub ConvertPoint
Set oServer = CreateObject ("Serck.ScxV6Server")
' You will need to change the login info here
oServer.Connect "Main", "User", "Password"
Set oGroup = oServer.FindObject ("Customers.OPCDP")
set oObject = oGroup.Convert("CAdvOPCDigital")
oServer.Disconnect()
end sub_

**_I also asked if there was any tool to convert a digital point to an analog point and was told it was not possible to convert different objects. I actually am surprised that I am the only person who has these problems?_**

_______________________________________________

**_scadacrush:
So is this doable on this scale? Or should I just not worry about it?_**

________________________

AWoodland:
Without knowing more about what you're doing and your expectations it is tough to comment but some generic ones:

1. If you do this without Sleep between each loop you may cause the system to perform really slowly or appear to lock up. This could be more of a problem depending on your KPIs and if you have Standby servers connected as they could go Main;

2. It should work, but test on an offline copy first and do backups;

3. If you are using templates and instances it perhaps gets a little more complex as you need to convert the object in the template not the instance. By default the SQL query will only return the objects in the instance so you need to add the WITH TEMPLATES keywords or do some matching up;

4. Did I mention the backups? 🙂

__________

bshaw:
Depending on which version of ClearSCADA you are using, it's possible to migrate all objects in a single action.

From ClearSCADA 2015 R1 an assisted migration is available, whereby converting a Simple OPC "Scanner" to an Advanced OPC "Group" will result in all connected points being converted from the Simple version object to the equivalent Advanced object. This includes Analog, Digital, Time and String points. To see this in action, create a simple architecture of connected simple OPC objects and try converting the Scanner to an Advanced OPC Group.

Regarding conversion of Analog to Digital (or vice versa), this is not possible as you've been advised due to the conflicting internal architecture of the Analog/Digital objects. Even if this was possible, there is very few common attributes between these objects, meaning that it's almost as easy to delete the object and create a new one. Any existing historical data would not make sense once converted anyway, so you've not lost anything in this regard.

__________________________________________


**_scadacrush:
AWoodland
The systme has no historic information. As I said its not a live system, this is being developed to be deployed at some point in time. With that said "in theory" what would I need to do to convert a object to another object if I need to ? I accidentally added ~6-800 points as opcdigital and they should be AI.
bshaw
I am using version 2015 and all of my points are connect to scanners. I will give this a try because it sounds to be the easiest way for now. I think this will get almost all the points in the system. Thanks for letting me know about this
Thanks for everyone's help on this._**

____________________________

bevanweiss:
'In theory', to convert a digital point to an analog point, or from simple to advanced or similar... essentially any 'non-convertible' transition.

For each point to migrate
create new point at highest level with different name (i.e. if original point is templated, new point should be also)
map across appropriate settings from old point (alarm limits, point address etc) to new point
export all historical data from old point, apply rule to convert to new point type and import into new point
export all event / alarm data from old point, import into new point
next

To be honest... your best best is to:
a) be more careful first, and don't create so many of the wrong point type 😉
b) delete the wrong points, fix your auto script and regenerate the new points