cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Write tag Value from CSV

Tomaz_O
3-Newcomer

Write tag Value from CSV

Hello,

 

I'm trying to read the tag values from CSV file to KEPServerEX Channel/Device.

 

The reading is basically working and I can see the tag values which are written in CSV.

But here comes a problem: When I want to update values in CSV I get an error that the CSV file is locked.

 

How can I change the tags valeus in CSV to get new values in the KEPServer EX?

 

BR

Tomaz

 

 

5 REPLIES 5
KCorrigan
14-Alexandrite
(To:Tomaz_O)

Hi Tomaz,

 

The KEPServerEX DDE Client driver keeps the .csv file connection open -which means no other applications can edit the file.

 

For customer use cases where KEPServerEX is logging data, and client application(s) will need to write to the same dataset, the DataLogger Plugin or the ODBC Client driver can be used to log to an ODBC compliant db. DataLogger logs new rows of data to table(s) and cannot read the data back while the ODBC Client driver does not add new rows - it allows for reading/writing of values in existing rows. Both of these options require a license. (The ODBC Client driver is sold individually but is also included in the Manufacturing Suite.)

 

Please let me know if you have additional questions-

 

BRgds,

KC

 

Tomaz_O
3-Newcomer
(To:KCorrigan)

Hello,

 

Thank you for the answer!

 

There is maybe some misunderstanding because we don’t need to write anything to the CSV.

We would like to read the value from the CSV and then read it as a KepWareEX tag in some OPC client.

And we would like to update CSV once per hour and see thes new values in the tag value in OPC Client which is connected to KepServerEX.

 

I hope it is more clear now.

 

BR

 

Tomaž Orehek

Tomaz_O
3-Newcomer
(To:Tomaz_O)

Hi,

 

does anyone else have some idea how to solve my task?

 

BR

Tomaz

KCorrigan
14-Alexandrite
(To:Tomaz_O)

Hi Tomaz,

 

We are happy to help you evaluate the dataflow you are suggesting, we just have clarifying setup questions to ask. 

For this reason, we would ask that you copy and paste your initial community post above, as well as the image, into a Kepware Case here:

 

https://www.ptc.com/en/support

 

Thank you, 

KC

aservetas
15-Moonstone
(To:KCorrigan)

Greetings Tomaz,

 

As long as Kepware is reading from the CSV file, then the OS will hold that file in a 'locked' state preventing any other application from opening or editing it.  This is a limitation of the OS file sharing, not a limitation of Kepware.

 

The only way to make the CSV file available for edit by another application is to force the Kepware runtime to release it's ownership of the CSV from the OS. Without restarting the runtime, this would have to be done by the OPC client you are using to read those values as tags releasing all active item references from that specific channel and device.  In short, the client has to stop asking Kepware to go read those tags.

 

Once those active item references are removed, then the CSV file access will no longer be required by the Kepware runtime and we will release the file allocation request to the OS.  Windows will then 'free up' the file for another application to gain access and make the edit.

 

When the OPC client needs to read those tags again, it will have to re-add the items to the Kepware interface and then our runtime will ask the OS to access the file again.  As long as the other application that is making the edits has released it's allocation, then Windows will let Kepware access the file to then perform the read of the updated CSV content.

 

Example:

 

Client connects to Kepware, does not subscribe to the tag items in the channel/device pointing to the CSV, but instead does an OPC Async Read Request, then disconnects from the runtime . Kepware will then request access to the CSV from the OS, read the contents and then relinquish the file access request after the client disconnects.

 

The next time the client needs to read updated content from the CSV, the cycle repeats.

 

While is is ineffective client design, it can be used in this scenario for only the tag items required from the CSV data source.

 

Best regards,

Andy Servetas
Principal Technical Support Engineer | Kepware Technologies

 

Announcements


Top Tags