-Menü

Beiträge anzeigen

Dieser Abschnitt erlaubt es Ihnen, alle Beiträge anzusehen, die von diesem Mitglied geschrieben wurden. Beachten Sie, dass Sie nur Beiträge sehen können, die in Teilen des Forums geschrieben wurden, auf die Sie aktuell Zugriff haben.

Beiträge anzeigen-Menü

Beiträge - Mox

#1
I moved the declaration of all the variables for the methods, inside the main FB, and it works !
Thanks a lot mattsches, I can continue the project without using GVL.
I didn't realise that the location of variable declaration could have this importance

Regards,
Mox.
#2
Hello and  thanks for your quick replies.

   annD, I wasn't clear enough, but I already tried to model Moxa and Wago with the RTU/TCP integrated in Codesys.
I need to make a project in which the user doesn't have to manage the Modbus slaves.
Like that he doesn't have to build a Master/Slave tree, an add Channels corresponding to data registers.
For instance, he gives an array of the equipments' IP present on the network to Codesys, and gets an access of each equipments data.
Thus the access of data is made automatically. And the user can handle data without knowing for example, the Modbus register corresponding to the Power Status of a Wago.

   mattsches, I understand now why I can't monitor a sub FB instance, in a main FB method. That also explains the interrogation points instead of data when I login to the PLC.
I will apply your advice for the project, and move the declaration of variable for sub FB instance to the main FB.

Regards,
Mox.
#3
Hello,

I am trying to model Ethernet switches (Moxa EDS-508), and remote I/O (Wago Coupler 750-352) with an OOP approach thanks to Codesys. I am a beginner in Automation in general. Firstly, I succeed to fill these objects with different information through Modbus/TCP Slaves. Which are present in the Codesys Device Tree.

But I wanted to have more flexibility with the modeling. So I imported both libraries OSCAT BASIC v3.3.3 and OSCAT NETWORK v1.2 in Codesys v3.5 SP9. By the way thanks for these great tools.

http://store.codesys.com/oscat-basic.html

http://store.codesys.com/oscat-network.html

My client is the target PLC a Raspberry-Pi, and it sends a Modbus TCP/IP request to the server, a Moxa switch. The switch only works with FC4 and UDP doesn't seem to work. (Error of timeout,16#FF00, is returned).
I choose to make an ST FB based on MB_CLIENT, from Oscat Network. I will use it to read registers and fill the objects. Moreover, I decided to make different FB with different size of data output.

Read_Channel_FB_0 reads a unique Modbus TCP/IP register and release a word output (data_out). It possesses two methods: Read_Parameters_Affec() and Data_Builder().



Read_Channel_FB_1 reads a Modbus TCP/IP register and release an array of two words output (data_out). It possesses two methods: Data_Builder() and Read_Parameters_Affec() (Same method as Read_Channel_FB_0).



A Moxa is modelled by a FB, and composed with two structures: REFERENCE TO Minor_Information, REFERENCE TO Primary_Information. The information represent data more or less important from the Moxa, so the request Modbus TCP/IP are not at the same speed rate between information. Plus Moxa_FB gets a FB_Init to initialize its parameters from a GVL.



Now we build the object Moxa in a program thanks to IP_CONTROL2, from Oscat Network:



When I call the different Read_Channel_FB in a program, there is no error code. And the Moxa_FB is filled correctly.



I wanted to add the Read_Channel_FB inside a new FB: Moxa_new_FB. There are two methods Primary_meth() and Minor_meth().
Plus I removed the use of a GVL for a FB_Init in this FB.



Here is the call in a program:



But the affection didn’t occur. And I don’t have any errors.

I need help, can someone explain me why the object doesn't fill correctly??

Mox.