Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. shkhmaaz
  2. PLCnext Technology & PLCnext Controls
  3. Thursday, 08 July 2021
Hi,

I was wondering if it is possible to program the plc in such a way that every time it receives an input or gives an output it stores that data in the form of a .json file?
Oliver PLCnext Team Accepted Answer Pending Moderation
1
Votes
Undo
Hello,
yes you can do that using some self programming and the iiot or Json Library to generate Jason strings.
With some File Acces FBs you are then able to store the Text to the SD.
https://www.plcnextstore.com/1134
https://www.plcnextstore.com/812
This approach is however limited as the SD is not indefinitly fast or has indefinit write cycles.
It will brake some day if written to very very frequently.

If you realy want to log every change you might want to have a look at the integrated Datalogger you are able to store data in a sqlite DB or TSDB on change quite efficiently.
You could later download that DB and convert it however you like.
kind regards,
Oliver
Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
Eduard PLCnext Team Accepted Answer Pending Moderation
1
Votes
Undo
Hello shkhmaaz,

yes it is possible, you can use the "IIoT_Library" to program the needed application. Please find the Library in PLCnext Store: https://www.plcnextstore.com/1134

Best Regards
Eduard
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
shkhmaaz Accepted Answer Pending Moderation
0
Votes
Undo
Hello Oliver and Eduard,

Thank you for your quick responses. Just wanted to know, does the .json file get saved on the PLC? or does it get saved on the device running the PLC next engineer software?
shkhmaaz Accepted Answer Pending Moderation
0
Votes
Undo
Hello,

I figured it out that the file will be stored on the plc. However, i havent figured out how to use the library yet. The documentation for both libraries are either outdated or the examples dont explain how to use it that much. Is there any other source material that would help me to learn to use these libraries?
Eduard PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hello shkhmaaz,

we have provided the examples project to the GitHub Repository.
I think the following example project, based on the JSON_utility and MQTT_Client librarys will help you:
https://github.com/PLCnext/IIOT_Library

If you have additionally questions, please don't hesitate to ask!
If you have any suggestions, please send us your feedback via Issues: https://github.com/PLCnext/IIOT_Library/issues

Thanks & Best Regards
Eduard
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
shkhmaaz Accepted Answer Pending Moderation
0
Votes
Undo
Hi Eduard,

Thank you for the github link. It is easier to understand and learn what is happening in the example code. However, when i tried to start and write this example into the PLC, i got this error.
Attachments (1)
Eduard PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hello shkhmaaz,

I opened the example in PLCnEng 2021.0 and 2021.3 and downloaded it to the PLC without errors.
Please give me information about the used PLCnEng version and PLC FW Version.

Thanks & Best Regards
Eduard
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
shkhmaaz Accepted Answer Pending Moderation
0
Votes
Undo
Hi Eduard,

My PLCNext Engineer version is 2021.3.1 and the PLC FW version (on the software) is 2020.6.0. Can that be an issue?

Edit : I deleted the old FW version and updated it in the Software. Now it is giving me another error.

Edit 2 : I fixed the error and tried the example one time. It worked perfectly fine. Next, i wanted to replace the print to buf function block with print to file function block. After that, it gave me an internal error and said "Online mode is not possible" and gave error CILG0001. Even after undoing everything im getting the same error
Edit 3 : Fixed it again :p Now, can i export this JSON data to a JSON file on the plc?
Attachments (1)
Eduard PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hello shkhmaaz,

yes it is possible to export the JSON data to a JSON file on the plc. I think it is a application issue.
Could you provide me your project via following, not secured link (I will check the application):
https://phoenixcontact-my.sharepoint.com/:f:/p/pyme04_europe/EhNHi-qzVflNtcowLOKqgVcBvajBDKPNXvsP0bRJ-g3FGg?e=O2wlIV

If it's not possible, can I contact you via E-Mail ?

Best Regards
Eduard
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
shkhmaaz Accepted Answer Pending Moderation
0
Votes
Undo
Hi Eduard,

I tried accessing the link but it does not let me get in. My Email ID is shkhmaaz90@gmail.com. Thank you for your assistance! I have also encountered another issue. Whenever i try to connect to the MQTT Broker on my windows Laptop, the PLCnext software immediately disconnects from the PLC. i even tried with the mosquitto test broker but it resulted in the same.
Eduard PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Hello shkhmaaz,

as discussed via email in your project, the IIoT library (content JSON utility and MQTT client libraries) and the JSONutility library was added separately. In the furher we will remove the JSON utility and MQTT client libraries in PLCnext Store and the Librarys will be only part of IIoT Library.

Best Regards
Eduard
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.