Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Writing the value to the device

Writing the value to the device 1 year 5 months ago #11763

  • Allan
  • Allan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 12
  • Karma: 0
Thank you Claes, much appreciated.

I managed to get continuous read and write on demand working for Dig, Int16s, Int32s and Reals with a sample project and an Automation Direct Click PLC. Using a couple of different methods.

Somethings I noticed that may help others:

- 'Identity' in the Proview IO channels refers to the relative byte in the Proview IO map - before understanding this I had trouble mapping the IO. You can also see what is going on when you look at the MB TCP Slave Input and Output map in the runtime Navigator (Nodes-Getingstarted-IO-ModbusMaster-IOInterface) in my project.

- I think for most modbus tcp devices the Modbus Slave setting 'SingleOp' needs to be 'Yes' otherwise the Proview protocol implementation sends multiple modbus transactions in ethernet packets (and the PLC wont respond to all of them)

- The PLC thread looking after the comms should have the Halt-Delay Action set to 'No' or 'Message' and not 'Emergency Break' or when comms are interrupted they will not restart.

- Byte order for Int32 and Float32s in the PLC is different to Proview and needs to be manipulated. I used this as a guide. www.proview.se/v3/index.php/forum/3-help...ian-conversion#11502 Thank you @Brunad. Note that I could Brunad’s referenced method to get values into Proview but not to write them back to the slave PLC. To write back successfully I needed to use 32bit Ii and Io interfaced with float32 signals.

- To set, reset and toggle digitals I created three scripts – these also allowed me to interact with buttons, checkboxes and radio buttons. They also ‘lookup’ the associated SendOp variable.

- I managed to get an indicator working that shows the communications link status although I think it was lucky. I
associated a value with an indicator Nodes-Gettingstarted-IO-ModbusMaster-IOInterface.Status##Bit[0]

- Similarly I managed to get a status on the group read commands by placing some logic in the Proview PLC and comparing the status Enum variable.

A couple of questions that I am seeking some input on that I have not been able to work through:

1. How can I monitor the Modbus TCP Slave module Status attribute? Eg to implement data validity and communications loss alarms? I am not even able to determine the datatype although when I use GetAttribute and printf it is a long number.

2. Are there any functional limitations (such as access/security, web use) of setting variables and SendOP the way that I have in the scripts? i.e. Using GetAttribute(), GetParent and SetAttribute() in xtt script.

3. Is there a simple way to evaluate expressions (Eg to operate indicators) rather than adding additional variables and proview plc code. For example to operate the indicator when the command module status is equal to 0 (status OK). Example signal is: Nodes-Gettingstarted-IO-ModbusMaster-IOInterface-modRdReals.Status

Images below for reference. I have also attached the PLC file (free programming software available from automation direct) and a project back-up as it may be of use. Script files are in /usr/local/pwrp/gettingstarted.

Set the SendOp variable with button:

Proview22102501SendOpSettingExample.jpg


Comms Arrangement:

Proview22102502CommsSettings.jpg


Variables:

Proview22102503Variables.jpg


Type Conversion:



Check Box:

Proview22102505CheckBoxandScript.jpg


Graphics:

Proview22102506Graphics.jpg


Script Example:

Proview22102508Script.jpg


Slave PLC Code:

File Attachment:

File Name: Proview22102507ClickPLCLadderLogic.pdf
File Size: 478 KB
The administrator has disabled public write access.

Writing the value to the device 1 year 5 months ago #11765

  • Allan
  • Allan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 12
  • Karma: 0
I cannot upload the proview project archive or PLC program. If interested contact me.
Last Edit: 1 year 5 months ago by Allan. Reason: Cannot upload zip or plc prog attachments
The administrator has disabled public write access.

Writing the value to the device 1 year 5 months ago #11767

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi Allan,

1. Modbus_Module.Status is an enumeration type (see Object Reference Manual) where 0 is OK and positive values are some error. The text of an enumeration can be displayed in a text field with suffix ##Enum and format %s. It can be fetched in the plc with a GetIp.

Modbus_TCP_Slave.Status is of type Status. This is an integer value that can be translated to a text, and also has one of four severity levels, fatal, error, warning or success. The text can be displayed in a text field with suffix ##Status and format %m. The severity can be displayed in an indicator with dynamic StatusColor where fatal will be flashing red, error red, warning yellow and success green. The value can be fetched in the plc code with a GetIp. Odd values are ok and even bad.

2. SetAtribute() requires normally write privileges that be set as default in the Security object or can be obtained by logging in as a user with write privileges.

3. No.

In you SendOp example you should reverse the order of SetDig and SetDig2 as SetDig2 is executed before SetDig. Now you set SendOp first and then set the value. The IO process might come in between and send the old value.

/Claes
The administrator has disabled public write access.

Writing the value to the device 1 year 5 months ago #11769

  • Allan
  • Allan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 12
  • Karma: 0
Thankyou Claes that is very helpful.

I need to do a bit more work reading up on and testing with severity, however I got the connection and command status's into the proview PLC, processed and output them to status bits in Dvs - Good outcome/basis for establishing data point validity and comms loss alarms etc.

Re your last comment on SetDig, SetDig2 and order (perhaps I am reading into this too much but I am interested as it was not something I could readily work out when I started working with these buttons):
- Does the order in the window (eg top to bottom) indicate the order of operations?
- Can you manipulate this order (I tried but couldn't) or is your statement just telling me to swap the variables in the operations?

Sorry for more questions. I realise that this is getting towards a seperate topic on GE in the forum.


ProviewCommsConnStat.jpg
The administrator has disabled public write access.

Writing the value to the device 1 year 5 months ago #11771

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Execution order is top to bottom. Top first and bottom last.
Can't be configured, you have to swap the variables.

/Claes
The administrator has disabled public write access.
The following user(s) said Thank You: Allan
  • Page:
  • 1
  • 2
Time to create page: 8.116 seconds