Post by timvh on VisuElems.CurrentUserGroupId is not stable
CODESYS Forge
talk
(Post)
I'm not sure what you are trying to do, but getting the CurrentUserGroupID like this will not work, because there could be multiple Visualization Clients and each can have a different user that is logged in. Also when you go online with CODESYS and open an Visualization, this is counted as a client. Probably this is the reason you see it changing. What you can to is "iterate" over all clients and then see which user is logged in on which visualization Client. For this you need to add the Visu Utils library to the project and call the FbIterateClients. See https://content.helpme-codesys.com/en/libs/Visu%20Utils/4.4.0.0/VisuUtils/VisuActionUtilities/Function-Blocks/FbIterateClients.html fbClientIteration( xExecute := x_Execute, itfClientFilter := VU.Globals.AllClients, itfIterationCallback := fbIterator, xDone => x_Done, xBusy => x_Busy, xError => x_Error, eError => e_Error); The fbIterator, in the example above, should be an instance of an FB which you have created yourself and this must implement VU.IVisualizationClientIteration. For example: FUNCTION_BLOCK FB_ITERATOR IMPLEMENTS VU.IVisualizationClientIteration Then automatically the corresponding methods will be called. In the HandleClient Method, you will get an interface to the client(s) and then you can get the current user through this interface: itfClient.UserGroupId You can also get the UserName: itfClient.UserName
Last updated: 2023-11-14
Post by ragarcia on Error while using UpdateConfiguredIPSettings to change IP address
CODESYS Forge
talk
(Post)
Hello everyone, I am trying to change dynamically by code the IP address of a Weidmuller controller. So I am basically using IoDrvEthernet library to use UpdateConfiguredIPSettings function but I am getting constantly the 'INVALID_STATE' error. Even though I am following a procedure it should work: * First I added on the config file of codesys the following: [SysSocket] Adapter.0.Name="eth0" Adapter.0.EnableSetIpAndMask=1 Adapter.1.Name="eth1" Adapter.1.EnableSetIpAndMask=1 * Secondly I am first disabling the ethernet interface by using Ethernet_0.Enable = FALSE and then executing DED.Reconfigure. After that, I run the Ethernet_1.updateConfiguredIPSettings Code: Ethernet_1.Enable:= EnableDisable; Reconfigure(xExecute:= TRUE, itfNode:= Ethernet_1, xError=> ErrorReconfigure, eError=> ErrorCodeReconfigure); IF Reconfigure.xDone THEN ErrorCodeIP:= Ethernet_1.UpdateConfiguredIPSettings(IPAddress:= newIP, SubnetMask:= newMask, Gateway:= newGW); END_IF IF Reconfigure.xDone OR Reconfigure.xError THEN Reconfigure(xExecute:= FALSE); END_IF Ethernet_1.Enable:= TRUE; Reconfigure(xExecute:= TRUE, itfNode:= Ethernet_1); IF Reconfigure.xDone OR Reconfigure.xError THEN Reconfigure(xExecute:= FALSE); END_IF Can someone help me? Thank you. All I am trying is to find a way to change dynamically with code, the IP addresses of my controller (2 ethernet ports).
Last updated: 2023-12-11
Post by forest on SM Drive license error
CODESYS Forge
talk
(Post)
Hi, when it comes about license, I used INVTmatic Studio, which uses Codesys, for programming INVT plc. I bought Codesys Modbus license, it was not expensive, and then realised that INVT didn't have License Manager option (greyed out in program) which is needed for using of Codesys License. I contacted support from INVT, but developers told me that option is still not available. So depending on environment for programming Codesys, you can or not use Modbus license. Good thing about this version of Modbus TCP it works both direction. I could send commands and receive feedbacks from drive. But communication stops after 30 mins. So I used simple version of ethernet modbus which is somewhere in INVT or Condesys library (I can check tomorrow) which works only one way. I could send cmd to drive, and control it, but didn't have any feedback, like some readings back in PLC. which is bad, but at least I could start it and it didn't fail after 30 mins.
Last updated: 2024-01-10
Post by levih on DocScripting
CODESYS Forge
talk
(Post)
Hello I'm trying to use the DocScripting collection in Codesys. I've made it work on one PC(1) for the 3.5.16.4 version of the script collection. But when I try the same setup on another PC(2), I get an error message: Error loading Python DLL: D:\SCRIPTING\3.5.16.40\python27.dll (error code 14001) My setup on both PC's is thus: 1. Downloaded and installed Python 2. Copied the folder with the scripting collection to C: (because of admin rights) 3. Placed my .library file in the same folder as the scripting collection Only difference is that Python is v3.12.0 on PC1 and v3.12.1 on PC2. I thought maybe it was something with Python, but then I have tried using the scripting collection from 3.5.16.1, and that seems to work. Just not for scripting collection 3.5.16.4. I also can't seem to find any scripting collections on newer versions of Codesys? (e.g. 3.5.19.10) Thanks in advance!
Last updated: 2024-01-22
Post by mondinmr on Direct Pointers in IOMapping for EtherCAT with IoDrvEthercatLib.ETCSlave_Dia
CODESYS Forge
talk
(Post)
Using SDO, I can read the EtherCAT mappings and offsets from various registers like 0x1c12, 0x1c13, etc. When I obtain registers mapped in the PDOs and various offsets, I could technically access directly to the statusword, controlword, etc., if they are mapped. I have noticed that on IoDrvEthercatLib.ETCSlave_Diag I can find pointers to the input and output buffers. However, although the input buffer can be easily read by referring to what has been obtained from the SDOs, it is not possible to write to the output buffer, as it is overwritten in each cycle by the data from the IOMapping task. Is there a way, knowing an instance of IoDrvEthercatLib.ETCSlave_Diag, to obtain the pointer to the first data in the IOMapping? The offsets are identical to those of the PDOs, but obviously the data is a copy. For me, the cleanest thing would be to access the pointers on IOMapping, for DS402a devices to retrieve the key data and point them to internal references. I need to know this as, having developed our own motion library, I would like to simplify the initial setup by eliminating unnecessary and nonsensical mappings that can lead users to unnecessary errors. In the current version that we have been using for years, we have to map everything manually. I would like to pass only the slave reference to the FB_init constructors and eliminate the mapping.
Last updated: 2024-02-12
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 sanacfu on looking for v2.3 libraries on v3.5.19
CODESYS Forge
talk
(Post)
Hi all, I'm new to Codesys and Wago but well versed in Rockwell. I've been tasked with upgrading old Wago 750-880 PLCs that run Codesys v2.3. All I was giving is the original PLC program in v2.3 and the currently running machine. I've spec out to what I believe is a suitable upgrade, the PFC100 2ndGen, 750-8111. As I'm rewriting this code on the Codesys I can't find the same library functions blocks for ethernet settings PLC functions. Currently I'm working on code to get/set the PLC ethernet IP address and HMI IP addresses from the HMI screen. One other function I'm looking for is a warm reset function to the PLC. When googling for this stuff I see a lot of code not in ladder logic. Are these functions now not available to implement in ladder logic? Where can I get more information on finding and implementing this functions? Do I have to buy a license from Codesys to use these functions? The PLC I ordered should be arriving in 2-3 weeks.
Last updated: 2024-03-25
Post by squiggleypuff on Can't Add New Version of Modbus TCP Master
CODESYS Forge
talk
(Post)
I'm having a tough time trying to get Modbus working on a Festo CPX-E PLC; it throws these pre-compiler errors as soon as I add in my Modbus TCP Master 3.5.12.30 to my project: I'm confused about the C0046 error, as I have IODrvModbusTCP 4.3.0.0 Library installed. So I thought maybe I needed to use the newest Modbus TCP Master 4.3.0.0, which is in my device repository: However, whenever I go to add this underneath the Ethernet adapter (which is version 4.2.0.0), the only TCP Master version available is the old 3.5.12.30 one, even if I have Display all versions checked.: I even went so far as to delete the old version, but then there were no options to add a Modbus TCP Master under my Ethernet adapter. What needs to be done to use the newest Modbus TCP Master? Or are these pre-compiler errors unrelated and I'm missing something? Any help greatly appreciated.
Last updated: 2024-04-04
Post by salvadegianluca on How to use TON inside an FB that is instanced within a Visu page
CODESYS Forge
talk
(Post)
Hi everyone; I'm building a project in which the drag of the mouse over some controls (or the click event) changes the background color of the control items; this change of color is made with an FB that assignes a color code to the background with MUX command based on the value of an enumerator, this part is perfectly working but, when I'm using a touchpanel instead of a web visu (controlled by a mouse) I get into some issues as it seems that the touch operations are not triggering the MouseEnter and MouseLeave properties as it's done with the mouse.... For this reason I'm trying to add a TON to my FB and, if the enum that changes color remains at the same state for more then 3s I'm automatically resetting it to it's "0" so the item gets back the not selected color. Anyhow it looks like the TON function from library is not working in these FB that are instanced in the various visualizations, as instead they do if I create some instances within the POUS. Anyone has ideas of how to make them work?
Last updated: 2024-04-15
Post by salvadegianluca on How to use TON inside an FB that is instanced within a Visu page
CODESYS Forge
talk
(Post)
Hi everyone; I'm building a project in which the drag of the mouse over some controls (or the click event) changes the background color of the control items; this change of color is made with an FB that assignes a color code to the background with MUX command based on the value of an enumerator, this part is perfectly working but, when I'm using a touchpanel instead of a web visu (controlled by a mouse) I get into some issues as it seems that the touch operations are not triggering the MouseEnter and MouseLeave properties as it's done with the mouse.... For this reason I'm trying to add a TON to my FB and, if the enum that changes color remains at the same state for more then 3s I'm automatically resetting it to it's "0" so the item gets back the not selected color. Anyhow it looks like the TON function from library is not working in these FB that are instanced in the various visualizations, as instead they do if I create some instances within the POUS. Anyone has ideas of how to make them work?
Last updated: 2024-04-15
Post by rabaggett on Reading Named Pipes in Linux Is there a better way?
CODESYS Forge
talk
(Post)
I have a Python program that will handle things in my application such as VISA over IP and Telnet control of instruments. I want the main control and HMI in Codesys. My problem is communication between the two. I have looked at several ways to accomplish this, and settled on having the Python program create two named pipes, one to send information to Codesys, and one for Codesys to send information to Python. The information would be packetized with \n for end of packet.. Seems simple. I think the named pipes method should work, but file reading in Codesys using the CAA file library starts to get difficult when the file is never ending, as in this case. Before I spend too much time making something that may be fundamentally flawed I want to ask. Is there a better way? Is there a way to read the file 'one line at a time' which might solve my never ending file problem? Thanks!
Last updated: 2024-05-09
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 to-ke on Errors with VisuUserManagement library
CODESYS Forge
talk
(Post)
Hallo zusammen, hi all, ich habe den gleichen Fehler. Auf einem Raspberry Pi geht der Fehler weg, wenn ich alles bereinige und dann vollständig übersetze. Wenn das Projekt im Codesys Development System wieder neu geladen wird ist der Fehler aber wieder da. Mit eine Win V3 x64 PLC kann ich den Fehler nur unterbinden wenn ich auf der HMI das VUM_Login einbinde. Dieses brauche ich aber nicht, da ich die HMI für das User Management selbst gestaltet habe. Das funktioniert auch. I have the same error. On a Raspberry Pi the error goes away if I clean everything and then compile completely. When the project is reloaded in the Codesys Development System, the error returns. With a Win V3 x64 PLC I can only prevent the error if I integrate the VUM_Login on the HMI. But I don't need this because I designed the HMI for user management myself. That works too. Anyone have an idea to fix this problem. Many thanks
Last updated: 2024-07-09
Post by fless on Von SNMP auf IIoT wechseln
CODESYS Forge
talk
(Post)
Hallo, 1. Willkommen :-) 2. Da hast schon etwas worauf du aufbauen kannst. 3. Da gibt es von WAGO Hilfen wie man Projekte zu Codesys 3.5 migriert. 4. Mit SNMP habe ich keine Erfahrung, kann dir leider nicht weiterhelfen. 5. WAGO hat eine eigene SNMP Implementierung. Ich vermute WAGO entwickelt diese Libary nicht mehr parallel weiter, deshalb die Aussage des Supports. Die Codesys SNMP lib ist in das Paket IoT gepackt worden. Die Library kannst du ganz normal einbinden wenn du die IoT Lizenz für das Gerät gekauft hast . Hilfe findest du hier Wenn du keine Lizenz hast sollte die Lib einen gewissen Zeitraum, iirc 30 Minuten, ohne Einschränkungen im Demomodus laufen. Zu den Detailfragen, das ist eine WAGO Libary da wirst du hier nur mit viel Glück Hilfe finden. Ich würde für ein Retrofit auf die Version von Codesys wechseln, dann bist du auch nicht mehr abhängig vom Hersteller. Grüße
Last updated: 2024-08-21
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 julianramirez on ModbusFB write update
CODESYS Forge
talk
(Post)
Hello everyone, I am testing the ModbusFB library tcp server and so far I am able to create holding registers successfully, however, I am trying to identify after each write which registers got updated (i.e. function code, write value). I can even see the var udiNumWriteRequests, which increases with every write. I noticed that there is logging with the LogStatusInfo method. After I call it I am able to read in the console stuff that I want. Nevertheless, this is only available at the logs and is not easy to decode because it consists on several messages, I would like to know if there is a way for me to retrieve this information from the function itself with pointers or if there is any way to copy the logs messages (assuming that I can filter them with the LoggingOptions to only show what I need) inside the runtime code and not in the console. Thanks for your help :)
Last updated: 2024-09-16
Post by salvadegianluca on List files in a directory with SysDiropen And SysDirRead
CODESYS Forge
talk
(Post)
Good morning; I'm facing an issue that seems being caused by the library itself. I'm trying to create the list of all the files that are stored inside a psecific directory. Unluckily the first file is allways hidden. VAR CONSTANT arysEmptyArray:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING := [(iArrayMAXDimension - iArrayMinDimension)('')]; iArrayMinDimension:INT := 1; iArrayMAXDimension:INT := 99; END_VAR VAR_INPUT sDirectoryToInspect:STRING; sSearchFilter:STRING; END_VAR VAR_IN_OUT xCheckFileInsideDirectory:BOOL; END_VAR VAR arysListOfFoundFiles:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING; sNullString:STRING; iNullIndex:INT := 0; libInfoAboutThePath:DirInfo; libResultOfThePathMonitoring:CmpErrors.RTS_IEC_RESULT; libInstanceToMonitorThePath:CmpErrors.RTS_IEC_HANDLE; sEntityToSearch:STRING; dMaxEntityDimension:DINT := SIZEOF(sEntityToSearch); libFileInfo:DirInfo; sFilteredFileName:STRING; iIndexToScrollArrays:INT; END_VAR IF xCheckFileInsideDirectory THEN arysListOfFoundFiles:=arysEmptyArray; iIndexToScrollArrays:=iArrayMinDimension; libInstanceToMonitorThePath:= SysDirOpen(szDir:= sDirectoryToInspect,szDirEntry:=sNullString,diMaxDirEntry:= iNullIndex,pDirInfo:= ADR(libInfoAboutThePath),pResult:= ADR(libResultOfThePathMonitoring)); WHILE libResultOfThePathMonitoring = Errors.ERR_OK AND iIndexToScrollArrays <= iArrayMAXDimension DO sEntityToSearch:= ''; libResultOfThePathMonitoring:=SysDirRead(hDir:=libInstanceToMonitorThePath,szDirEntry:=sEntityToSearch,diMaxDirEntry:=dMaxEntityDimension,pDirInfo:=ADR(libFileInfo)); sFilteredFileName:= FUN_06_00_FindItemInString_0(sFilter:=sSearchFilter,sSource:=sEntityToSearch); IF sFilteredFileName <> '' THEN arysListOfFoundFiles[iIndexToScrollArrays]:=sFilteredFileName; iIndexToScrollArrays:=iIndexToScrollArrays + 1; END_IF IF libResultOfThePathMonitoring <> Errors.ERR_OK THEN libResultOfThePathMonitoring:= Errors.ERR_OK; END_IF END_WHILE libResultOfThePathMonitoring:=SysDirClose(hDir:= libInstanceToMonitorThePath); xCheckFileInsideDirectory:=FALSE; END_IF How is possible to solve this issue? Any known work around?
Last updated: 2024-09-17
Post by salvadegianluca on List files in a directory with SysDiropen And SysDirRead
CODESYS Forge
talk
(Post)
Good morning; I'm facing an issue that seems being caused by the library itself. I'm trying to create the list of all the files that are stored inside a psecific directory. Unluckily the first file is allways hidden. VAR CONSTANT arysEmptyArray:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING := [(iArrayMAXDimension - iArrayMinDimension)('')]; iArrayMinDimension:INT := 1; iArrayMAXDimension:INT := 99; END_VAR VAR_INPUT sDirectoryToInspect:STRING; sSearchFilter:STRING; END_VAR VAR_IN_OUT xCheckFileInsideDirectory:BOOL; END_VAR VAR arysListOfFoundFiles:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING; sNullString:STRING; iNullIndex:INT := 0; libInfoAboutThePath:DirInfo; libResultOfThePathMonitoring:CmpErrors.RTS_IEC_RESULT; libInstanceToMonitorThePath:CmpErrors.RTS_IEC_HANDLE; sEntityToSearch:STRING; dMaxEntityDimension:DINT := SIZEOF(sEntityToSearch); libFileInfo:DirInfo; sFilteredFileName:STRING; iIndexToScrollArrays:INT; END_VAR IF xCheckFileInsideDirectory THEN arysListOfFoundFiles:=arysEmptyArray; iIndexToScrollArrays:=iArrayMinDimension; libInstanceToMonitorThePath:= SysDirOpen(szDir:= sDirectoryToInspect,szDirEntry:=sNullString,diMaxDirEntry:= iNullIndex,pDirInfo:= ADR(libInfoAboutThePath),pResult:= ADR(libResultOfThePathMonitoring)); WHILE libResultOfThePathMonitoring = Errors.ERR_OK AND iIndexToScrollArrays <= iArrayMAXDimension DO sEntityToSearch:= ''; libResultOfThePathMonitoring:=SysDirRead(hDir:=libInstanceToMonitorThePath,szDirEntry:=sEntityToSearch,diMaxDirEntry:=dMaxEntityDimension,pDirInfo:=ADR(libFileInfo)); sFilteredFileName:= FUN_06_00_FindItemInString_0(sFilter:=sSearchFilter,sSource:=sEntityToSearch); IF sFilteredFileName <> '' THEN arysListOfFoundFiles[iIndexToScrollArrays]:=sFilteredFileName; iIndexToScrollArrays:=iIndexToScrollArrays + 1; END_IF IF libResultOfThePathMonitoring <> Errors.ERR_OK THEN libResultOfThePathMonitoring:= Errors.ERR_OK; END_IF END_WHILE libResultOfThePathMonitoring:=SysDirClose(hDir:= libInstanceToMonitorThePath); xCheckFileInsideDirectory:=FALSE; END_IF How is possible to solve this issue? Any known work around?
Last updated: 2024-09-17
Post by salvadegianluca on List files in a directory with SysDiropen And SysDirRead
CODESYS Forge
talk
(Post)
Good morning; I'm facing an issue that seems being caused by the library itself. I'm trying to create the list of all the files that are stored inside a psecific directory. Unluckily the first file is allways hidden. VAR CONSTANT arysEmptyArray:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING := [(iArrayMAXDimension - iArrayMinDimension)('')]; iArrayMinDimension:INT := 1; iArrayMAXDimension:INT := 99; END_VAR VAR_INPUT sDirectoryToInspect:STRING; sSearchFilter:STRING; END_VAR VAR_IN_OUT xCheckFileInsideDirectory:BOOL; END_VAR VAR arysListOfFoundFiles:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING; sNullString:STRING; iNullIndex:INT := 0; libInfoAboutThePath:DirInfo; libResultOfThePathMonitoring:CmpErrors.RTS_IEC_RESULT; libInstanceToMonitorThePath:CmpErrors.RTS_IEC_HANDLE; sEntityToSearch:STRING; dMaxEntityDimension:DINT := SIZEOF(sEntityToSearch); libFileInfo:DirInfo; sFilteredFileName:STRING; iIndexToScrollArrays:INT; END_VAR IF xCheckFileInsideDirectory THEN arysListOfFoundFiles:=arysEmptyArray; iIndexToScrollArrays:=iArrayMinDimension; libInstanceToMonitorThePath:= SysDirOpen(szDir:= sDirectoryToInspect,szDirEntry:=sNullString,diMaxDirEntry:= iNullIndex,pDirInfo:= ADR(libInfoAboutThePath),pResult:= ADR(libResultOfThePathMonitoring)); WHILE libResultOfThePathMonitoring = Errors.ERR_OK AND iIndexToScrollArrays <= iArrayMAXDimension DO sEntityToSearch:= ''; libResultOfThePathMonitoring:=SysDirRead(hDir:=libInstanceToMonitorThePath,szDirEntry:=sEntityToSearch,diMaxDirEntry:=dMaxEntityDimension,pDirInfo:=ADR(libFileInfo)); sFilteredFileName:= FUN_06_00_FindItemInString_0(sFilter:=sSearchFilter,sSource:=sEntityToSearch); IF sFilteredFileName <> '' THEN arysListOfFoundFiles[iIndexToScrollArrays]:=sFilteredFileName; iIndexToScrollArrays:=iIndexToScrollArrays + 1; END_IF IF libResultOfThePathMonitoring <> Errors.ERR_OK THEN libResultOfThePathMonitoring:= Errors.ERR_OK; END_IF END_WHILE libResultOfThePathMonitoring:=SysDirClose(hDir:= libInstanceToMonitorThePath); xCheckFileInsideDirectory:=FALSE; END_IF How is possible to solve this issue? Any known work around?
Last updated: 2024-09-17
Post by salvadegianluca on List files in a directory with SysDiropen And SysDirRead
CODESYS Forge
talk
(Post)
Good morning; I'm facing an issue that seems being caused by the library itself. I'm trying to create the list of all the files that are stored inside a psecific directory. Unluckily the first file is allways hidden. VAR CONSTANT arysEmptyArray:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING := [(iArrayMAXDimension - iArrayMinDimension)('')]; iArrayMinDimension:INT := 1; iArrayMAXDimension:INT := 99; END_VAR VAR_INPUT sDirectoryToInspect:STRING; sSearchFilter:STRING; END_VAR VAR_IN_OUT xCheckFileInsideDirectory:BOOL; END_VAR VAR arysListOfFoundFiles:ARRAY[iArrayMinDimension..iArrayMAXDimension] OF STRING; sNullString:STRING; iNullIndex:INT := 0; libInfoAboutThePath:DirInfo; libResultOfThePathMonitoring:CmpErrors.RTS_IEC_RESULT; libInstanceToMonitorThePath:CmpErrors.RTS_IEC_HANDLE; sEntityToSearch:STRING; dMaxEntityDimension:DINT := SIZEOF(sEntityToSearch); libFileInfo:DirInfo; sFilteredFileName:STRING; iIndexToScrollArrays:INT; END_VAR IF xCheckFileInsideDirectory THEN arysListOfFoundFiles:=arysEmptyArray; iIndexToScrollArrays:=iArrayMinDimension; libInstanceToMonitorThePath:= SysDirOpen(szDir:= sDirectoryToInspect,szDirEntry:=sNullString,diMaxDirEntry:= iNullIndex,pDirInfo:= ADR(libInfoAboutThePath),pResult:= ADR(libResultOfThePathMonitoring)); WHILE libResultOfThePathMonitoring = Errors.ERR_OK AND iIndexToScrollArrays <= iArrayMAXDimension DO sEntityToSearch:= ''; libResultOfThePathMonitoring:=SysDirRead(hDir:=libInstanceToMonitorThePath,szDirEntry:=sEntityToSearch,diMaxDirEntry:=dMaxEntityDimension,pDirInfo:=ADR(libFileInfo)); sFilteredFileName:= FUN_06_00_FindItemInString_0(sFilter:=sSearchFilter,sSource:=sEntityToSearch); IF sFilteredFileName <> '' THEN arysListOfFoundFiles[iIndexToScrollArrays]:=sFilteredFileName; iIndexToScrollArrays:=iIndexToScrollArrays + 1; END_IF IF libResultOfThePathMonitoring <> Errors.ERR_OK THEN libResultOfThePathMonitoring:= Errors.ERR_OK; END_IF END_WHILE libResultOfThePathMonitoring:=SysDirClose(hDir:= libInstanceToMonitorThePath); xCheckFileInsideDirectory:=FALSE; END_IF How is possible to solve this issue? Any known work around?
Last updated: 2024-09-17
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 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 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 r-niedermayer on OPC UA subscriber not operational
CODESYS Forge
talk
(Post)
Hi. As far as projects in "old version"s are concerned, these can be upgraded to newer versions at any time. To do this, the device must be updated accordingly and the copilers and library versions must be adapted. You can find instructions on how to proceed in the online help/FAQ: https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_changing_compiler_version.html https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_cmd_update_device.html See also 4.3.22.4 "How to open an Example Project" within the following pdf for more details on the single steps: https://forge.codesys.com/lib/counit/tickets/_discuss/thread/3e991befbc/ca97/attachment/Public%20FAQ-v13-20240610_075228.pdf Regaring your OPCUA connection state always showing just "DISABLED", without knowing both sides of the assembly in detail, one can only approach the problem theoretically. We can give a chekclist on how to proceed: Fist, please recheck the communication settings in the OPC UA connection function block to ensure that the server URL, endpoint URL, and other settings are correct and match the configuration of the OPC UA server. Verify that the OPC UA server is running and accessible. -You can try to connect to the OPC UA server using a separate client, such as UAExpert, to ensure that the issue is not related to the OPC UA server itself. Test the security settings in the OPC UA connection function block to ensure that the correct security policy and certificate are selected. If you are using a dynamic connection to the OPC UA server, probe that the connection settings are correctly configured and that the OPC UA client is able to establish a connection to the OPC UA server. Also, please loock into the log files for any errors related to the OPC UA connection function block, these should be listet there. The log files may also provide additional information about the issue and help you to further troubleshoot the problem. FYI - Please see https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_obj_data_source_communication_opc_ua_server.html: Her you can finde the Communication settings via OPC UA Server -> layout Browse Live Server: The client connects to the server and detects the existing variables and types. From Information Model The client reads the data structure (layout) of the OPC UA Server from the information model set here and as a result receives the information about available variables and types. A connection to the server is not required. The list contains the information models installed in the OPC UA Information Model Repository. "Read Connection" Settings from IEC Variable (option set): - The connection settings used by the device are not read here from the dialog, but at runtime from the IEC variable specified here. - For this possibility, please see the Using a Dynamic Connection to an OPC UA Server (https://content.helpme-codesys.com/en/CODESYS%20Communication/_comm_use_dynamic_opc_ua_server_comm_settings.html) The settings for the communication of a Client-data source to an OPC UA Server can also be dynamically configured from the IEC code and can also be changed at runtime. For such a purpose, a structure is available in the DatasourceOpcUAServer library (For a description of the OPC UA Server, there is one included in the standard installation of CODESYS, https://content.helpme-codesys.com/en/CODESYS%20Communication/_cds_encrypt_communication_data_sources_opc_ua_client.html)
Last updated: 2024-11-04
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
.