Post by alex00 on DCS / Central Engineering for Codesys
CODESYS Forge
talk
(Post)
Hello together I'm currently investing in possibilities to have a central engineering software / system for Codesys based controllers. Something like a DCS / SCADA depending on where you see the functionality. We plan to use more or less vanilla codesys. The tool should support the following: - Connect to multiple PLC's in a project to see its variables and debug it. - Central Engineering capabilities (for example shared libraries in a project). - Download the new code / binaries to the plc. - Maybe have functionality to combine visualization elements and logic together. - See the live status variables on all the systems (crosscommunication). I see that codesys theoretically supports engineering of multiple PLC's, but I couldnt find to much functionality for a DCS type of operation, but that could be lack of knowledge. Any tips from you? Is Codesys good enough for this and maybe there are some manufacturers which build around it? Or are there good tools on the market with Codesys support (and the engineering is separate, but download to codesys possible). The use case is distributed energy installations like Heating pumps, Photovoltaics, etc. All these installations should have a PLC with codesys installed and run in one larger network, the PLC's are connected via VPN. Thanks for your inputs Greetings
Last updated: 2024-02-19
Post by mtho on JSON Utilities - JSON file written with invalid structure
CODESYS Forge
talk
(Post)
I'm using the JSON Utilities SL library to write configurations in my program to a file. I'm generating the JSON data using the builder function block and all appears to work correctly. When I write the jsondata to file, I'm finding that some of the JSON elements are not being written in the right location in the file. Rather than writing they keys under the parent object, they get written outside the root JSON object at the end of the file. If I then try to read the file back into the program, I get an invalid_structure error. I don't get any errors when populating the JSON data or when writing the file. I attached an example of the JSON writer output. The problems begin with key P200. Each P200 should go under MBR1 through MBR3. Among the rest of the keys, they are supposed to be under different parent objects. I am using default values for wsLineBreak and encoding.
Last updated: 2024-03-06
Post by wbj0t on mobus tcp slave device. read/write holdings with 2 variables.
CODESYS Forge
talk
(Post)
Hi there. I have an issue to read and set time for the controller. In the issue many registers described as writable by 6/16 functions, and, in this time, also(!) readable! For example: I have time registers: min, hour, day, mon, year. By specifications it is possible check time (so I need always update these varibles in loop) and set time by writing these same registers, BUT how to set, if they will immediatle updated by current time after writing? So, I need to separate one address at two variables. I have seen option mark: Overlay of the process image by the holding and input register. I understand this so: When I READ by function 3, I will get variable that connected with the same INPUT address and when I WRITE by 6/16 this will change second variable that connected with HOLDING address. BUT, this mark doesnt work, when I write 6/16 and try to get by function 3, I will get written value instead INPUT variable. So, what to do?
Last updated: 2024-03-20
Post by phoward131 on Alarm State Icon
CODESYS Forge
talk
(Post)
I am trying to create an icon on an overview screen that depicts if an alarm group has active alarms, active acknowledged alarms, or inactive unacknowledged alarms (waiting for confirmation). I've attempted to set up Notification Actions in the Alarm Class to set variables based on state changes but have been unable to find a clean and effective way to do this. Because an action on any alarm will trigger the variable to be set as instructed, I'm struggling to find a way to configure it for what I need (ie if two alarms activate, then one deactivates, the variable for indicating an alarm is active would be cleared after the single deactivation). I've been pointed toward the Alarm Manager example project but I'm finding it too complicated to understand how to implement it in my own project. Has anyone come up with another good way to indicate the states of alarms or a simpler usage of the Alarm Manager functions?
Last updated: 2024-04-23
Post by william-blandon on RecipeManCommands.ReloadRecipes
CODESYS Forge
talk
(Post)
Hi Dave. Thanks for your answer. I still struggling with this. I have done everything according with the Codesys help even I have looked in detail at the example. I have double checked the recipe manager configuration and the use of all the methods. There are two methods that do not work as expected. I'm using Codesys 3.5.19.20 and recipe management 4.4.0.0 .CreateRecipe just create a recipe in the recipe definition but do not create the file. This have a walk around just giving a .ReadAndSaveRecipe afterwards. .ReloadRecipes do nothing but do not generate any error as well. After calling it I call the .GetRecipeCount and the number is always 0. When I create a new recipe (using the function block methods) then the number changes. Looks like this method is looking to the wrong directory finding nothing. I don't know if there is a missing configuration in the CODESYSControl.cfg file. I'm thinking in a walk around for this but I need to create a strings array with the recipe names as retentive and making all the management when deleting and adding recipes. Have had some one the same problem?
Last updated: 2024-05-23
Post by wollvieh on Display minutes as hours & minutes
CODESYS Forge
talk
(Post)
Here a code for an Operation Counter with : days,hours,minutes,seconds as an example, maybe it points you the right direction ? FUNCTION_BLOCK OperationDayHour VAR_INPUT IN : BOOL; // Betrieb Takt : BOOL; // 1Hz Systemtakt END_VAR VAR_OUTPUT BetrTag : UDINT; // Ausgabe Betriebstage Betrstd : UDINT; // Ausgabe Betriebsstunden Betrmin : UDINT; // Ausgabe Betriebsminuten Betrsec : UDINT; // Ausgabe Betriebsekunden BetrString : STRING; // Ausgabe als String END_VAR VAR ///Erkennung Taktflanke Flanke: R_TRIG; END_VAR VAR_IN_OUT BetrsecAbsolut: UDINT; //Ein/Ausgangsvariable Betriebssekunden RETAIN !!! END_VAR Flanke(CLK:= Takt, Q=> ); (*Erkennung Taktflanke*) IF (IN AND Flanke.Q) THEN (*Sekunden hochzählen*) BetrsecAbsolut := BetrsecAbsolut + 1; END_IF Betrsec := BetrsecAbsolut MOD 60; Betrmin := ( BetrsecAbsolut / 60) MOD 60; Betrstd := ( BetrsecAbsolut / 60 / 60 ) MOD 24; BetrTag := ( BetrsecAbsolut / 60 / 60 /24 ); BetrString := RIGHT ( UDINT_TO_STRING( BetrTag + 100000),5); BetrString := CONCAT (BetrString, 'd_'); BetrString := CONCAT (BetrString,RIGHT ( UDINT_TO_STRING( Betrstd + 100000),5)); BetrString := CONCAT (BetrString, 'h_'); BetrString := CONCAT (BetrString, RIGHT ( UDINT_TO_STRING( Betrmin + 100),2)); BetrString := CONCAT (BetrString, 'm_'); BetrString := CONCAT (BetrString, RIGHT ( UDINT_TO_STRING( Betrsec + 100),2)); BetrString := CONCAT (BetrString, 's');
Last updated: 2024-05-27
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 caprez95 on Deleting the trend recording history
CODESYS Forge
talk
(Post)
Hallo Ich möchte eine laufende Trendaufzeichnung stoppen, den Inhalt löschen und Trend-Diagramm auf 0 zurücksetzen. Laut Codesys soll das mit dem folgenden Code möglich sein: You can insert an input element in the visualization which the operator can use to delete the previous value recording in the trend visualization at runtime. The curve displayed until then is removed and the display starts over. In the application (example: in the program PLC_PRG), implement the following code: itfTrendRecording : ITrendRecording; itfTrendStorageWriter : ITrendStorageWriter; itfTrendStorageWriter3 : ITrendStorageWriter3; sTrendRecordingName : STRING := 'TrendRecording'; itfTrendRecording := GlobalInstances.g_TrendRecordingManager.FindTrendRecording(ADR(sTrendRecordingName)); xClearHistoryTrend: BOOL; IF xClearHistoryTrend THEN itfTrendRecording := GlobalInstances.g_TrendRecordingManager.FindTrendRecording(ADR(sTrendRecordingName)); IF itfTrendRecording <> 0 THEN itfTrendStorageWriter := itfTrendRecording.GetTrendStorageWriter(); IF __QUERYINTERFACE(itfTrendStorageWriter, itfTrendStorageWriter3) THEN itfTrendStorageWriter3.ClearHistory(); END_IF END_IF In the visualization of the trend recording, add a button for deleting the previous curve. Configure its Toggle property with the variable PLC_PRG.xClearHistoryTrend. ⇒ When xClearHistoryTrend is set to TRUE, the previously recorded curve is deleted. The recording immediately starts again. Dies löscht auch die Daten vom Trend, aber das Diagramm wird nicht auf 0 zurückgesetzt, sondern läuft einfach da weiter wo man gestoppt hat. Braucht es für den Diagramm-Reset noch einen zusätzlichen Befehl? Gruss
Last updated: 2024-06-11
Post by xnoop on MBTCP Slave configuration
CODESYS Forge
talk
(Post)
Hello, I use Codesys 3.5 SP18 Patch 4 (64 bit) My Codesys project is composed of several dozen of Modbus TCP Slaves. I want to configure each of them by define : - Modbus TCP Slave Configuration : Name, IPAddress, port - Channels - Mapping I can't afford to configure manually and I need to find automatic way What possibilities does the Codesys offer? 1. I know it possible to use python script to create Modbus TCP Master and Slave. But I don't find anyway to create Channels and Mapping through the API 2. I 've tested to set mapping with file.csv on a Modbus Tcp Slave, but no way to import channels definition from file 3. I 've tried to use PLCOpenXml file. For example I 've create a project with an Ethernet device. I've exported it in PlcOpenXml file. After delete the Ethernet device, I've imported the PlcOpenXml file without success. I've tried the same by creating Modbus TCP Slave. Could you help me to find to good way ? Thanks
Last updated: 2024-06-19
Post by tariq on Using Hilscher CIFX Cards as EtherCAT Masters in CODESYS
CODESYS Forge
talk
(Post)
Dear Codesys Support Team, I hope this message finds you well. I am currently working on a project that involves using a Hilscher CIFX card to act as an EtherCAT master within the CODESYS environment. Despite following the available documentation and setup guides, I have encountered some challenges and require assistance to ensure proper configuration and operation. Questions: 1- Could you please confirm if the Hilscher CIFX card is supported as an EtherCAT master in CODESYS? If so, are there specific drivers or configuration files that need to be installed? 2- Are there detailed setup guides or example projects available that demonstrate the integration of Hilscher CIFX cards with CODESYS for EtherCAT communication? 3- Is there any additional software or plugins required for ensuring seamless communication between the CIFX card and the EtherCAT slaves within CODESYS? Your support and guidance on these matters would be greatly appreciated, as it is crucial for the success of our project. Thank you for your time and assistance. I look forward to your prompt response. Best regards, TB
Last updated: 2024-07-02
Post by trusty-squire on Confused by dwIpoTime input for SMC_Interpolator
CODESYS Forge
talk
(Post)
Hi, Learning Codesys CNC, and I am confused by the dwIpoTime parameter. I have a basic demo application, using SMC_Interpolator feeding into SMC_TRAFO_Gantry2Tool2, which then sets the position of the x/y SM_Drive_Virtual axis. I also have a C axis which revolves the tool, which is controlled using a simple tangential angle calculation SMC_CalcDirectionFromVector. The GCode I'm using has feed/accel set at 500. The axis configuration limits are well above that (2000). What's strange is that, when I run the simulation, the feed speed changes drastically when I update the variable dwIpoTime. The larger the number, the faster it moves. What's going on here? The documentation only says "This variable has to be set for each call. It represents the cycle time in μsec." Why does it change the feed speed I'm seeing the in simulation? What is a good number to use? The example I was looking at set it at 5000. Screenshot attached.
Last updated: 2024-07-18
Post by timvh on How to implement an interface (IElement)?
CODESYS Forge
talk
(Post)
See: https://forge.codesys.com/prj/codesys-example/element-collect/home/Home/ This contains an application "OnlineChangeSafeLinkedListExample". What you should do is create a new interface which has your "Priority" property. Then your FB should extend the base element function block and implement your own interface: E.g. FUNCTION_BLOCK MyElement EXTENDS COL.LinkedListElementBase IMPLEMENTS I_MyInterface Then the __QUERYINTERFACE does the magic to check if your "element" also implements your interface. Something like this: // Compares this element with itfElement. // Returns 0 if the elements are equal, < 0 if the element is less than itfElement, // > 0 if the element is greater than itfElement. // This method will be called from sorted collections (e.g. |COL.SortedList|) to sort the elements. // IMPORTANT: The underlying value to be compared with MUST NOT be changed during the lifecycle of the object. METHOD ElementCompareTo : INT VAR_INPUT (* The element to compare*) itfElement : COL.IElement; END_VAR VAR itfIntElement : I_MyInterface; xResult : BOOL; END_VAR // We use integer iInt1 for sorting. xResult := __QUERYINTERFACE(itfElement, itfIntElement); IF xResult THEN IF iInt1 < itfIntElement.Priority THEN ElementCompareTo := -1; ELSIF iInt1 > itfIntElement.Priority THEN ElementCompareTo := 1; ELSE ElementCompareTo := 0; END_IF ELSE ElementCompareTo := -1; END_IF
Last updated: 2024-07-22
Post by denkihitsuji on Content update through Data URI on Web Brower on Visualization Toolbox
CODESYS Forge
talk
(Post)
Objective: I want to dynamically update the content with strings and JPEG images received from a TCP/IP socket. For this purpose, I am exploring the possibility of utilizing the Web Browser feature of the Visualization toolbox. Example: In a standard web browser, entering data:text/plain;charset=utf-8;base64,SGVsbG8gc3RyYW5nZXI= in the URL window will display "Hello stranger" on the webpage. Issue: When attempting to use this method in the Web Browser of the Visualization toolbox, the content does not display as expected. Instead, it shows the error:'Navigation to the webpage was canceled.'. Request: I seek guidance on how to resolve this issue so that the Web Browser in the Visualization toolbox correctly interprets and displays the data URI content. Alternative Solution Welcomed: Or, if it is possible to directly use Codesys Structured Text (ST) variables within an HTML page, this approach would also meet my requirements. Thank you for your attention.
Last updated: 2024-07-30
Post by jmfernandes on OpenDir always in error
CODESYS Forge
talk
(Post)
Hello I'm trying to use DirOpen to access a directory where then I can read/list the files inside. But I can't list any files because DirOpen.xError is always true. In eError the message is this: " ERROR_UNKNOWN Local library error ID (0: no error; 5101: time out)**** " I have in the file explorer the path 'C:\CodesysTest\Aluminium' and to make sure I also created in the plc a folder to 'prj/Recipes/Aluminium'. I tried using the different paths, but in both it happens the same thing.Inside the folder Aluminium there is two csv files, that I want to list. I added in the library manager CAA Files and CAA Types. I am using the example of https://content.helpme-codesys.com/en/libs/CAA%20File/Current/Examples.html#directory but not matter what I do, I can't get the list the names of the files. What am I missing?
Last updated: 2024-07-31
Post by mubeta on parker servo and position
CODESYS Forge
talk
(Post)
In general, drives have parameter sets to adjust behaviour in such cases: position recovery, adaptation with resistant torque, out-of-position window failure, etc. (Much depends on the type of configuration set for the axis: positioner, speed controller, torque controller, etc.). I have used that type of drive very little, in only two cases and a long time ago. To tell you what is normal is impossible. I know by reputation they are very simple objects, without too many pretensions and adjustments possible. Try running traces by monitoring actual position, motor current, torque and following error. These are the most sensible curves to understand what is going on. Maybe by fine tuning the motor tuning, the current controller or the speed controller you will get something closer to what you want. For example, from DS, the motor has a standstill torque of 3 Nm. Observe with traces whether this is effective: motor current trend. And afterwards, when you have your own accurate picture of the situation, you can also hear from the product's local support to see if you can steal a few more things from it performance-wise.
Last updated: 2024-08-05
Post by otbeka on CmpCrypto CryptoGenerateHash Not Outputting
CODESYS Forge
talk
(Post)
Hi, I have been trying to use CryptoGenerateHash from the CmpCrypto Implementation library. My code is taken almost directly from the CryptoDemo.project example provided on Codesys Forge, yet the CryptoGenerateHash function does not write to the address listed in pHash. RTS_IEC_RESULT is OK, but I am getting nothing out of the function. No errors either, all my libraries are up to date. Any help would be appreicated! PROGRAM PLC_PRG VAR sMessage : MESSAGE := 'The red fox runs across the ice'; abyHashCode : HASH_CODE := [ 16#52, 16#ED, 16#87, 16#9E, 16#70, 16#F7, 16#1D, 16#92, 16#6E, 16#B6, 16#95, 16#70, 16#08, 16#E0, 16#3C, 16#E4, 16#CA, 16#69, 16#45, 16#D3 ]; xMessageOK : BOOL; END_VAR xMessageOK := CheckMessage(sMessage, abyHashCode); FUNCTION CheckMessage : BOOL VAR_INPUT sMessage : REFERENCE TO MESSAGE; abyHashCode : REFERENCE TO HASH_CODE; END_VAR VAR _hHASH : RTS_IEC_HANDLE := CryptoGetAlgorithmById(ui32CryptoID:=RtsCryptoID.HASH_SHA1, pResult:=0); Result : RTS_IEC_RESULT; bsMessage : RtsByteString := (ui32MaxLen:=SIZEOF(sMessage), pByData:=ADR(sMessage), ui32Len:=TO_UDINT(LEN(sMessage))); abyNewHashCode : HASH_CODE; bsNewHashCode : RtsByteString := (ui32MaxLen:=SIZEOF(abyNewHashCode), pByData:=ADR(abyNewHashCode)); diCmpResult : DINT; END_VAR Result := CryptoGenerateHash(hAlgo:=_hHASH, pData:=ADR(bsMessage), pHash:=ADR(bsNewHashCode)); diCmpResult := SysMemCmp(pBuffer1:=ADR(abyHashCode), pBuffer2:=ADR(abyNewHashCode), udiCount:=SIZEOF(HASH_CODE)); CheckMessage := diCmpResult = 0;
Last updated: 2024-09-06
Post by bruceae on Ethernet/IP Scan
CODESYS Forge
talk
(Post)
Hello, I have a robot configured as a Generic Ethernet Module under Ethernet/IP Scanner. I can not see the change of state of the outputs coming from the robot on the codesys side in real-time. (The robot has it's own internal program that would changes the values of remote outputs 0-3 off and on). Also when I send data down to the inputs of the robot it doesn't transfer over as expected. As an example I'll send to the robot's input bit 0 a value of 1. It doesn't see that value change. However, when I write that input bit 0 back to a value of 0, the robot changes state and shows a value of 1. And if I change the state of a different bit, the other bits update properly, except for the bit that I changed. Any advice would be greatly appreciated, and if anything else is needed let me know.
Last updated: 2024-09-10
Post by lbartik on J1939 TX/RX PDU1
CODESYS Forge
talk
(Post)
Is it possible to transmit a PDU1 PGN using the J1939 manager and local device? What if I need to transmit a PGN RQST via 0xEA00 (PGN 59904)? How would I do this P2P (Destination < 0xFF) or broadcast (Destination 0xFF)? I don't think this is possible for any destination type. I don't think it's possible to receive broadcast PDU1 messages either. For example, an address claim PGN 60928 (0x18EEFF80) is addressed to all nodes (0xFF) and not any specific local device so it will be filtered out. These are major oversights in the IoDrvJ1939 library to not support every PDU1 RX/TX scenario. IoDrvJ1939 supported scenario: 1. Receive (RX) PDU1 (P2P) destination-specific (PDU-specific < 255) to local device with matching address IoDrvJ1939 unsupported scenarios: 1. Receive (RX) PDU1 (P2P) global (PDU-specific = 255) 2. Transmit (TX) PDU1 (P2P) global (PDU-specific = 255) 3. Transmit (TX) PDU1 (P2P) destination-specific (PDU-specific < 255)
Last updated: 2024-09-23
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 bjarne-pagaard on Communication between applications on same device/controller/runtime (Win RTE 3.5.20.20)
CODESYS Forge
talk
(Post)
Thanks for this - I have now been looking in to just having an extra (non-RTE) runtime on the same machine, as you suggest. I will probably proceed this way. Even though it still seems very odd to me, that variable exchange to a different runtime is easier than between applications on the same controller. There will be some fun with the licensing, it seems. Does anyone know if it is possible to specify which license container/specific license the runtime is going to use at runtime. Let's say I have two available licenses with different resources available, for example one license allows multicore and multiple EtherCAT channels, but not many visu tags (for the RTE). Another with less resources but a lot of visu tags (for the Visu controller). Let's say the program in one of the controllers could be fully licensed by either of the two available licenses, but picks the 'largest' first. A bit later, the larger application starts, but is left with the smaller license.. How can I make sure that the 2 runtimes select the right license at startup?
Last updated: 2024-10-01
Post by breiter on Frustration-Fueled Feedback on Project File Management and Git Integration
CODESYS Forge
talk
(Post)
Hi, supporting a text based storage format is on our roadmap, see https://www.codesys.com/the-system/releases-updates-lifecycle/release-plan-roadmap.html It will be an Add-On feature called "File Based Storage" for the professional developer edition. Structured text POUs will be stored as plain text. Other graphical languages will remain in an xml format. You will be able to switch the storage type for projects. Certain workflows will become easier this way. Nevertheless restrictions will remain because of CODESYS specific storage logic (for example how methods below function blocks are stored as file). So merging using our Git Integration Add-On remains the recommended workflow. A workflow involving Visual Studio Code as the main IDE is not supported. Simply because many topics like library management, task configuration or fieldbus configurators are not available for VS Code. A PLC project is a lot more than just some ST POUs. Best Regards
Last updated: 2024-10-16
Post by smeitink on Timeout Error in Modbus Communication with WAGO PFC200 and iEM2050 Meter using 750-652 Module
CODESYS Forge
talk
(Post)
Hi all, I'm looking for help with an issue I've come across while trying to facilitate Modbus communication between a WAGO PFC200 PLC using a 750-652 communication module and an iEM2050 Series Single Phase Energy Meter. I believe to have everything wired and setup correcty, but I keep running into a "Error time out" message, and by now I don't really know what else to try. My setup is as follows: A PFC200 Wago PLC, which has 2 750-652 Serial Interfaces extension modules connected to its field bus. I'm using one of these to talk to a Schneider iEM2050 - kWh-meter over modbus. I have connected terminal 23 (A) of the iEM2050 to connector 6 (A) on the 750-652. I have connected terminal 24 (B) of the iEM2050 to connector 2 (B) of the 750-652. I'm using 200mm of twisted together wires to connected them both, and I have placed a 120 ohm resistor between A and B at both ends. I've attached relevant pinout images to this post. I then wrote a simple program that configures the Mobus port, as per the datasheet of the iEM2050. You can find an image of the relavent page attached to this post too. This is my program: PROGRAM PLC_PRG VAR Master: FbMbMasterSerial; xIsConnected: BOOL; xError: BOOL; iIndex: INT := 1; xTrigger: BOOL; utQuery : typMbQuery := ( bUnitId := 1, // The Modbus unit or slave address bFunctionCode := 4, // Function code for reading input registers uiReadAddress := 1829, // adress for the Power on off counter uiReadQuantity := 1 // Quantity of registers to read ); iStep: INT; oStatusModbus: WagoSysErrorBase.FbResult; utResponseModbus: typMbResponse; xConnect: BOOL := FALSE; delayTimer: TON; END_VAR Master( xConnect:= xConnect, I_Port:= _750_652_24_1, udiBaudrate:= 9600, usiDataBits:= 8, eParity:= WagoTypesCom.eTTYParity.Even, eStopBits:= WagoTypesCom.eTTYStopBits.One, eHandshake:= WagoTypesCom.eTTYHandshake.None, ePhysical:= WagoTypesCom.eTTYPhysicalLayer.RS485_HalfDuplex, xIsConnected=> xIsConnected, xError=> xError, oStatus=> oStatusModbus, eFrameType:= WagoAppPlcModbus.eMbFrameType.RTU, tTimeOut:= T#5S, utQuery:= utQuery, xTrigger:= xTrigger, utResponse:= utResponseModbus); delayTimer(IN := TRUE, PT := T#3S); // Use the Q output of the timer to set xConnect after the delay IF delayTimer.Q THEN xConnect := TRUE; END_IF CASE iStep OF 0: //Wacht totdat de master de poort geopend heeft IF xIsConnected THEN iStep := 1; END_IF 1: //Stuur request naar de slave xTrigger := TRUE; iStep := 2; 2: //Wacht totdat de master klaar is met het afhandelen van de request IF NOT xTrigger THEN iStep := 3; END_IF END_CASE The TON delay before opening the port is due to a an error I encountered when opening it straight away. This seems to be a bug, as described here. However, the TON solved that particular issue. I tried reading multiple registers, but like I said, I still always end up with the "Error time out". What else can I test or try at this point?
Last updated: 2024-02-24
Post by cfam on Codesys Control for PLCnext (PLC - AXL F 2152)
CODESYS Forge
talk
(Post)
Good day All I would like to share some information on this site for the Codesys team as well for the future members using Codesys Control for PLCnext if it is allowed. I hope that i Post it in the correct spot. Subject: Codesys, Codesys Control for PLCnext Objective: Using the following Phoenix components to built a PLC Rack and run it on Codesys: Hardware and Software used 1. 2404267, AXC F 2152 - Controller 2. 1088136, AXL F BP SE6 - Module carrier 3. 1088129, AXL SE DO16/1 - Digital module 4. 1337224, AXL SE PD16 GND - Potential distributors 5. 1088127, AXL SE DI16/1 - Digital module 6. 1337223, AXL SE PD16 24V - Potential distributors 7. 1088123, AXL SE AO4 I 4-20 - Analog module 8. 1088134, AXL SE SC-A - Cover 9. Codesys v3.5 SP19 Patch 4 10. Codesys Control for PLCnext V4.10.0.0 Process: Firstly I built the Rack according to the Phoenix Project+ Software tool. Where I rebuilt it onto my test bench . I used the PLCnext Engineer IDE from Phoenix and all Communications where up and running and my PLC program executed successfully. THEN I tried the same PLC Layout with Codesys and Codesys Control for PLCnext. It was not successful and gave me the "Error: Local Bus not Running". I searched the web for answers but was unsuccessful in finding a solution. So I tried to change my configuration and found that the following Modules COULD NOT be recognized by Codesys Control. The result was that the Local Bus Failed to run. 1337224, AXL SE PD16 GND - Potential distributors 1337223, AXL SE PD16 24V - Potential distributors Example 1, Resulted in "Error: Local Bus Not Running": Module carrier slot 1: 1088129, AXL SE DO16/1 - Digital module Module carrier slot 2: 1337224, AXL SE PD16 GND - Potential distributors Module carrier slot 3: 1088127, AXL SE DI16/1 - Digital module Module carrier slot 4: 1337223, AXL SE PD16 24V - Potential distributors Module carrier slot 5: 1088123, AXL SE AO4 I 4-20 - Analog module Module carrier slot 6: 1088134, AXL SE SC-A - Cover Example 2, Result "Successful": Module carrier slot 1: 1088129, AXL SE DO16/1 - Digital module Module carrier slot 2: 1088127, AXL SE DI16/1 - Digital module Module carrier slot 3: 1088123, AXL SE AO4 I 4-20 - Analog module Module carrier slot 4: 1088134, AXL SE SC-A - Cover Module carrier slot 5: 1088134, AXL SE SC-A - Cover Module carrier slot 6: 1088134, AXL SE SC-A - Cover Result: Codesys or Codesys Control for PLCnext, has a PROBLEM to identify the following Modules. 1. AXL SE PD16 24V - Potential distributors 2. AXL SE PD16 GND - Potential distributors Hope that this information could be useful in future. Best regards Jaco Pretorius
Last updated: 2023-12-06
Post by john-robinson on Limiting Memory Access of an Array to Within its Bounds
CODESYS Forge
talk
(Post)
Recently we had an issue regarding some simple code to calculate a rolling average. The code indexes from zero to 199 to properly store the current input into a circular buffer which then allows us to calculate a rolling average: VAR input_5s : REAL; outs_arr : ARRAY[0..199] OF REAL; i : USINT := 0; END_VAR ___ //this code runs every five seconds, calculating a rolling average outs_arr[i] := input_5s; i := i + 1; output := OSCAT_BASIC.ARRAY_AVG(ADR(outs_arr), SIZEOF(outs_arr)); IF i >= SIZEOF(outs_arr) THEN i := 0; END_IF There is a simple bug in this code where the index will be set to 0 when it has surpassed the length of the array in bytes (800 in this case) rather than larger than the number of reals in the array (200). The solution here is simple, replacing i >= SIZEOF(outs_arr) with i >= SIZEOF(outs_arr)/SIZEOF(outs_arr[0]). In this example when the index increased to 201 and the line outs_arr[201] := input_5s was called, codesys arbitrarily wrote to the address in memory that is where outs_arr[201] would be if the array was that long. I would like to find a way to wrap the codesys array inside of a wrapper class that checks if an input is within the bounds of an array before writing to that value. I know how I would implement that for a specific array, I could create a method or class that takes an input of an array of variable length, ie. ARRAY[*] OF REAL, but I don't know how to make this for any data type. I am wondering if anyone has ever done anything similar to this, or has any better suggestions to ensure that none of the programmers on this application accidentally create code that can arbitrarily write to other locations in memory.
Last updated: 2024-03-05
Post by umdee on Error when monitoring LAD programs
CODESYS Forge
talk
(Post)
I get the following error when monitoring my program (see attached screenshots): "Unhandled exception has occured in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately. Value cannot be null. Parameter name: source. And the details say: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ** Exception Text ** System.ArgumentNullException: Value cannot be null. Parameter name: source at System.Linq.Enumerable.Any[TSource] (IEnumerable1 source, Func2 predicate) at _3S.CoDeSys.NWLEditor.NWLTextCell.OnPaintCellLayer(PaintEventArgs e) at _3S.CoDeSys.Controls.Controls.GfxEdControl.PaintCellCellLayer(PaintEventArgs e, GfxCell cell) at _3S.CoDeSys.Controls.Controls.GfxEdControl.PaintCellCellLayer(PaintEventArgs e, GfxCell cell) at _3S.CoDeSys.Controls.Controls.GfxEdControl.PaintCellCellLayer(PaintEventArgs e, GfxCell cell) at _3S.CoDeSys.Controls.Controls.GfxEdControl.OnPaint(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.UserControl.WndProc(Message& m) at _3S.CoDeSys.Controls.Controls.GfxEdControl.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ** Loaded Assemblies ** (3000 lines of assemblies) ** JIT Debugging ** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitdebugging="true"> </system.windows.forms></configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box The windows show red X's where the networks should be. Any advice on how to fix this? Additional Information PLC used: Wago 750-8212, Firmware FW26 Startup profile: CODESYS V3.5 SP19 Patch 5 OS version: Microsoft Windows NT 10.0.22631.0 .NET version: 4.0.30319.42000 Full Version info attached as .txt
Last updated: 2024-03-17
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
.