<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>ControlSystemWorks Blog - opc</title>
    <link>http://www.controlsystemworks.com/blog/</link>
    <description>Of CSWorks and software development</description>
    <language>en-us</language>
    <copyright>ControlSystemWorks.com</copyright>
    <lastBuildDate>Mon, 08 Mar 2010 19:48:03 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>support@ControlSystemWorks.net</managingEditor>
    <webMaster>support@ControlSystemWorks.net</webMaster>
    <item>
      <trackback:ping>http://www.controlsystemworks.com/blog/Trackback.aspx?guid=1baf1a31-3801-4fa9-98e2-ab245a5f8e48</trackback:ping>
      <pingback:server>http://www.controlsystemworks.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.controlsystemworks.com/blog/PermaLink,guid,1baf1a31-3801-4fa9-98e2-ab245a5f8e48.aspx</pingback:target>
      <dc:creator>Sergey Sorokin</dc:creator>
      <wfw:comment>http://www.controlsystemworks.com/blog/CommentView,guid,1baf1a31-3801-4fa9-98e2-ab245a5f8e48.aspx</wfw:comment>
      <wfw:commentRss>http://www.controlsystemworks.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1baf1a31-3801-4fa9-98e2-ab245a5f8e48</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
After installing CSWorks, many of you are tempted to connect it to your OPC data source.
Here is a quick step-by-step guide how you can do that in five minutes.<br /><br />
In this example, I will assume we are dealing with Matrikon OPC Simulation Server
- you can download it for free from Matrikon website. After installing Matrikon components,
you can start tweaking CSWorks Pipes and Tank Demo so it uses data from Matrikon OPC
Server.<br /><br /><b>Add new data source to LiveData Service configuration</b><br /><br />
Add a few lines to C:\Program Files\CSWorks\Framework\Server\CSWorks.Server.LiveDataService.exe.config:<br /><br /><font color="#0000ff" size="1">    &lt;opcLiveDataSources type="CSWorks.Server.DataSource.Opc.OpcLiveDataSource,
CSWorks.Server.OpcProvider"&gt;<br />
      ...<br /><b>      &lt;opcLiveDataSource name="OpcMatrikon" sampleBufferLength="16"
hostName="localhost" progId="Matrikon.OPC.Simulation.1" subscriptionUpdateRate="250"&gt;<br />
        &lt;templates&gt;<br />
          &lt;template name="matrikonBoolTag"
type="Boolean" readPath="Random.Boolean" canWrite="true"/&gt;<br />
        &lt;/templates&gt;<br />
      &lt;/opcLiveDataSource&gt;</b><br />
    &lt;/opcLiveDataSources&gt;</font><br /><br />
Restart LiveData Service so your changes take effect and the service connects to the
data source.<br /><br /><b>Add new data source to LiveData Server topology configuration</b><br /><br />
Add one line to C:\Program Files\CSWorks\Demo\Web\LiveDataWebService\web.config:<br /><br /><font color="#0000ff" size="1">  &lt;liveDataTopology&gt;<br />
    &lt;liveDataPartitions&gt;<br />
      &lt;liveDataPartition name="partition1" primaryLiveDataServer="liveDataServer_1_primary"
secondaryLiveDataServer=""&gt;<br />
        &lt;dataSources&gt;<br />
          ...<br /><b>          &lt;dataSource name="OpcMatrikon"/&gt;</b><br />
        &lt;/dataSources&gt;<br />
      &lt;/liveDataPartition&gt;<br />
    &lt;/liveDataPartitions&gt;<br />
  &lt;/liveDataTopology&gt;</font><br /><br />
Now LiveData Web Service knows where to get data for OpcMatrikon data source.<br /><br /><b>Modify demo application</b><br /><br />
Run Microsoft Visual Studio and open Pipes and Tanks Demo project at C:\Program Files\CSWorks\Demo\Src\PipesAndTanksDemo\PipesAndTanksDemo.Sample.csproj.
Let's make several additions to the Page.xaml file.<br /><br />
Add a new data item that gets data from the boolean tag configured for Matrikon OPC
Server:<br /><br /><font color="#0000ff" size="1">    &lt;UserControl.Resources&gt;<br />
        ...<br />
        <b>&lt;d:BoolDataItem x:Key="TestValve"
Id="type in new guid here" DataSource="OpcMatrikon" TemplateName="matrikonBoolTag"
Parameters=""/&gt;</b><br />
    &lt;/UserControl.Resources&gt;</font><br /><br /><br />
Add a few visual elements to the upper left corner of the screen and bind them to
the new data item:<br /><br /><font color="#0000ff" size="1">        &lt;controls:TabControl...&gt;<br />
            &lt;controls:TabItem
Header="HMI Controls View"&gt;<br />
               
&lt;Canvas&gt;<br />
                   
...<br />
                   
&lt;Grid ...&gt;<br />
                         
...<br />
                     
&lt;/Grid.ColumnDefinitions&gt;</font></p>
        <p>
          <font color="#0000ff" size="1">                        <b>&lt;pipes:RightValve
Grid.Row="0" Grid.Column="3" IsOpen="{Binding Value, Mode=OneWay, Source={StaticResource
TestValve}}" OpenColor="Black" ClosedColor="Black" IsEnabled="False" Margin="-16,0,16,0"/&gt;<br />
                       
&lt;PipesAndTanksDemo:Wireframe Grid.Row="0" Grid.Column="3" Status="{Binding Status,
Mode=OneWay, Source={StaticResource TestValve}}" Margin="-16,0,16,0"/&gt;<br />
                       
&lt;pipes:RightTWay Grid.Row="0" Grid.Column="2" IsFilled="{Binding Value, Mode=OneWay,
Source={StaticResource TestValve}}" FillColor="Coral" Margin="-16,0,16,0"/&gt;<br />
                       
&lt;PipesAndTanksDemo:Wireframe Grid.Row="0" Grid.Column="2" Status="{Binding Status,
Mode=OneWay, Source={StaticResource TestValve}}" Margin="-16,0,16,0"/&gt;</b><br />
                       
...</font>
          <br />
          <br />
Now we have a valve and a t-way joint that supply some coral-colored liquid to Tank
1. Also, we have added a couple of Wireframe elements that will tell us if something
is wrong with Matrikon boolean tag.<br /><br />
Time to tell DataManager that we have a new data item. Add a command to the Page_Loaded()
handler in Page.xaml.cs:<br /><br /><font color="#0000ff"><font size="1">        void
Page_Loaded(object sender, RoutedEventArgs e)<br />
        {<br />
          ...<br />
          <b>dataManager.DataItems.Add(Resources["TestValve"]
as DataItem);</b></font><br /></font><br />
Do not forget to update the id of the datamanager in the Page.xaml, otherwise LiveData
Service will keep using cached list of required data items and Matrikon tag value
will never be returned:<br /><font size="1"><br /></font><font color="#0000ff" size="1">        &lt;d:DataManager
x:Key="DataManager" Id="<b>type in new guid here</b>" /&gt;</font><br /><br />
We are done. Build client application and run it at http://localhost/CSWorksDemo/PipesAndTanksDemo.html
(or click Start menu and choose All Programs -&gt; CSWorks -&gt;  Client Samples
-&gt; Pipes and Tanks Demo). The left upper corner of the screen will have some new
visual elements - <a href="content/binary/2010-03-08-MatrikonValve.png">see screenshot</a>.
</p>
        <p>
          <b>Security Issues</b>
        </p>
        <p>
In the case of Matrikon Simulation OPC Server, we did not have any issues with COM/DCOM
security, because Matrikon installer lets everyone access this OPC Server. You can
verify it by running dcomcnfg.exe tool and checking out Matrikon Simulation OPC Server
configuration - it explicitly says that "Everyone" has "Launch and Activation" and
"Access" permissions for this component, <a href="content/binary/2010-03-08-MatrikonSecurity.png">see
screenshot</a>.
</p>
        <p>
This cannot be considered safe practice, but makes casual user's life a bit easier.
Not all OPC server providers write installers that allow the whole world to access
their components. In some cases, you may get notorious "Access Denied" COM/DCOM error
0x80070005 when CSWorks accesses OPC server. Stay tuned - there will be a post dedicated
to COM/DCOM security.<br /></p>
        <img width="0" height="0" src="http://www.controlsystemworks.com/blog/aggbug.ashx?id=1baf1a31-3801-4fa9-98e2-ab245a5f8e48" />
      </body>
      <title>CSWorks demo and your OPC data source</title>
      <guid isPermaLink="false">http://www.controlsystemworks.com/blog/PermaLink,guid,1baf1a31-3801-4fa9-98e2-ab245a5f8e48.aspx</guid>
      <link>http://www.controlsystemworks.com/blog/2010/03/08/CSWorksDemoAndYourOPCDataSource.aspx</link>
      <pubDate>Mon, 08 Mar 2010 19:48:03 GMT</pubDate>
      <description>&lt;p&gt;
After installing CSWorks, many of you are tempted to connect it to your OPC data source.
Here is a quick step-by-step guide how you can do that in five minutes.&lt;br&gt;
&lt;br&gt;
In this example, I will assume we are dealing with Matrikon OPC Simulation Server
- you can download it for free from Matrikon website. After installing Matrikon components,
you can start tweaking CSWorks Pipes and Tank Demo so it uses data from Matrikon OPC
Server.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Add new data source to LiveData Service configuration&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
Add a few lines to C:\Program Files\CSWorks\Framework\Server\CSWorks.Server.LiveDataService.exe.config:&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;opcLiveDataSources type="CSWorks.Server.DataSource.Opc.OpcLiveDataSource,
CSWorks.Server.OpcProvider"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;opcLiveDataSource name="OpcMatrikon" sampleBufferLength="16"
hostName="localhost" progId="Matrikon.OPC.Simulation.1" subscriptionUpdateRate="250"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;templates&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;template name="matrikonBoolTag"
type="Boolean" readPath="Random.Boolean" canWrite="true"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/templates&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/opcLiveDataSource&amp;gt;&lt;/b&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/opcLiveDataSources&amp;gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
Restart LiveData Service so your changes take effect and the service connects to the
data source.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Add new data source to LiveData Server topology configuration&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
Add one line to C:\Program Files\CSWorks\Demo\Web\LiveDataWebService\web.config:&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="1"&gt;&amp;nbsp; &amp;lt;liveDataTopology&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;liveDataPartitions&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;liveDataPartition name="partition1" primaryLiveDataServer="liveDataServer_1_primary"
secondaryLiveDataServer=""&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dataSources&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dataSource name="OpcMatrikon"/&amp;gt;&lt;/b&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/dataSources&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/liveDataPartition&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/liveDataPartitions&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/liveDataTopology&amp;gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
Now LiveData Web Service knows where to get data for OpcMatrikon data source.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Modify demo application&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
Run Microsoft Visual Studio and open Pipes and Tanks Demo project at C:\Program Files\CSWorks\Demo\Src\PipesAndTanksDemo\PipesAndTanksDemo.Sample.csproj.
Let's make several additions to the Page.xaml file.&lt;br&gt;
&lt;br&gt;
Add a new data item that gets data from the boolean tag configured for Matrikon OPC
Server:&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;UserControl.Resources&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&amp;lt;d:BoolDataItem x:Key="TestValve"
Id="type in new guid here" DataSource="OpcMatrikon" TemplateName="matrikonBoolTag"
Parameters=""/&amp;gt;&lt;/b&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/UserControl.Resources&amp;gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Add a few visual elements to the upper left corner of the screen and bind them to
the new data item:&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;controls:TabControl...&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;controls:TabItem
Header="HMI Controls View"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;Canvas&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;Grid ...&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;/Grid.ColumnDefinitions&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color="#0000ff" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&amp;lt;pipes:RightValve
Grid.Row="0" Grid.Column="3" IsOpen="{Binding Value, Mode=OneWay, Source={StaticResource
TestValve}}" OpenColor="Black" ClosedColor="Black" IsEnabled="False" Margin="-16,0,16,0"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;PipesAndTanksDemo:Wireframe Grid.Row="0" Grid.Column="3" Status="{Binding Status,
Mode=OneWay, Source={StaticResource TestValve}}" Margin="-16,0,16,0"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;pipes:RightTWay Grid.Row="0" Grid.Column="2" IsFilled="{Binding Value, Mode=OneWay,
Source={StaticResource TestValve}}" FillColor="Coral" Margin="-16,0,16,0"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;PipesAndTanksDemo:Wireframe Grid.Row="0" Grid.Column="2" Status="{Binding Status,
Mode=OneWay, Source={StaticResource TestValve}}" Margin="-16,0,16,0"/&amp;gt;&lt;/b&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
...&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
Now we have a valve and a t-way joint that supply some coral-colored liquid to Tank
1. Also, we have added a couple of Wireframe elements that will tell us if something
is wrong with Matrikon boolean tag.&lt;br&gt;
&lt;br&gt;
Time to tell DataManager that we have a new data item. Add a command to the Page_Loaded()
handler in Page.xaml.cs:&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff"&gt;&lt;font size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void
Page_Loaded(object sender, RoutedEventArgs e)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;dataManager.DataItems.Add(Resources["TestValve"]
as DataItem);&lt;/b&gt;&lt;/font&gt;
&lt;br&gt;
&lt;/font&gt;
&lt;br&gt;
Do not forget to update the id of the datamanager in the Page.xaml, otherwise LiveData
Service will keep using cached list of required data items and Matrikon tag value
will never be returned:&lt;br&gt;
&lt;font size="1"&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font color="#0000ff" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:DataManager
x:Key="DataManager" Id="&lt;b&gt;type in new guid here&lt;/b&gt;" /&amp;gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
We are done. Build client application and run it at http://localhost/CSWorksDemo/PipesAndTanksDemo.html
(or click Start menu and choose All Programs -&amp;gt; CSWorks -&amp;gt;&amp;nbsp; Client Samples
-&amp;gt; Pipes and Tanks Demo). The left upper corner of the screen will have some new
visual elements - &lt;a href="content/binary/2010-03-08-MatrikonValve.png"&gt;see screenshot&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Security Issues&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
In the case of Matrikon Simulation OPC Server, we did not have any issues with COM/DCOM
security, because Matrikon installer lets everyone access this OPC Server. You can
verify it by running dcomcnfg.exe tool and checking out Matrikon Simulation OPC Server
configuration - it explicitly says that "Everyone" has "Launch and Activation" and
"Access" permissions for this component, &lt;a href="content/binary/2010-03-08-MatrikonSecurity.png"&gt;see
screenshot&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
This cannot be considered safe practice, but makes casual user's life a bit easier.
Not all OPC server providers write installers that allow the whole world to access
their components. In some cases, you may get notorious "Access Denied" COM/DCOM error
0x80070005 when CSWorks accesses OPC server. Stay tuned - there will be a post dedicated
to COM/DCOM security.&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.controlsystemworks.com/blog/aggbug.ashx?id=1baf1a31-3801-4fa9-98e2-ab245a5f8e48" /&gt;</description>
      <comments>http://www.controlsystemworks.com/blog/CommentView,guid,1baf1a31-3801-4fa9-98e2-ab245a5f8e48.aspx</comments>
      <category>demo</category>
      <category>opc</category>
    </item>
    <item>
      <trackback:ping>http://www.controlsystemworks.com/blog/Trackback.aspx?guid=09a1c584-4532-4bea-8904-36a127bf2829</trackback:ping>
      <pingback:server>http://www.controlsystemworks.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.controlsystemworks.com/blog/PermaLink,guid,09a1c584-4532-4bea-8904-36a127bf2829.aspx</pingback:target>
      <dc:creator>Sergey Sorokin</dc:creator>
      <wfw:comment>http://www.controlsystemworks.com/blog/CommentView,guid,09a1c584-4532-4bea-8904-36a127bf2829.aspx</wfw:comment>
      <wfw:commentRss>http://www.controlsystemworks.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=09a1c584-4532-4bea-8904-36a127bf2829</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When someone runs CSWorks Pipes and Tanks Demo application for the first time, the
first question is: where all this data for pipes, tanks and valves comes from?<br /><br />
CSWorks installation package includes LiveData Emulator OPC Server component that
simulates mixing process and accepts input from the user when he/she opens and closes
the valves and changes mixing speed. LiveData Emulator OPC Server is useless for real-world
applications but works well as a simple data source for the demo.<br /><br />
In order to make sure that CSWorks displays actual data supplied by this OPC data
source, you may want to set up a quick demonstration and see how numbers are changing
simultaneously in the demo and in your favourite OPC viewer application.<br /><br />
First off, if you just run OPC viewer on the demo machine and connect it to CSWorks
LiveData Emulator OPC Server you will see some tags changing, but those changes won't
be in sync with the demo values. This happens because of the way COM/DCOM (and OPC)
works.<br /><br />
Unless you configured it otherwise, CSWorks LiveData Service runs under Network Service
user account - a special Windows account many system services run under. When CSWorks
LiveData Service is being told to access an OPC server (Emulator OPC Server in our
case), it instantiates it through COM/DCOM infrastructure. By default, a COM server
is started as a separate process on behalf of the launching user - Network Service.
If you have a look at the process list while CSWorks demo is running you will see
LiveData Emulator process running under Network Service account.<br /><br />
Now you run an OPC viewer application and connect it to CSWorks LiveData Emulator
OPC Server. Have a quick look at the process list again - you will see that now you
have another instance of LiveData Emulator process running under your personal account.
So you have two emulators supplying different data to CSWorks and to the OPC viewer.<br /><br />
Let's make both CSWorks and OPC viewer use the same instance of the emulator. Please
use Windows Service Manager to configure CSWorks LiveData Service so it runs under
you personal account (say, Administrator). Also use DCOM configuration tool (dcomcnfg.exe)
to make sure that LiveData OPC Emulator:<br /><br /></p>
        <ul>
          <li>
can be launched (Properties - Security - Launch and Activation Permissions) and accessed
(Properties - Security - Access Permissions) by your personal account;</li>
          <li>
is instantiated runs under interactive user account (Properties - Identity).</li>
        </ul>
        <p>
          <br />
          <a href="content/binary/2010-03-05-InteractiveUser.gif">This screenshot</a> shows
what has to be done.<br /><br />
After doing that, restart CSWorks LiveData Service and your OPC viewer, so they start
using properly configured LiveData OPC Emulator server. <a href="content/binary/2010-03-05-Tank1.gif">The
screenshot</a> shows three application windows: two Internet Explorer instances with
CSWorks demo application, and a third-party OPC viewer that is configured to receive
updates for "storage.numeric.reg01" tag. This is the item that CSWorks demo application
uses to store Tank 1 fill level. 
<br /><br />
As CSWorks LiveData Emulator changes Tank 1 fill level, you see it changing in all
three windows simultaneously. Perfect, we get the same data in all three windows.<br /><br />
After demonstrating CSWorks live data in action, do not forget to revert all changes
made in DCOM configuration and service manager.
</p>
        <img width="0" height="0" src="http://www.controlsystemworks.com/blog/aggbug.ashx?id=09a1c584-4532-4bea-8904-36a127bf2829" />
      </body>
      <title>CSWorks Demo and LiveData Emulator OPC Server</title>
      <guid isPermaLink="false">http://www.controlsystemworks.com/blog/PermaLink,guid,09a1c584-4532-4bea-8904-36a127bf2829.aspx</guid>
      <link>http://www.controlsystemworks.com/blog/2010/03/05/CSWorksDemoAndLiveDataEmulatorOPCServer.aspx</link>
      <pubDate>Fri, 05 Mar 2010 22:07:31 GMT</pubDate>
      <description>&lt;p&gt;
When someone runs CSWorks Pipes and Tanks Demo application for the first time, the
first question is: where all this data for pipes, tanks and valves comes from?&lt;br&gt;
&lt;br&gt;
CSWorks installation package includes LiveData Emulator OPC Server component that
simulates mixing process and accepts input from the user when he/she opens and closes
the valves and changes mixing speed. LiveData Emulator OPC Server is useless for real-world
applications but works well as a simple data source for the demo.&lt;br&gt;
&lt;br&gt;
In order to make sure that CSWorks displays actual data supplied by this OPC data
source, you may want to set up a quick demonstration and see how numbers are changing
simultaneously in the demo and in your favourite OPC viewer application.&lt;br&gt;
&lt;br&gt;
First off, if you just run OPC viewer on the demo machine and connect it to CSWorks
LiveData Emulator OPC Server you will see some tags changing, but those changes won't
be in sync with the demo values. This happens because of the way COM/DCOM (and OPC)
works.&lt;br&gt;
&lt;br&gt;
Unless you configured it otherwise, CSWorks LiveData Service runs under Network Service
user account - a special Windows account many system services run under. When CSWorks
LiveData Service is being told to access an OPC server (Emulator OPC Server in our
case), it instantiates it through COM/DCOM infrastructure. By default, a COM server
is started as a separate process on behalf of the launching user - Network Service.
If you have a look at the process list while CSWorks demo is running you will see
LiveData Emulator process running under Network Service account.&lt;br&gt;
&lt;br&gt;
Now you run an OPC viewer application and connect it to CSWorks LiveData Emulator
OPC Server. Have a quick look at the process list again - you will see that now you
have another instance of LiveData Emulator process running under your personal account.
So you have two emulators supplying different data to CSWorks and to the OPC viewer.&lt;br&gt;
&lt;br&gt;
Let's make both CSWorks and OPC viewer use the same instance of the emulator. Please
use Windows Service Manager to configure CSWorks LiveData Service so it runs under
you personal account (say, Administrator). Also use DCOM configuration tool (dcomcnfg.exe)
to make sure that LiveData OPC Emulator:&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
can be launched (Properties - Security - Launch and Activation Permissions) and accessed
(Properties - Security - Access Permissions) by your personal account;&lt;/li&gt;
&lt;li&gt;
is instantiated runs under interactive user account (Properties - Identity).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;br&gt;
&lt;a href="content/binary/2010-03-05-InteractiveUser.gif"&gt;This screenshot&lt;/a&gt; shows
what has to be done.&lt;br&gt;
&lt;br&gt;
After doing that, restart CSWorks LiveData Service and your OPC viewer, so they start
using properly configured LiveData OPC Emulator server. &lt;a href="content/binary/2010-03-05-Tank1.gif"&gt;The
screenshot&lt;/a&gt; shows three application windows: two Internet Explorer instances with
CSWorks demo application, and a third-party OPC viewer that is configured to receive
updates for "storage.numeric.reg01" tag. This is the item that CSWorks demo application
uses to store Tank 1 fill level. 
&lt;br&gt;
&lt;br&gt;
As CSWorks LiveData Emulator changes Tank 1 fill level, you see it changing in all
three windows simultaneously. Perfect, we get the same data in all three windows.&lt;br&gt;
&lt;br&gt;
After demonstrating CSWorks live data in action, do not forget to revert all changes
made in DCOM configuration and service manager.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.controlsystemworks.com/blog/aggbug.ashx?id=09a1c584-4532-4bea-8904-36a127bf2829" /&gt;</description>
      <comments>http://www.controlsystemworks.com/blog/CommentView,guid,09a1c584-4532-4bea-8904-36a127bf2829.aspx</comments>
      <category>demo</category>
      <category>opc</category>
    </item>
  </channel>
</rss>