Post by leafy on Use third party actuator with IO-Link Master (IFM)
CODESYS Forge
talk
(Post)
Hey there! I am currently doing a little automation project for uni. I am trying to integrate a control-valve-system (Buerkert AirLINE Field) in my IO-Link environment. With IFM sensors, I used their pre-built function blocks, but with this third-party device, i need to write my own function block. Thankfully, IFM provides a generic sensor-fb so I can write my own FB with "extends" and "super". So far, so good. I found the IODD and some other documentation and I thought I get how it works, but somehow can't really get it to work at all. From my understanding, i need to write data into the PDO-Array. But i get confused with the indices and subindices of IO-Link. I'll append the IODD and some screenshots of my project. There is an AOI for LogicXDesigner, but I can't use that in Codesys. I hope someone has integrated a IOL-device in Codesys before and can help me with this. Cheers leafy
Last updated: 2024-04-16
Post by kblundy on Change the Opening Position of the Dialog using VU.FbOpenDialog
CODESYS Forge
talk
(Post)
I hope the community can help me with this. I need to use the Visu Utils FbOpenDialog to control the opening and closing of a dialog. I have the Opening and Closing working, but I can’t get the dialogue's position to be controlled. The code looks like this: PROGRAM OPEN_DIALOG VAR xOpenLatchSettingDialog : BOOL; TopLeftDialog : VisuStructPoint ; fbOpenLatchSettingsDialog : VU.FbOpenDialog ; END_VAR IF xOpenLatchSettingDialog THEN xOpenLatchSettingDialog:= FALSE ; TopLeftDialog.iX := 100; TopLeftDialog.iY := 23; fbOpenLatchSettingsDialog(sDialogName := 'visu_AlarmLatchSettings', xExecute := xOpenLatchSettingDialog , xModal := TRUE, itfClientFilter := VU.Globals.OnlyTargetVisu, pTopLeftPosition := ADR(TopLeftDialog)); CloseVisuDialog(sDialogName:= 'visu_AlarmLatchSettings'); ELSE xOpenLatchSettingDialog:= TRUE ; IF fbOpenLatchSettingsDialog.xError THEN xOpenLatchSettingDialog := FALSE; END_IF END_IF I can't seem to work out a way to make the values in TopLeftDialog.iX and TopleftDialog.iY be passed correctly in the call and for it to change the position of the dialogue box. The code is compiled, but the position has not been changed. Any guidance or suggestions for revising this code would be incredibly valuable. Your insights could be the key to solving this issue.
Last updated: 2024-05-05
Post by paro on Modbus Client Request Not Processed
CODESYS Forge
talk
(Post)
Hi, Problem in your code is that you are not calling the ClientFb cyclic. Please look at the Example from CODESYS: https://forge.codesys.com/prj/codesys-example/modbus/home/Home/ Your code works if the client fb is called cyclic! IF NOT initDone THEN initDone := TRUE; // configure clientTcp clientTcp(aIPaddr:=Ethernet.IPAddress, uiPort:=502); // configure clientSerial clientSerial(iPort:=SysCom.SYS_COMPORT2, dwBaudRate:=SysCom.SYS_BR_115200, byDataBits:=8, eParity:=SysCom.SYS_EVENPARITY, eStopBits:=SysCom.SYS_ONESTOPBIT, eRtuAscii:=ModbusFB.RtuAscii.RTU); // configure clientRequestReadCoils_1 clientRequestReadCoils_1(rClient:=clientTcp, uiUnitId:=42, udiTimeout:=TO_UDINT(T#10MS)); // configure clientRequestWriteSingleRegister clientRequestWriteSingleRegister(rClient:=clientTcp, uiUnitId:=43, udiTimeout:=TO_UDINT(T#10MS)); // configure clientRequestReadCoils_2 clientRequestReadCoils_2(rClient:=clientTcp, uiUnitId:=44, udiTimeout:=TO_UDINT(T#10MS)); // configure clientRequestReadInputRegisters clientRequestReadInputRegisters(rClient:=clientTcp, uiUnitId:=44, udiTimeout:=TO_UDINT(T#10MS)); END_IF // call the client FB's clientTcp(); clientSerial(); // call client request FB's clientRequestReadCoils_1(rClient:=clientTcp, xExecute:=TRUE, uiStartItem:=2, uiQuantity:=3, pData:=ADR(aDataCoils_1[0])); // for more details see Example_TCP, especially ClientRequest control (xExecute, xDone, xError). IF clientRequestReadCoils_1.xDone THEN // get data from aDataCoils_1 ... END_IF clientRequestWriteSingleRegister(rClient:=clientTcp, xExecute:=TRUE, uiItem:=3, uiValue:=123); clientRequestReadCoils_2(rClient:=clientTcp, xExecute:=TRUE, uiStartItem:=2, uiQuantity:=3, pData:=ADR(aDataCoils_2[0])); clientRequestReadInputRegisters(rClient:=clientTcp, xExecute:=TRUE, uiStartItem:=16, uiQuantity:=3, pData:=ADR(aDataInputRegisters[0]));
Last updated: 2024-05-29
Post by greenwood on CODESYS Control Raspberry Pi mit Servotreiber T6 von StepperOnline
CODESYS Forge
talk
(Post)
Hallo, Ich scheine den Grund gefunden zu haben, das Kabel mit dem RJ45 Stecker ist für RS232 verdrahtet (am anderen Ende des Kabels ist ein 9-poliger SUB-D Stecker, nicht wie von mir im Eingangspost behauptet ein USB Stecker). In der Anleitung des Treibers ist immer nur von RS 485 die Rede. Alerdings habe ich es gestern abend noch geschafft eine funktionierende Version der setup-software herunterzuladen, und die verbindet sich offenbar über RS232. Daraufhin habe ich mir in der Anleitung des Treibers das Pinout der RJ45 Buchse nochmal angesehen, und die hat Kontakte für RS232 und für RS485. (Die liegen jeweils ganz am Rand, so ist mir das vorher nicht aufgefallen). Ich muss also als Nächstes ein richtig verdrahtetes Kabel auftreiben, und dann sehen ob das mit dem Adapter den ich habe funktioniert. An einen Abschlusswiderstand habe ich auch schon gedacht, nur weiss ich nicht wo ich den an einem RJ45 Stecker / Buchse - Paar anbringen soll... Ich bitte um Entschuldigung für die Verwirrung, ich mache das alles zum ersten Mal und es ist ganz schön viel auf einmal für mich. Nochmal vielen Dank für die Unterstützung!
Last updated: 2024-06-01
Post by caprez95 on Trace Restart Visuelement
CODESYS Forge
talk
(Post)
Hello everyone. I've been struggling with the problem for a long time that I can't reset (restart) a trend (visual element). With the example I have now managed to control the trace recording via the CmpTraceMgr library. But how do I get this trace recording into a visual element? The code looks like this: // Configure trace IF xInit THEN // Create a trace packet PacketConfig.pszName := ADR('IECTraceConfiguration.Trace1'); // Name of trace PacketConfig.pszApplicationName := ADR('IECTraceConfiguration'); // Name of the application PacketConfig.pszIecTaskName := ADR('Task'); // Name of the task PacketConfig.pszComment := ADR('Demo packet'); PacketConfig.ulEveryNCycles := 1; PacketConfig.ulBufferEntries := 1000; PacketConfig.ulFlags := TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_TIMESTAMP_MS AND TRACE_PACKET_FLAGS.TRACE_PACKET_FLAGS_AUTOSTART; IF (NOT fbTraceManager.CreatePacket(PacketConfig := PacketConfig, hPacket=>hPacket1)) THEN xError := TRUE; END_IF // Create a trace record RecordConfig.pszVariable := ADR('iSignal'); // This is the name of variable to record RecordConfig.tcClass := INT_TO_UDINT(TypeClass.TYPE_INT); // Type of the recording variable RecordConfig.ulSize := SIZEOF(iSignal); // Size of the recording variable pApp := AppFindApplicationByName('IECTraceConfiguration', 0); AppGetAreaOffsetByAddress(pApp, ADR(iSignal), ADR(RecordConfig.tvaAddress.taAddress.Area.usArea), ADR(RecordConfig.tvaAddress.taAddress.Area.ulOffset)); // Get and set area offsets RecordConfig.tvaAddress.ulAddressFlags := TRACE_VAR_ADDRESS_FLAGS_IEC OR TRACE_VAR_ADDRESS_FLAGS_AREA_OFFSET; RecordConfig.ulGraphColor := 16#FF00FF00; // green RecordConfig.ulGraphType := 1; // Line with points IF (NOT fbTraceManager.AddRecord(RecordConfig := RecordConfig, hPacket := hPacket1, hRecord => hRecord1)) THEN xError := TRUE; END_IF xInit := FALSE; END_IF // Starts the recording IF xStart THEN IF (NOT fbTraceManager.StartPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStart := FALSE; END_IF // Stop the recording IF xStop THEN IF (NOT fbTraceManager.StopPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xStop := FALSE; END_IF // Reset the recording IF xReset THEN IF (NOT fbTraceManager.ResetPacket(hPacket := hPacket1)) THEN xError := TRUE; END_IF xReset := FALSE; END_IF
Last updated: 2024-06-04
Post by abinvest579 on TCP Client
CODESYS Forge
talk
(Post)
Hi All, I am using codesys based plc to read and control magna power DC supply over LXI protocol using SCPI command. To connect device required socket programming for that i am using Net base service library function block TCP_Client to establish connection over TCP/IP , TCP_Write to write SCPI commands and TCP_Read to read data from Magna power DC supply. I have attached screenshot for logic developed. I am able to connect and write commands to device but i not receiving any information from device. For writing Commands i also tried various end of line character like \n,<nl>, A, D, 10, 13, 0x0A, 0x0D but not received any status from device. For testing purpose i am using simple command '*IDN?' to read data. Also if tried to check on hercules software what data actually plc read, first it read correct data after that is read wrong data as see in screen shot. 'Hello World' was correct read and after that Codesys in replaced with 'Codesysorld' that is not correct way. Same issue also appeared for send data. Any one have face same issue how i can read data directly from device correctly and send data please suggest solution on this.</nl>
Last updated: 2024-07-01
Post by xgongx on What is the insights of IoDrvEtherCAT.DCInSyncWindow?
CODESYS Forge
talk
(Post)
It is well known that you need to increase the value of IoDrvEtherCAT.DCInSyncWindow to solve the "Fieldbus lost synchronicity" issue. In the official document, IoDrvEtherCAT.DCInSyncWindow is explained as the toleration of a certain jitter. But the official document doesn't explain what kind of the jitter is. Is it the jitter of DC sync deviation, master timer or something else? It is very important to know the insights of IoDrvEtherCAT.DCInSyncWindow. For example, if it is the toleration of DC sync deviation, and the official recommending value is 200us for CODESYS SoftMotion. It means maximum of DC sync deviation is 200us. It is unacceptable for some high precision motion control tasks, for example high speed gear task, etc. Increasing the value of IoDrvEtherCAT.DCInSyncWindow will increase the deviation of motor rotation sync if it is the toleration of DC sync deviation. So, would anyone tell me what the insights of IoDrvEtherCAT.DCInSyncWindow is? Thanks.
Last updated: 2024-07-09
Post by simone on Cannot connect to webvisu on localhost
CODESYS Forge
talk
(Post)
As I wrote before on the title, I have difficulties to connect to see webvisu from localhost. The story: while waiting for the plc+hmi to arrive, I'm preparing the software, mainly the visual parts trough the control Win3 x64 (same version as the ide 3.5.20.10). The problem is that I can't see the webvisu with the installed webbrowser. I don't know if this is a problem, but I changed the port to 9001 (randomly "free") because 80, 8000, 8080, 8088, 3000 are all occupied by other projects (all on the Apache server). Is there something wrong with the config file? This is the url: localhost:9001/webvisu_app.htm and here the config file part "CmpWebServer". [CmpWebServer] ;The handling of startup/shutdown of the webserver: ;0->automatically start, shutdown only on shutdown of the runtime;1->automatically start, could be shutdown on demand ;2(default)->start/shutdown on demand;3->start on demand, shutdown only on shutdown of the runtime StartupType=0 ;The TCP port the webserver listens on WebServerPortNr=9001 LocalAddress=localhost ;LocalAdapterName=LAN-Connection LocalAdapterName=EthernetPCPLC ;LocalAdapterNameUnicode=L\00A\00N\00-\00C\00o\00n\00n\00e\00c\00t\00i\00o\00n\00 LocalAdapterNameUnicode=E\00t\00h\00e\00r\00n\00e\00t\00P\00C\00P\00L\00C\00 Thanks for all the help!
Last updated: 2024-07-11
Post by paulorb on STRUCT AT %MW1000
CODESYS Forge
talk
(Post)
Hi I am trying to use STRUCT to parse commands from Modbus/TCP, Modbus client will fill the bytes related to a specific command (type, parameters), then PLC (Codesys) will access the command parameters. A STRUCT will simplify a lot the process of parsing the data, so I don't need to parse byte per byte, address will be mapped to a struct and I can use it for parsing the data. From what I understood, the compiler does not allow me to specify the location of the struct for a %MW register. VAR_COMMAND AT %MW1002: structGenericModbusCommand; This will throw: Bad declaration, use '%ML' for 'structGenericModbusCommand' variable But If I change it to %ML, when you go online you see that it is actually allocating the struct in another memory address. When we go online, on GVL we can see: VAR_COMMAND. structGenericModbusCommand %ML1002 commandType COMMANDTYPE %MB8016 ... %MB8020 I am not specifying a pointer or a reference it is a struct type, why is it mapping to a %MW location (random one). How can I control where it is mapping to? I need a consistent way to map STRUCT to specific modbus address. Is it possible? Thanks, Paulo Note I am using a Codesys OEM: Schneider Machine Expert Logic Builder (M241)
Last updated: 2024-08-13
Post by bjarne-pagaard on Communication between applications on same device/controller/runtime (Win RTE 3.5.20.20)
CODESYS Forge
talk
(Post)
Hi, I would like to divide a project into multiple applications - as a minimum: one handling visualization and Alarm Manager, one handling I/O and plant control logic. But how to exchange variables between the applications? What have you done to get such a solution? In versions 3.5.19 and earlier, you can have Child applications, where the children can access a GVL in the Parent application. Children apps is no longer possible in 3.5.20 - but you can have 'sibling' apps - Several apps directly under PLC Logic, that is. But how do they best communicate? The Communication Manager / Data Sources Manager is sort of possible via OPC UA, but it seems like overkill and with some limitations - for example no ARRAY OF STRUCT possible this way. If you have separate devices in your project, you can exchange data via 'CODESYS ApplicationV3', but not other applications in the same device (see attachment Datasources.png). You can do it via 'Select the project type'->'Other Project' and select the same project file, but this leads to crashing the Development system when working with the variables afterwards. It would be great to hear your thoughts / experiences on this topic - Bjarne
Last updated: 2024-09-27
Post by egau on Hard shutdown: no code on device after power on
CODESYS Forge
talk
(Post)
Hi, We have a machine running Codesys on a Windows IPC (CODESYS Control Win v3 - x64). When we hard shutdown the machine, the code on the PLC sometimes becomes "corrupted" after a power on (When trying to login to the PLC, we get the message "The application 'Application' does not exist on device."). I've noticed these errors in the logs, but I'm not sure what to make of them. We are not using any RETAIN variables in our code, although I'm not sure about referenced librairies. (we are using the persistence manager). I'm pretty sure that not doing a graceful shutdown is the root cause of this. This being said, what is the proper way of doing a graceful shutdown? Is putting the Codesys application in "stop" sufficient? I know how to implement this, so if it works then it would be a quick fix. However, I think we need to add a UPS, which would detect power loss and inform the PLC that it needs to initiate its shutdown, and then the PLC would shutdown gracefully. Any help with this will be greatly appreciated :)
Last updated: 2024-10-03
Post by koerbejm on Probleme beim aktivieren von Lizenzen
CODESYS Forge
talk
(Post)
Liebe Codesys-Gemeinde, ich habe folgendes Problem und bitte um Hilfe: Um eine auf meinem dem Raspberry Pi laufende Steuerung ohne große Mühe duplizieren zu können, habe ich mir ein Image der SD Karte mit Win32 Diskimager erstellt. Dieses konnte ich bisher ohne weitere Probleme auf eine weitere Micro-SD karte ausrollen. Anschließend habe ich mich via Putty auf den PI geschaltet, die vorherige Lizenz (die ja für den vorheringen PI zulässig war) gelöscht über - sudo su - rm -r /var/opt/codesys/cmact_licenses/ - reboot Um dann via Codesys 3.5 SP16 Patch 4 eine neue Lizenznummer ">>Tools>Lizenzmanager>Lizenz aktivieren" zu aktivieren und das wars. Durch die Umstellung des Lizensierungsverfahrens klappt diese Variante nun nicht mehr. Ich habe mir neue Lizenzen von Codesys gekauf, doch sobald ich diese in die Ticket-ID eintrage und aktivieren möchte bekomme ich folgende Fehlermeldung: ReturnCode: 403046401, An internal error has occured. Please try it again later. (siehe Bild im Anhang "Fehler_Codesys3.5V16.png") Ich habe dann meine Codesys-Version auf Version 3.5 SP20 geupdated und das selbe versucht mit dem Resultat, dass ich nun folgende Fehlermeldung erhalte: "Der ausgewählte Container "...." paßt nicht zu Ihrem Ticket. Bitte wählen Sie einen passenden aus." --> Siehe Bild im Anhang "Fehler_Codesys3.5V120.png" Was genau kann/muss ich tun, damit ich einfach wie bisher meine Steuerungen duplizieren kann? Verwendete Hardware: Raspberry Pi 3 Model B+ Verwendete Lizenz: Codesys Control Basic L Viele Grüße und Danke, Jan
Last updated: 2024-10-23
Post by leandroct on Error reading files after runtime update from 4.0.0.0 to 4.8.0.0
CODESYS Forge
talk
(Post)
Since version 19 they changed how file access is handle. There are two solutions: 1. You change where the file is stored (need to go to: /PlcLogic/) 2. You can, if you don´t want to store at PlcLogic, add the following line in the CODESYSControl.cfg under [SysFile]: ForceIecFilePath=0 The CodesysControl.cfg is at C:\ProgramData\CODESYS\CODESYSControlWinV3x64\xxPROJECT_NUMBERxx\ Here the email they sent me: "with the 3.5.19 Version we changed how files are handled. See following issue: CDS-81506 - CODESYS Control SysFile system file access vulnerability. There are two solutions: 1. You change where the file is stored (need to go to: /PlcLogic/) 2. You can, if you don´t want to store at PlcLogic, add the following line in the CODESYSControl.cfg under [SysFile]: ForceIecFilePath=0 Here is the official release-note: [[COMPATIBILITY_INFORMATION]] With the activation of ForceIecFilePath the file access from IEC is now restricted to the configured paths only (file sandbox)! [SysFile] ForceIecFilePath=1 (new default) The standard path is the current directory, the PlcLogic subfolder or a configured path. Every file access outside of this path is configured via PlaceholderFilePath, for example access to temporary files or removable media: [SysFile] PlaceholderFilePath.1=/tmp, $TMP$ PlaceholderFilePath.2=/media/usb, $USB$ PlaceholderFilePath.2.Volatile=1 For more information see our tutorial FilePath & Placeholders. To restore the old behavior ForceIecFilePath may be configured as follows: [SysFile] ForceIecFilePath=0 BUT WE HIGHLY RECOMMEND TO LEAVE THIS SETTING AT ITS NEW DEFAULT VALUE! "
Last updated: 2024-05-07
Post by bbm1995 on Camera RTSP Feed
CODESYS Forge
talk
(Post)
Hi dgrard, I had the same issue for a long time, but on a WAGO webvisu. Now I'm glad that I can share my solution. I don't know if you are trying to use the webvisu or the target visu, but this works on webvisu: Get "go2rtc" and set it up according to the documentation. I'm running the Windows binary. Here's my example of the go2rtc.yaml config file (contains working example streams): api: listen: ":1984" # default ":1984", HTTP API port ("" - disabled) origin: "*" # default "", allow CORS requests (only * supported) static_dir: "www" # default "", folder for static files (custom web interface) tls_listen: ":443" # default "", enable HTTPS server tls_cert: "./SSL/fullchain.pem" tls_key: "./SSL/privatekey.pem" streams: # Streams with multiple links will fall back on the next link. ABUS TVIP48511: - rtsp://<username>:<password>@<hostname>:<port>/ch1/main - rtsp://<username>:<password>@<hostname>:<port>/ch1/sub # Diagnostic connections Kirchhoff Institute for Physics - Germany: http://pendelcam.kip.uni-heidelberg.de/mjpg/video.mjpg Blanton Bottling, Kentucky - USA: http://camera.buffalotrace.com/mjpg/video.mjpg Tokyo - Japan: http://61.211.241.239/nphMotionJpeg?Resolution=320x240&Quality=Standard Tampere Hacklab - Finland: http://tamperehacklab.tunk.org:38001/nphMotionJpeg?Resolution=640x480&Quality=Clarity Soltorget Pajala - Sweden: http://195.196.36.242/mjpg/video.mjpg Kaiskuru Skistadion - Norway: http://77.222.181.11:8080/mjpg/video.mjpg webrtc: listen: ":8555" #ice_servers: # - urls: [ "stun:localhost:3478" ] # username: "" # credential: "" Access the webinterface of go2rtc and get the link of your stream. Use the link as for your browser frame in the visualization. Depending on your device, you need to be able to access the file /etc/lighttpd/lighttpd.conf or /etc/lighttpd/webvisu.conf and change the contents similar to this one, otherwise you'll get CORS and CSP errors in the browser and you won't be able to view the stream on the webvisu: # Webvisu specific settings $SERVER["socket"] =~ port_webvisu_used_any { url.redirect += ( "^/webvisu/?$" => "/webvisu/webvisu.htm" ) $HTTP["url"] =~ "^/webvisu/?" { var.response_header_policy_webvisu = ( # CSP for WebVisu, allowing inline sources. "Content-Security-Policy" => "default-src 'self' 'unsafe-inline'; media-src *; frame-src *", # CORS for WebVisu, allowing any origin to access. "Access-Control-Allow-Origin" => "*", # Tell older browsers that this page can only be displayed if all ancestor # frames are same origin to the page itself. "X-Frame-Options" => "SAMEORIGIN" ) # Response header policy for WebVisu setenv.set-response-header = var.response_header_policy_webvisu setenv.set-response-header += var.response_header_policy_common }
Last updated: 2023-11-14
Post by rkohser on Scripted Git clone / checkout being blocked by "Project Environment" popup
CODESYS Forge
talk
(Post)
Hi, I am trying to build a CI/CD pipeline around our codesys projects. The only entry point if the git url and branch, as we do not put our project file under source control, so we needed to find a way to git clone from the python scripting engine. This is currently how we do this : system.commands["Git", "Clone"].execute( "ProjectLocation=" + project_dir, "ProjectName=" + project_file_name, "RemoteUrl=" + project_git_remote_url, "GitProjectStoragePath=" + project_git_local_dir, ) system.commands["Git", "Checkout", "Branch"].execute( "PrimaryProjectHandle=0", "BranchName=origin/" + project_git_branch ) This works fine, except that, depending on the environment and the project, the "Project Environment" popup gets displayed to suggest for some updates, and waits for a user interaction, even with the "--noUI" flag injected as parameter. I investigated the VersionUpdateFlags, but the problem is that the git clone is an atomic operation that clones and directly opens the generated project without the possibility to inject any updateFlags argument (only used in the ScripProjects.open() function. I also tried to simulate some keyboard events acknowledge the window from script but I did not find the right location for the SendKeys statement, I think before the git clone call is too early and after is too late. So I am wondering if there would be some other way to do that. Is there some more proper scripting api for the git add on ? Is there a global configuration of the VersionUpdateFlags that would allow the popup to be disabled outside from any project context ? Is there some way to automatically acknowledge this kind of messages in a "--noUI" mode ? What do you suggest ? Thanks for your help, Roland Edit : I managed to solve my problem by following these steps in my pipeline : - create a template of a project and opt file preconfigured not to open the popup - open this project - initialize an empty git repo - add the remote, fetch and checkout the needed branch -> no popup is displayed, hourra Edit2 : The initial question was raised on a CODESYS V3.5 SP18 Patch 2 profile. Since CODESYS 3.5.19.30 a scripting API is available for Codesys Git that allows cloning a project with the support of VersionUpdateFlags https://content.helpme-codesys.com/en/CODESYS%20Git/_git_using_scripting.html
Last updated: 2024-01-19
Post by gustavocsw on MQTT memory leak problem
CODESYS Forge
talk
(Post)
Hello everyone, I'm using the IoT Library to implement the MQTT communication with my local broker server in order to publish and subscribe at specifics topics to share and consume information about my application. But, it seems that are occurring some memory leak problem in a "high" frequency (more than 10 Hz) subscribe process. I follow the same method as in IoT Lib exemples, and at first looks perfect but my PLC was rebooting frequently and when I check its memory usage that was increasing as fast as the subscribe massage was sent. I'm using a WEG PLC410 and a WEG PLC500, and this error occurred in both of them (including in CODESYS Control Win x64). The application sends to the system a message JSON with the float payload Ex. {"data" : 0.8500}, but this happens with a INT, or BOL as well. I use the follow code in my application to find the value: //FindFirstValueByKey VARs PROGRAM JSON_VELO VAR //------Setting the JSON Subscriber to Set the Relay Value jsonDataVelo : JSON.JSONData; jsonByteArrayReaderVelo : JSON.JSONByteArrayReader; xST1okVelo : BOOL; FindFirstValueByKeyVelo : JSON.FindFirstValueByKey; jsonElementVelo : JSON.JSONElement; xDoneReaderVelo : BOOL; xDoneFindVelo : BOOL; //STRING and WSTRING for Subscribe the massage sPayloadJsonVelo : STRING := 'opa'; psPayloadJsonVelo : POINTER TO BYTE := ADR(sPayloadJsonVelo); //wsPayloadJsonRelaySet : WSTRING := "opa"; wsPayloadJsonVelo : WSTRING := STRING_TO_WSTRING('opa'); pwsPayloadJsonVelo : POINTER TO WORD := ADR(wsPayloadJsonVelo); lrVelo : LREAL; xKeepAliveVelo : BOOL; xSetVelo : BOOL; RSSet : RS; LIMPAR : STRING; //Find the msg end sFindVelo : STRING := '}'; psFindVelo : POINTER TO STRING := ADR(sFindVelo); iLenVelo : INT; iSizeVelo : INT := 12; udiContMsg : UDINT; END_VAR // FindFirstValueByKey CODE // Relay Set configuration xSetVelo := MQTT_SUBSCRIBER.RSVelo.Q1; IF xSetVelo THEN xKeepAliveVelo := TRUE; END_IF IF xKeepAliveVelo THEN udiContMsg := udiContMsg + 1; iLenVelo := TO_INT(StrLenA(psPayloadJsonVelo)); iSizeVelo := iLenVelo - TO_INT(MQTT_SUBSCRIBER.udiPayloadSizeVelo); StrDeleteA(psPayloadJsonVelo,iSizeVelo,iLenVelo); wsPayloadJsonVelo := STRING_TO_WSTRING(sPayloadJsonVelo); pwsPayloadJsonVelo := ADR(wsPayloadJsonVelo); //MQTT.ConvertUTF8toUTF16(sourceStart:= ADR(sPayloadJsonVelo), targetStart:= ADR(wsPayloadJsonVelo), dwTargetBufferSize:= TAM, bStrictConversion:= 1); //Reset jsonByteArrayReader jsonByteArrayReaderVelo ( xExecute := TRUE, pwData := pwsPayloadJsonVelo, jsonData := jsonDataVelo, xDone => xDoneReaderVelo ); FindFirstValueByKeyVelo( xExecute := xDoneReaderVelo, wsKey := "data", diStartIndex:= 0, jsonData := jsonDataVelo, jsonElement => jsonElementVelo, xDone => xDoneFindVelo ); IF xDoneFindVelo THEN lrVelo := jsonElementVelo.value.lrValue; //Reset jsonByteArrayReader jsonByteArrayReaderVelo ( xExecute := FALSE, pwData := pwsPayloadJsonVelo, jsonData := jsonDataVelo, xDone => xDoneReaderVelo ); FindFirstValueByKeyVelo( xExecute := FALSE, wsKey := "data", diStartIndex:= 1, jsonData := jsonDataVelo, jsonElement => jsonElementVelo, xDone => xDoneFindVelo ); xKeepAliveVelo := FALSE; GVL.xSetVeloRead := TRUE; END_IF END_IF And this to subscribe at the topic: //SUBSCRIBE VAR: //----------------- Subscribe Velocity ----------------------- MQTTSubscribeVelo : MQTT.MQTTSubscribe;//Variable MQTTSubscriber block -X - function-X wsTopicSubscribeVelo : WSTRING(1024) := "CORE/odometry/GET/data/simp"; // Topic to publish a message sSubscribeMassageVelo : STRING; udiPayloadSizeVelo : UDINT; xSDoneVelo : BOOL; xSErrorVelo : BOOL; xReceiveVelo : BOOL; eSTypeVelo : MQTT.MQTT_ERROR; eSMQTTErrorVelo : MQTT.MQTT_ERROR; RSVelo : RS; udiCont : UDINT; //SUBSCRIBE CODE: MQTTSubscribeVelo( xEnable:= MQTT_CLIENT.xConnection_Broker AND NOT xSErrorVelo AND NOT JSON_VELO.xKeepAliveVelo, pbPayload:= JSON_VELO.psPayloadJsonVelo, udiMaxPayloadSize:= SIZEOF(JSON_VELO.sPayloadJsonVelo), udiPayloadSize => udiPayloadSizeVelo, mqttClient:= MQTT_CLIENT.ClientMQTT, wsTopicFilter:=wsTopicSubscribeVelo, xDone => xSDoneVelo, xError=> xSErrorVelo, xReceived => xReceiveVelo, eMQTTError=> eSMQTTErrorVelo ); RSVelo(SET := xReceiveVelo, RESET1 := JSON_VELO.xKeepAliveVelo);
Last updated: 2024-09-09
Post by frank1001 on Codesys läuft nicht hoch
CODESYS Forge
talk
(Post)
Bin Neuling bei Codesys. Habe Codesys 64 Bit installiert (3.5.1) Nach dem Starten geht nur ein EIngabefenster auf mit folgenden Inhalt. Weiter passiert nichts. Was kann ich machen ? //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// _/_/_/_/ _/_/_/_/ _/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/ _/_/ _/_/ _/_/_/_/_/ _/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/_/_/_/_/ _/_/ _/_/ _/_/_/_/_/_/ _/_/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ _/_/_/_/_/ // // // // // //// //// //// //// /////// // // // // // // // // // // ///// ////// ////// ////// ////// ////// // ////// /// //// //// ///// ////// ///// // ///// _/ //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>CM</cmp>, <id>0x00000001</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>CmpMemPool</cmp>, <id>0x0000001e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>CmpLog</cmp>, <id>0x00000013</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>CmpSettings</cmp>, <id>0x0000001a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysFile</cmp>, <id>0x00000104</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>CmpMemGC</cmp>, <id>0x0000001f</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysCom</cmp>, <id>0x00000100</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysCpuBreakpoints</cmp>, <id>0x00000305</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysCpuHandling</cmp>, <id>0x00000101</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysCrypto</cmp>, <id>0x00000141</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysDir</cmp>, <id>0x0000011b</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysEthernet</cmp>, <id>0x0000011c</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysEvent</cmp>, <id>0x00000102</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysExcept</cmp>, <id>0x00000103</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysFileStream</cmp>, <id>0x00000120</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysGraphicGDIPlus</cmp>, <id>0x0000012a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysInt</cmp>, <id>0x00000106</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysInternalLib</cmp>, <id>0x00000107</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysMem</cmp>, <id>0x00000108</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysModule</cmp>, <id>0x00000109</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysMsgQ</cmp>, <id>0x0000010a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysMutex</cmp>, <id>0x0000013a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysNativeCommonControls</cmp>, <id>0x00000138</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysNativeControl</cmp>, <id>0x0000012f</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysOut</cmp>, <id>0x0000010b</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysPci</cmp>, <id>0x0000010c</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysPort</cmp>, <id>0x0000010d</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysProcess</cmp>, <id>0x0000010e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysSem</cmp>, <id>0x0000010f</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysSemCount</cmp>, <id>0x00000139</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysSemProcess</cmp>, <id>0x00000119</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysShm</cmp>, <id>0x00000110</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysSocket</cmp>, <id>0x00000111</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysTarget</cmp>, <id>0x00000112</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysTask</cmp>, <id>0x00000114</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysTime</cmp>, <id>0x00000115</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysTimeRtc</cmp>, <id>0x00000127</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysTimer</cmp>, <id>0x00000116</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysWindow</cmp>, <id>0x00000117</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System: <cmp>SysWindowFileDialog</cmp>, <id>0x0000011a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System|Dynamic: <cmp>SysTargetSoftMotion</cmp>, <id>0x00000112</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System|Dynamic: <cmp>SysCpuMultiCore</cmp>, <id>0x0000013d</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= System|Dynamic: <cmp>SysReadWriteLock</cmp>, <id>0x0000013e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpAlarmManager</cmp>, <id>0x0000007c</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpApp</cmp>, <id>0x00000002</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpAppBP</cmp>, <id>0x00000073</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpAppForce</cmp>, <id>0x00000074</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpAsyncMgr</cmp>, <id>0x0000005f</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpAuditLog</cmp>, <id>0x000000a1</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBinTagUtil</cmp>, <id>0x00000004</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBinTagUtilIec</cmp>, <id>0x0000005c</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBitmapPool</cmp>, <id>0x00000050</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBlkDrvCom</cmp>, <id>0x00000006</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBlkDrvShm</cmp>, <id>0x00000068</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBlkDrvTcp</cmp>, <id>0x00000030</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpBlkDrvUdp</cmp>, <id>0x00000007</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAAAsyncMan</cmp>, <id>0x00004007</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAABehaviourModel</cmp>, <id>0x00004015</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAACallback</cmp>, <id>0x00004001</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAACanL2</cmp>, <id>0x00004004</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAADTUtil</cmp>, <id>0x00004013</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAAFile</cmp>, <id>0x00004008</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAAMemBlockMan</cmp>, <id>0x00004003</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAANetBaseServices</cmp>, <id>0x00004018</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAARealTimeClock</cmp>, <id>0x00004014</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAASdoClient</cmp>, <id>0x00004011</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAASdoServer</cmp>, <id>0x00004017</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAASegBufferMan</cmp>, <id>0x00004019</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAASerialCom</cmp>, <id>0x00004012</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAAStorage</cmp>, <id>0x0000007e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAATick</cmp>, <id>0x00004009</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAATickUtil</cmp>, <id>0x00004010</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAATimer</cmp>, <id>0x00004016</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCAATypes</cmp>, <id>0x00004006</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpChannelClient</cmp>, <id>0x00000008</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpChannelClientIec</cmp>, <id>0x0000005d</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpChannelMgr</cmp>, <id>0x00000009</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpChannelServer</cmp>, <id>0x0000000a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpChecksum</cmp>, <id>0x0000000b</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCodeMeter</cmp>, <id>0x0000007a</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCommunicationLib</cmp>, <id>0x0000000c</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCoreDump</cmp>, <id>0x00000083</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpCryptMD5</cmp>, <id>0x0000006a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpDevice</cmp>, <id>0x0000000e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpDynamicText</cmp>, <id>0x00000051</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpEventMgr</cmp>, <id>0x0000005b</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpFileTransfer</cmp>, <id>0x0000005e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIecStringUtils</cmp>, <id>0x0000007f</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIecTask</cmp>, <id>0x00000011</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIecVarAccess</cmp>, <id>0x00000060</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIoDrvC</cmp>, <id>0x00000066</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIoDrvIec</cmp>, <id>0x0000005a</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIoMgr</cmp>, <id>0x00000012</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpIpc</cmp>, <id>0x0000001d</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpMonitor</cmp>, <id>0x00000014</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpMonitor2</cmp>, <id>0x00000032</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpNameServiceClient</cmp>, <id>0x00000015</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpNameServiceClientIec</cmp>, <id>0x0000011d</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpNameServiceServer</cmp>, <id>0x00000016</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpOPCUAClient</cmp>, <id>0x00000096</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpOPCUAProviderIecVarAccess</cmp>, <id>0x00000126</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpOPCUAServer</cmp>, <id>0x00000124</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpOPCUAStack</cmp>, <id>0x0000008d</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpObjectMgr</cmp>, <id>0x00000080</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpOpenSSL</cmp>, <id>0x00000033</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpPlcShell</cmp>, <id>0x00000128</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpRedundancy</cmp>, <id>0x00000129</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpRedundancyConnectionIP</cmp>, <id>0x0000ff03</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpRetain</cmp>, <id>0x00000017</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpRouter</cmp>, <id>0x00000018</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSchedule</cmp>, <id>0x00000019</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSecureChannel</cmp>, <id>0x00000090</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSecurityManager</cmp>, <id>0x0000008e</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSercos3Master</cmp>, <id>0x0000004c</id> <ver>3.1.2.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSessionInformation</cmp>, <id>0x00000097</id> <ver>3.5.19.20</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSrv</cmp>, <id>0x0000001c</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpSupervisor</cmp>, <id>0x0000008f</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpTraceMgr</cmp>, <id>0x00000070</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpUserDBFile</cmp>, <id>0x00000098</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpUserGroupsDBFile</cmp>, <id>0x00000099</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpUserMgr</cmp>, <id>0x00000061</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpUserObjectsDBFile</cmp>, <id>0x0000009c</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpVisuClientControllerHost</cmp>, <id>0x00000132</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpVisuHandler</cmp>, <id>0x00000054</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpVisuServer</cmp>, <id>0x00000057</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= <cmp>CmpXMLParser</cmp>, <id>0x00000058</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= Dynamic: <cmp>CmpTargetVisuStub</cmp>, <id>0x00000053</id> <ver>3.5.19.0</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= Dynamic: <cmp>CmpWebServer</cmp>, <id>0x00000071</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.025Z: Cmp=CM, Class=1, Error=0, Info=10, pszInfo= Dynamic: <cmp>CmpWebServerHandlerV3</cmp>, <id>0x00000072</id> <ver>3.5.19.10</ver> 2023-09-19T08:02:04.045Z: Cmp=SysCpuMultiCore, Class=1, Error=0, Info=4, pszInfo= MultiCore support: [activated], all cores are used 2023-09-19T08:02:04.045Z: Cmp=SysCpuMultiCore, Class=1, Error=0, Info=4, pszInfo= Number of available cores: 8 2023-09-19T08:02:04.076Z: Cmp=CmpBlkDrvUdp, Class=1, Error=0, Info=6, pszInfo= Network interface: <ipaddress>192.168.1.167</ipaddress>, subnetmask <subnetmask>255.255.255.0</subnetmask> 2023-09-19T08:02:04.076Z: Cmp=CmpRouter, Class=1, Error=0, Info=4, pszInfo= Network interface <interface>ether 0</interface> at router <instance>0</instance> registered 2023-09-19T08:02:04.076Z: Cmp=CmpBlkDrvUdp, Class=1, Error=0, Info=6, pszInfo= Network interface: <ipaddress>192.168.56.1</ipaddress>, subnetmask <subnetmask>255.255.255.0</subnetmask> 2023-09-19T08:02:04.076Z: Cmp=CmpRouter, Class=1, Error=0, Info=4, pszInfo= Network interface <interface>ether 3</interface> at router <instance>1</instance> registered 2023-09-19T08:02:04.076Z: Cmp=CmpChannelMgr, Class=1, Error=0, Info=2, pszInfo= Running as network server 2023-09-19T08:02:04.076Z: Cmp=CmpChannelMgr, Class=1, Error=0, Info=1, pszInfo= Running as network client 2023-09-19T08:02:04.077Z: Cmp=CmpChannelServer, Class=1, Error=0, Info=0, pszInfo= <numofchannels>4</numofchannels> channels available, each of the size <buffersize>100000</buffersize> Bytes 2023-09-19T08:02:04.265Z: Cmp=CmpRedundancy, Class=1, Error=0, Info=0, pszInfo= Debug Messages not activated 2023-09-19T08:02:04.266Z: Cmp=CmpRedundancyConnectionIP, Class=1, Error=0, Info=0, pszInfo= Read connection settings... 2023-09-19T08:02:05.456Z: Cmp=CmpRouter, Class=1, Error=0, Info=4, pszInfo= Network interface <interface>BlkDrvShm</interface> at router <instance>2</instance> registered 2023-09-19T08:02:05.456Z: Cmp=CmpBlkDrvShm, Class=1, Error=0, Info=9, pszInfo= Local address (BlkDrvShm) set to 1 2023-09-19T08:02:05.463Z: Cmp=CmpBlkDrvTcp, Class=1, Error=0, Info=6, pszInfo= Local network address: <ipaddress>192.168.56.1</ipaddress> 2023-09-19T08:02:05.464Z: Cmp=CmpRouter, Class=1, Error=0, Info=4, pszInfo= Network interface <interface>BlkDrvTcp</interface> at router <instance>3</instance> registered 2023-09-19T08:02:05.507Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= No certificate for the OPC UA server available. 2023-09-19T08:02:05.507Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Security policy allows plain text communication. Secure communication is deactivated. 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= ********** 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= OPC UA Server Started: 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Hostname: SIEMENS, Port: 4840 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= URL: opc.tcp://SIEMENS:4840 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Loopbackadapter activated. 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= All available networkadapters are used. 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Multithreading activated. 7 workers used. 2023-09-19T08:02:05.508Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= ************ 2023-09-19T08:02:05.513Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Provider 'CODESYS_DefaultProvider' (version 0x3051300) registered at the OPC UA server. 2023-09-19T08:02:05.522Z: Cmp=CM, Class=1, Error=0, Info=0, pszInfo= ========================================================================= 2023-09-19T08:02:05.522Z: Cmp=CM, Class=1, Error=0, Info=4, pszInfo= CODESYS SoftMotion Win V3 x64 2023-09-19T08:02:05.522Z: Cmp=CM, Class=1, Error=0, Info=4, pszInfo= OS=Windows, CPU=x86, Arch=64Bit, Coding=C 2023-09-19T08:02:05.522Z: Cmp=CM, Class=1, Error=0, Info=6, pszInfo= <version>3.5.19.20</version> <builddate>Aug 1 2023</builddate> 2023-09-19T08:02:05.522Z: Cmp=CM, Class=1, Error=0, Info=5, pszInfo= Copyright CODESYS Development GmbH 2023-09-19T08:02:05.522Z: Cmp=CM, Class=1, Error=0, Info=0, pszInfo= ========================================================================= 2023-09-19T08:02:05.529Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Provider 'AddressSpaceFragment Provider' (version 0x3051314) registered at the OPC UA server. 2023-09-19T08:02:05.530Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Provider 'OPC UA for IEC-61131-3' (version 0x3051314) registered at the OPC UA server. 2023-09-19T08:02:05.530Z: Cmp=CmpOPCUAServer, Class=1, Error=0, Info=0, pszInfo= Provider 'AlarmManager' (version 0x3051314) registered at the OPC UA server. 2023-09-19T08:02:05.606Z: Cmp=CmpRouter, Class=1, Error=0, Info=1, pszInfo= Setting router <instance>0</instance> address to (00a7) 2023-09-19T08:02:05.606Z: Cmp=CmpRouter, Class=1, Error=0, Info=1, pszInfo= Setting router <instance>1</instance> address to (0001) 2023-09-19T08:02:05.606Z: Cmp=CmpRouter, Class=1, Error=0, Info=1, pszInfo= Setting router <instance>2</instance> address to (0001) 2023-09-19T08:02:05.606Z: Cmp=CmpRouter, Class=1, Error=0, Info=1, pszInfo= Setting router <instance>3</instance> address to (2ddc:c0a8:3801) 2023-09-19T08:02:05.611Z: Cmp=CM, Class=1, Error=0, Info=34, pszInfo= CODESYS Control ready 2023-09-19T08:02:05.796Z: Cmp=CM, Class=2, Error=0, Info=0, pszInfo=!!!! no runtime license - running in demo mode(~2 hours)
Last updated: 2023-09-19
Post by kevinrn on CODESYS Development System V3 installation auf unter Parallells Windows 11auf MAC PRO M1 ARM Prozessor
CODESYS Forge
talk
(Post)
Hallo, das Thema ist ja etwas offtopic. Aber ich kann gerne mal von meiner Erfahrung berichten: Nachdem ich von 2020 bis 2023 immer einen MacBook Pro mit Intel CPU hatte (i9/32GB) und nun seit Januar 2024 mit dem M3 Max unterwegs bin kann ich Nachfolgendes berichten. Infos zu den Aufgaben, die ich damit erledige: Die Runtime nutze ich nicht auf dem Mac (Wenn ich von Mac rede, dann meine ich damit die Win11 ARM64 Parallels Umgebung) Ich nutze die IDE für Library development und für automatisierungs Tests von CI/CD jobs. Weiterhin öffne ich oft große Projektarchive mit teilweise 160 MB. Erfahrungen zur Installation von CODESYS Versionen: Ich habe einige Versionen installiert, unter anderem, 3.5.14.4, 3.5.17.2, 3.5.16.3, 3.5.18.4 und 3.5.19.6. Ich hatte mit keiner einizgen Installation ein Problem. Die Installation lief immer ohne Probleme durch. Runtimes (Control Win) installiere ich nicht. Ich nutze linux basierte Zielsysteme und bei bedarf eine Windows VM auf einen entfernen Host mit X64. Lokales Gateway läuft ebenso Sonstige Erfahrungen: Ich nutze viele Komponenten Querbeet: Alarming, AC Persistence, Symbol Konfiguration, CFC und ST Editor, externes Packages wie STWeep, Git für Library Entwicklung, Visu, etc. Mit keiner dieser "Komponenten" hatte ich schwierigkeiten oder einen Unterschied zu x64 systemen festgestellt. Man muss aber auch sagen, dass das alles nur ein kleiner Bruchteil ist, was die CODESYS Welt beinhaltet, deshalb sind diese Aussagen auch nur subjektiv aus meinem Erfahrungsbereich. Für das Entwickeln von Libraries sehe ich keine Performance Einschränkungen. Ganz im Gegenteil, für das, dass hier eine emulation stattfindet, ist es erstaunlich schnell. Meiner Meinung nach sind sogar einfache und kleine Projekte schneller als beim Intel Mac. Die Akku Leistung mit dem Mac und Parallels ist fantastisch. Lüfter hört man nicht mal bei der Nutzung von CODESYS. Beim Intel konnte ich sonst ein Spiegelei auf der Abdeckung zubereiten... Was evtl. etwas langsamer ist bzw. mir manchmal so vor kommt ist, der CFC Editor im Online Mode. Aber hierzu fehlt mir ein richtiger Vergleich. Fazit: Ich bin selbst erstaunt wie gut die CODESYS IDE auf einem ARM64 emuliert wird. Ich muss aber auch sagen, dass ich jederzeit eine x64 Workspace zur Verfügung habe, falls was nicht funktionieren sollte. Das habe ich mir extra zum Umstieg zu gelegt. Bisher habe ich es jedoch noch nie benötigt, da meine Anforderungen alle erfüllt werden. Es sollte einem aber bewusst sein, dass dies keine supportete Umgebung ist und man auch bei spezifischen Problemen keinen Support erwarten sollte. Ich nutze CODESYS ca. 4-12 Stunden die Woche und ich warte immer noch auf etwas, um meine X64 Cloud Workspace mal zu verwenden... Vielleicht hilft dir dies ja etwas bei der Entscheidung.
Last updated: 2024-03-21
Post by scoob on ModbusFB - Slow Response Time
CODESYS Forge
talk
(Post)
Hello, I have been trying to use the ModbusFB functions so I can put some code into libraries, but it seems to be very slow for me. I have a Modbus device with 100ms registers. I previously setup 10 channels in the 'traditional' Modbus Slave with channels and mappings - and set a cyclic trigger at 100ms - this worked fine. I then tried the ModbusFB example, and setup reading the same 10 blocks of modbus addresses, copying the example and putting all of the requests into an array and triggering the requests sequentially. I timed how long the requests are taking to get round to each one, and it is around 1s 450ms. How do I speed this up to match the cyclic time? IF NOT(init) THEN init := TRUE; // Set the required IP address: ipAddress[0] := 192; ipAddress[1] := 168; ipAddress[2] := 1; ipAddress[3] := 10; // Pass the required IP address to the clinet FB: client_NetworkSwitch.aIPaddr := ipAddress; client_NetworkSwitch.udiLogOptions := (ModbusFB.LoggingOptions.ClientConnectDisconnect OR ModbusFB.LoggingOptions.ClientReceivedValidReplies); // Try to connect the client client_NetworkSwitch(xConnect:=TRUE); // Configure all the channels to read connecting them to the client: portStatus_Request(rClient := client_NetworkSwitch, uiStartItem := 4096, uiQuantity := 32, pData := ADR(portStatus), udiReplyTimeout := udiReplyTimeout); portSpeed_Request(rClient := client_NetworkSwitch, uiStartItem := 4352, uiQuantity := 32, pData := ADR(portSpeed)); flowControl_Request(rClient := client_NetworkSwitch, uiStartItem := 4608, uiQuantity := 32, pData := ADR(flowControl)); linkUpCounter_Request(rClient := client_NetworkSwitch, uiStartItem := 5888, uiQuantity := 32, pData := ADR(linkUpCounter)); txPacketCounter1_Request(rClient := client_NetworkSwitch, uiStartItem := 8192, uiQuantity := 100, pData := ADR(txPacketCounter1)); txPacketCounter2_Request(rClient := client_NetworkSwitch, uiStartItem := 8292, uiQuantity := 28, pData := ADR(txPacketCounter2)); rxPacketCounter1_Request(rClient := client_NetworkSwitch, uiStartItem := 8448, uiQuantity := 100, pData := ADR(rxPacketCounter1)); rxPacketCounter2_Request(rClient := client_NetworkSwitch, uiStartItem := 8548, uiQuantity := 28, pData := ADR(rxPacketCounter2)); txErrors_Request(rClient := client_NetworkSwitch, uiStartItem := 8704, uiQuantity := 64, pData := ADR(txErrors)); rxErrors_Request(rClient := client_NetworkSwitch, uiStartItem := 8960, uiQuantity := 64, pData := ADR(rxErrors)); // Trigger all client requests initially FOR clientRequestsCnt := 0 TO (SIZEOF(clientRequests)/SIZEOF(clientRequests[0]))-1 DO pClientRequest := clientRequests[clientRequestsCnt]; pClientRequest^.xExecute := TRUE; END_FOR // Prepare sequential trigger / control of client requests. clientRequestsCnt := 0; pClientRequest := clientRequests[clientRequestsCnt]; END_IF // Call the client to do request processing: client_NetworkSwitch(); // Now we trigger client request sequentially ... IF NOT pClientRequest^.xExecute AND NOT pClientRequest^.xDone AND run AND client_NetworkSwitch.xConnected THEN pClientRequest^.xExecute := TRUE; END_IF // .. and check result/error IF pClientRequest^.xExecute AND run AND client_NetworkSwitch.xConnected THEN IF pClientRequest^.xDone THEN // Prepare next trigger of client request (a rising edge of xExecute) pClientRequest^.xExecute := FALSE; IF clientRequestsCnt < SIZEOF(clientRequests)/SIZEOF(clientRequests[0])-1 THEN // next client request clientRequestsCnt := clientRequestsCnt + 1; ELSE clientRequestsIterationCounter := clientRequestsIterationCounter + 1; clientRequestsCnt := 0; END_IF pClientRequest := clientRequests[clientRequestsCnt]; END_IF END_IF I did try a semi-coded way using the IoDrvModbusTCP library, and setting the slave com settings, then 10 commands and 10 requests, then using a TP on xDone as a pause, before triggering another request - this is time the delay is around 120ms - so the device is fine with the speed, just something I am doing wrong in the ModbusFB method I am sure.
Last updated: 2024-04-26
Post by paulg on RasPi CAA Serial example - unexpected behavior during debug
CODESYS Forge
talk
(Post)
I've trimmed down the CAA Serial Codesys example to only listen on one port but, when stepping through the Case structure in debug mode, it jumps out of the structure during a specific point in every scan (I'll point it out below after describing the setup and listing the code). I'm using a Pi 4 Model B, and I have an Arduino Nano Every plugged in via USB which is streaming the following serial message at 1 Hz: Time since opening connection: 1 s Time since opening connection: 2 s ...and so on. The Pi shows the Nano at /dev/ttyACM0 so I edited CODESYSControl_User.cfg to read: Linux.Devicefile=/dev/ttyACM The code in my PLC_PRG is (ignore some of the comments, I hadn't deleted them out from the original example): PROGRAM PLC_PRG VAR xStartTest : BOOL:= TRUE; iState : INT; xTestDone : BOOL;(* True, when the test was done succesfully *) (* Settings to communicate with the COM Port *) aCom1Params : ARRAY [1..7] OF COM.PARAMETER; como1 : COM.Open; comc1 : COM.Close; comw1 : COM.Write; comr1 : COM.Read; //sWrite : STRING := 'Test String!'; sRead : STRING(25); szRead : CAA.SIZE; xCom1OpenError : BOOL; xCom1CloseError : BOOL; xCom1WriteError : BOOL; xCom1ReadError : BOOL; END_VAR //This example shows the communication of two COM Ports with each other. //The first one writes a string of characters, which is read by the second one. //After successful execution, the two COM Ports are closed and the test is done. IF xStartTest THEN CASE iState OF 0: //The parameters are set for the COM Port aCom1Params[1].udiParameterId := COM.CAA_Parameter_Constants.udiPort; aCom1Params[1].udiValue := 1; // the correct Port should be adapted aCom1Params[2].udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate; aCom1Params[2].udiValue := 115200; aCom1Params[3].udiParameterId := COM.CAA_Parameter_Constants.udiParity; aCom1Params[3].udiValue := INT_TO_UDINT(COM.PARITY.NONE); aCom1Params[4].udiParameterId := COM.CAA_Parameter_Constants.udiStopBits; aCom1Params[4].udiValue := INT_TO_UDINT(COM.STOPBIT.ONESTOPBIT); aCom1Params[5].udiParameterId := COM.CAA_Parameter_Constants.udiTimeout; aCom1Params[5].udiValue := 0; aCom1Params[6].udiParameterId := COM.CAA_Parameter_Constants.udiByteSize; aCom1Params[6].udiValue := 8; aCom1Params[7].udiParameterId := COM.CAA_Parameter_Constants.udiBinary; aCom1Params[7].udiValue := 0; //The first Port is opened with the given parameters como1(xExecute := TRUE, usiListLength:=SIZEOF(aCom1Params)/SIZEOF(COM.PARAMETER),pParameterList:= ADR(aCom1Params)); IF como1.xError THEN xCom1OpenError := TRUE; iState := 1000; END_IF //After a successful opening, the next state is reached IF como1.xDone THEN iState := 15; END_IF 15: // the reading process is started comr1(xExecute := TRUE,hCom:= como1.hCom, pBuffer:= ADR(sRead), szBuffer:= SIZEOF(sRead)); IF comr1.xError THEN xCom1ReadError := TRUE; END_IF //After completion the size of the written bytes are saved IF comr1.xDone OR comr1.xError THEN szRead := comr1.szSize; iState := 20; END_IF 20: // If everything was successful the ports are closed and the handles are released comc1(xExecute := TRUE,hCom:= como1.hCom); IF comc1.xError THEN xCom1CloseError := TRUE; END_IF IF comc1.xDone OR comc1.xError THEN iState := 25; END_IF 25: // The first port is closed and the used handle released xTestDone := TRUE; xStartTest := FALSE; iState := 0; como1(xExecute := FALSE); comw1(xExecute := FALSE); comc1(xExecute := FALSE); ELSE iState := 0; END_CASE END_IF I realize as I write this that the .udiPort should be 0 and not 1, but that shouldn't be causing the issue I'm seeing. I'm forcing xStartTest:=TRUE every scan so that I can step into each line and observe what's happening. What I see is that the port parameters are set and the port is opened with no errors, but the code jumps out of the case structure to the last line every time it reaches (and I step into) the iState:=15 line (at the end of the iState:=0 block). So every scan cycle it goes through the block for iState=0 and jumps out at the same spot. I'm a little new to PLC programming so I may be misunderstanding the flow, but shouldn't this case structure keep moving down in the same scan? If it only handles one case per scan, why doesn't the value of iState persist? Thanks! Update: I restarted the Codesys control today and I was then able to see an error for como1.eError of "WRONG_PARAMETER". I tried doing some digging and another post made me think I should add another line to CODESYSControl_User.cfg, so I now have: [SysCom] Linux.Devicefile=/dev/ttyACM portnum := COM.SysCom.SYS_COMPORT1 So now when I set .udiPort to 1, I get "NO_ERROR" but I also don't read anything from the port (i.e. szRead = 0 always). If I try setting the port to 0 (which I'm confused about, because I added a COMPORT1 line but the device shows on the Pi as ACM0), I get the "WRONG_PARAMETER" error again. Is there an easier way to troubleshoot the Pi and view what ports the Codesys runtime is actually able to see while the Pi is running?
Last updated: 2024-06-06
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND
or OR
.