Is there any way to use OPC or Modbus communication protocols from Activate?

Faisal Shaikh
Faisal Shaikh Altair Community Member
edited March 28 in Community Q&A

Hi,

I would like to connect a Twin Activate model I made to some industrial controllers and HMI in real time, preferably using the OPC communication protocol. Is there any implementation of this or another product or add-on that could be used to achieve this?

Modbus would also be an option is that is possible.

Answers

  • João Marabisa
    João Marabisa
    Altair Employee
    edited March 18

    Hi @Faisal Shaikh,

    It is possible to use OPC UA in Twin Activate.

    (1) For that you'll need to install Python package 'opcua'. You can find the documentation on installing a python library in TwinActivate as below:https://help.altair.com/twinactivate/help/en_us/topics/reference/oml_language/PythonBridgeOmlCommands/installpythonpackage.htm installpythonpackage('opcua') 

    (2) Then, you can use the model that I'm attaching that is able both to send and receive data to an OPC server. In that model please configure the tag name and the URL.

    In this case, they have been set up as double datatype so that in the server, one could add tags for reading and writing with the double datatype.

    image

    For your information: We are working to support it natively in Twin Activate. 

     

  • Faisal Shaikh
    Faisal Shaikh Altair Community Member
    edited March 18

    Hi @Faisal Shaikh,

    It is possible to use OPC UA in Twin Activate.

    (1) For that you'll need to install Python package 'opcua'. You can find the documentation on installing a python library in TwinActivate as below:https://help.altair.com/twinactivate/help/en_us/topics/reference/oml_language/PythonBridgeOmlCommands/installpythonpackage.htm installpythonpackage('opcua') 

    (2) Then, you can use the model that I'm attaching that is able both to send and receive data to an OPC server. In that model please configure the tag name and the URL.

    In this case, they have been set up as double datatype so that in the server, one could add tags for reading and writing with the double datatype.

    image

    For your information: We are working to support it natively in Twin Activate. 

     

    Thanks, that is very helpful. I will try using those blocks. Good to hear you are planning on supporting it natively as well.

  • Faisal Shaikh
    Faisal Shaikh Altair Community Member
    edited March 22

    Hi @Faisal Shaikh,

    It is possible to use OPC UA in Twin Activate.

    (1) For that you'll need to install Python package 'opcua'. You can find the documentation on installing a python library in TwinActivate as below:https://help.altair.com/twinactivate/help/en_us/topics/reference/oml_language/PythonBridgeOmlCommands/installpythonpackage.htm installpythonpackage('opcua') 

    (2) Then, you can use the model that I'm attaching that is able both to send and receive data to an OPC server. In that model please configure the tag name and the URL.

    In this case, they have been set up as double datatype so that in the server, one could add tags for reading and writing with the double datatype.

    image

    For your information: We are working to support it natively in Twin Activate. 

     

    Hi Joao, I have used the Read from PLC block, it works and I can observer live values on a scope in Activate.

    However I am having problems with the Write_From_PLC block. There is an error message:

    Error: "The value supplied for the attribute is not of the same type as the attribute"s value."(BadTypeMismatch). Failed in updating the model at an event. ( -1 )
    Block(s): Write_To_PLC/PyCustomBlock_1

    Do you have any ideas what could be causing this error?

    I have some other OPC explorer software on my PC to check the connections, and I was able to write to the tag. 

    Thanks

     

  • João Marabisa
    João Marabisa
    Altair Employee
    edited March 28

    Hi Joao, I have used the Read from PLC block, it works and I can observer live values on a scope in Activate.

    However I am having problems with the Write_From_PLC block. There is an error message:

    Error: "The value supplied for the attribute is not of the same type as the attribute"s value."(BadTypeMismatch). Failed in updating the model at an event. ( -1 )
    Block(s): Write_To_PLC/PyCustomBlock_1

    Do you have any ideas what could be causing this error?

    I have some other OPC explorer software on my PC to check the connections, and I was able to write to the tag. 

    Thanks

     

    Hi @Faisal Shaikh ,

    This can be due to the data type. The model that I sent you uses 'double' by default:

    image

    Please double check the expected data type in your reader, then you can change it in Twin Activate.