Post by chalk on No source code available
CODESYS Forge
talk
(Post)
Hello, This is my first time using Codesys, I am trying to add EtherNetIP communication to a Raspberry PI. Iāve added the EtherNetIP Adapter configured the network setting and added some modules to the pi but when I download the project it generates the following error: āThere is no source code available for the object because it is in the compiled library ācip object, 4.5.1.0 (3s ā smart software solution gmbh)ā. Do you want to browse for the original library in order to display the source code? There are 2 errors in the log which are: SOURCEPOSITION App=[Application] area=3, offset=332760 EXCEPTION [Application] occurred: App=[Application], Task=[ENIPAdapterServiceTask] I canāt for the life of me work out how to get around this. I canāt find the source code anywhere or any information regarding this error. Iām using Codesys V3.5 SP19 Patch 3, the version of the Ethernet adapter is 4.5.1.0 and the version of the modules is 4.1.0.0. Any help on this will be greatly appreciated. Thanks
Last updated: 2024-02-02
Post by yannickasselin on Connect to remote PLC via local pc and teamviewer
CODESYS Forge
talk
(Post)
Yes it is possible. I did it a lot of times using TeamViewer VPN. Unfortunately, TeamViewer VPN only works on Windows. If the remote PLC is a Codesys runtime running on Windows, you should be able to login directly using TeamViewer VPN if it is installed on the PC/PLC. If it is not Windows based, you can still do it but you need to have a Windows based PC acting as a gateway in the middle. In this case you need to enable IP Forwarding on the Windows remote PC (the gateway) and you need to setup the gateway IP address on the PLC to be the address of the Windows PC. Then you need to add a route on your local PC to point to the gateway PC for Codesys communication. I know it may not be detailed enough but I did not want to make a whole tutorial on how to do it. Bottom line, it is possible. I do it all the time.
Last updated: 2024-02-02
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Profinet fault with codesys control V3 - Receive packet error
CODESYS Forge
talk
(Post)
I have set up a brandnew Beckhoff panel pc with a codesys control runtime V3. I configured it together with 2 profinet field devices: a 16in/16out IO module from Turck and an MTS linear encoder. The machine works fine untill all of a sudden the communication breaks and the profinet participants become unreachable. At that point I can still ping the device, but the profinet master does not find them anymore: When i do a scan they are not found. When i do a cold restart, the profinet master becomes active again and the devices are found again. In the log i get Ethercat packet receive error: sysethernet. I am a little confused, there is no ethercat device in the device tree. I already set the send clock and the reduction ratio to higher values, but without result. Can codesys be configured, so that the communication re-establishes without doing the cold reset? This is very annoying and is causing a lot of prodution losses. regards Tim
Last updated: 2024-02-27
Post by tim-roelant on Problem mit control runtime V3 und profinet
CODESYS Forge
talk
(Post)
Hallo Edwin, meinst du das der control-win nicht wie SPS verwendet werden kann? Das program ist klein, und realtime brauch ich gar nicht, Es gibt im bus einem Turck inselstation mit 16 ein und ausgange, und ein MTS linearencoder, womit wir teile messen und abschneiden. Die cycluszeit reist auch nicht aus. Processorleisung bleibt unter 20%. Es geht mir darum das der profinet master in fehler geht, und nicht mehr seine telnehmer erkannen kann. Es kan passieren nach 10 minuten, aber auch nach 5 tage. Nur ein kaltstart bringt die bus wieder am laufen. (kein reconnect mochlich, auch die bus scannen functioniert nicht mehr) Wann ich aber ein ipscan durchfure mit Angryip auf der rechner sind alle telnehmer da. Ich habe noch eine andere application mit die gleiche anwendung, aber wo ein raspberry pi die SPS rolle spielt, und das functioniert einwandfrei. Soll ich fielleicht das OS von Rechenr nach linux umrusten? Der operator ist im moment sehr unzufrieden mit die "upgrade" von maschine... :-( lg Tim
Last updated: 2024-04-11
Post by tim-roelant on Problem mit control runtime V3 und profinet
CODESYS Forge
talk
(Post)
Hallo Edwin, meinst du das der control-win nicht wie SPS verwendet werden kann? Das program ist klein, und realtime brauch ich gar nicht, Es gibt im bus einem Turck inselstation mit 16 ein und ausgange, und ein MTS linearencoder, womit wir teile messen und abschneiden. Die cycluszeit reist auch nicht aus. Processorleisung bleibt unter 20%. Es geht mir darum das der profinet master in fehler geht, und nicht mehr seine telnehmer erkannen kann. Es kan passieren nach 10 minuten, aber auch nach 5 tage. Nur ein kaltstart bringt die bus wieder am laufen. (kein reconnect mochlich, auch die bus scannen functioniert nicht mehr) Wann ich aber ein ipscan durchfure mit Angryip auf der rechner sind alle telnehmer da. Ich habe noch eine andere application mit die gleiche anwendung, aber wo ein raspberry pi die SPS rolle spielt, und das functioniert einwandfrei. Soll ich fielleicht das OS von Rechenr nach linux umrusten? Der operator ist im moment sehr unzufrieden mit die "upgrade" von maschine... :-( lg Tim
Last updated: 2024-04-11
Post by culius on JSON
CODESYS Forge
talk
(Post)
Hey guys, I am trying to write a JSON. First time after login in PLC after download everthing works. But when I want to change values during runtime and try to recreate the JSON nothing happens. When forcing the xStart as an impulse i want to recreate it and see 2 as Key3 instead of 1 from the first run. Any Idea how to make this work? PROGRAM test VAR factory : JSON.JSONDataFactory; eDataFactoryError : JSON.FBF.ERROR; pJsonData : POINTER TO JSON.JSONData := factory.Create(eError => eDataFactoryError); fb_JBuilder : JSON.JSONBuilder; wsValue : WSTRING; diRootIndex, diObject1Index : DINT; iValue : INT; jsonArrayWriter : JSON.JSONByteArrayWriter; wsJsonData : WSTRING(1000); xFirst : BOOL := TRUE; END_VAR IF xFirst THEN fb_JBuilder(pJsonData := pJsonData, diRootObj => diRootIndex); wsValue := "Value1"; fb_JBuilder.SetKeyWithValue("Key1", wsValue, diParentIndex := diRootIndex); diObject1Index := fb_JBuilder.SetKeyWithObject("Key2", diParentIndex := diRootIndex); iValue := iValue + 1 ; // -----------!!! secound run should increment key3!!!!------------ fb_JBuilder.SetKeyWithValue("Key3", iValue, diParentIndex := diObject1Index); xFirst := FALSE; END_IF jsonArrayWriter(xExecute := TRUE, pwData := ADR(wsJsonData), udiSize := SIZEOF(wsJsonData), jsonData := pJsonData^, xAsyncMode := FALSE); Kind Regards
Last updated: 2024-04-30
Post by tama00 on GPIOs not running with Raspberry Pi 4 (and SPI connection)
CODESYS Forge
talk
(Post)
Hello everyone, I have a working SPI connection (with transferExt) between a Raspberry master with Codesys and an ESP32 slave. I would also like to use a few GPIO pins. Is there a problem with using SPI AND GPIOs? Environment: Raspberry Pi 4+ with Raspian from Oct 23 Codesys V3.4 SP19 Patch 5 with Runtime Version 4.10.0.0 Device: GPIOs B+/Pi2 My problem: The status is displayed as āGPIOs : not runningā. And also during mapping the message āThe bus is not running. The values shown are perhaps not actualā. However, the variable changes that I make in my program are displayed under āCurrent Valueā. In the Logic Analyzer, the pin toggles during transmission with small intervals of +-4us (seems to be a cyclical disorder, but I don't know where exactly it could be coming from). This applies to pins that I actually use (output) but also to the other GPIOs (not used). With GPIO 4, the line remains permanently high. Attached is a screenshot from the Logic Analyzer. Channel 1,3,5 were GPIO pin 26, 22, 17 Would be very grateful for help. Best regards
Last updated: 2024-05-06
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 rmaas on Strange Behavior on Raspberry Pi
CODESYS Forge
talk
(Post)
Hello, what you are seeing is not strange behavior. The problem is that everyting is happening in the same program cycle. After the variable Stepnumber is changed from 10 to 20 for example then you want the program to wait with the next EQ until the next program cycle. Else every EQ will be be true because in every line the variable Stepnumber is increased. When the program arrives (still in the same cycle) at the line with the timer, the Stepnumber has been increased to 30 in the meantime and the timer will allway be ON because even though the variable is written to 10 in this line in the next cycle it starts with 10 and will be 30 again before reaching the timer in line 8. Not very good at explaining stuff but i hope you get the problem. See screenshot below for an example of one way you could solve this...
Last updated: 2024-06-18
Post by svenkaro on Codesyscontrol.service stoppt nach 30s
CODESYS Forge
talk
(Post)
Wie Du schon vermutet hast, es meint, die Hardware/Firmware sei nicht kompatibel ... ooops... this runtime was built for RASPBERRYPI. Hardware version or firmware version not supported! (-18, 0x00000BB8, 0xFFFFFFFB) Architecture: aarch64 Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM Model name: Cortex-A72 Model: 3 Thread(s) per core: 1 Core(s) per cluster: 4 Socket(s): - Cluster(s): 1 Stepping: r0p3 CPU(s) scaling MHz: 40% CPU max MHz: 1500.0000 CPU min MHz: 600.0000 BogoMIPS: 108.00 Flags: fp asimd evtstrm crc32 cpuid Caches (sum of all): L1d: 128 KiB (4 instances) L1i: 192 KiB (4 instances) L2: 1 MiB (1 instance) Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Vulnerable Spectre v1: Mitigation; __user pointer sanitization Spectre v2: Vulnerable Srbds: Not affected Tsx async abort: Not affected Allerdings habe ich schon reichlich Firmware versionen getestet.
Last updated: 2024-06-21
Post by ahuckphin on Issues with Modbus Slave with Raspberry Pi
CODESYS Forge
talk
(Post)
I have a DFRobot RS485 temperature & humidity sensor (SEN0438) connected to my Raspberry Pi via a USB to RS485 adapter. I am able to connect and read the sensor data when running a python code locally. However in Codesys, I encounter this error "A bus error has occurred." and "There was no response in time". Could this be because of Modbus Server Channel and Modbus Server Init configuration on my part? Admittedly I am new to Codesys. To get to this stage, I: 1. added some lines to CODESYSControl_User.cfg 2. added "Modbus_COM" in Codesys and set "Serial Port Configuration" under "General" 3. added "Modbus_Master_COM_Port" in Codesys and checked transmission mode is set to "RTU" 4. added "Modbus_Slave_COM_Port" in Codesys and checked server address is set to 1 (also set 1 in my sensor) 5. added 1 channel and 1 init for "Modbus_Slave_COM_Port" under "Modbus Server Channel" and "Modbus Server Init"
Last updated: 2024-07-10
Post by aliazzz on Unable to deploy Virtual Control SL on ARM64 (Raspberry Pi5)
CODESYS Forge
talk
(Post)
Hi, I have successfully deployed "Virtual Control SL" on a few x86/64 machines now. However, I'd now like to deploy this to a Raspberry Pi (ARM64). To do this I prepared the Raspberry Pi5 with the following prereq's; * Minimal PREEMPT Debian * Latest Bootfirmware * full SSH access via non-root account * Podman * RedHat Cockpit with CODESYS LicensServer plugin up and running However, I can't seem to resolve copying the correct (deploy) Images as they wont show up in the CODESYS IDE I have added CODESYS Virtual Control for Linux SL and the CODESYS LicenseServer for Linux SL via the CODESYS installer on my DevBox. I open CODESYS > Tools > Deploy Control SL Next I enter the SSH targets IP and Credentials and for my RPi5 and it shows "Connected". In the next tab, Deployment, the dropdown box only shows one (1) image, which also is the incorrect CPU architecture. Only Virtual Control AMDx64 shows up (!?) while I expect to see the ARM64 based images for both Edge and Control. Has someone encountered this too? I'd like to hear other people experiences with Virtual Control deployment on ARM based architecture. attachment 1: AMD64 based deployment pulldown menu (correct images) attachment 2: ARM64 based deployment pulldown menu (incorrect images) regards,
Last updated: 2024-07-28
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 ricola on ERROR: CodeMAccess2: Used CmRuntime 2.61.2705.500 is too old
CODESYS Forge
talk
(Post)
hi there , can someone tell me how to deal with this error , please? I use the Linux ARM64SL (4.11) on a bullseye distro and when I want to update or install some package, I have the following reply : pi@NanoPi-R5C:~$ sudo apt upgrade Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: ** codesyscontrol : Depends: codemeter but it is not installable or codemeter-lite but it is not installable** E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). and if I try apt --fix-broken install as suggested, I have a proposal to uninstall codesyscontrol ... :-D so I tried to search if there is some Codesys repo: nothing, then I tried to see if ther was something inside Codesys dev (V3.5.20) and I only found that by reading/requesting my device, i spoted that codemeter was too old . I don't see how to deal with this issue. is there a codemeter.deb somewhere ? thanks in advance for any help.
Last updated: 2024-09-17
Post by karel-bas on Loosing connection to emulation running on Linux
CODESYS Forge
talk
(Post)
Hello, I am trying to emulate my code but for some reason my Codesys IDE keeps loosing connection to the emulator. I am constantly pinging virtual machine on which its running and its running fine, but codesys refuses to reconect to it, and is not able to rediscover it. Codesys 3.5 SP20 Patch 1 I have linux installed like image in attachment.(using version 4.12) Linux VM is set up to use up to 4 cores and 8gb of ram, with nothing else runing on it. I dont have a license so I am aware that the emulation shouldnt run for more then 120 minutes I am able to, login, get sysinfo, reboot etc from codesys IDE for certain period of time (5minutes) then my connection gets lost, sometimes I can login again, but sometimes i have to reboot the VM. Any suggestions what might be the issue ?
Last updated: 2024-09-19
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 egau on Hard shutdown: no code on device after power on
CODESYS Forge
talk
(Post)
This explanation aligns with the issues weāre experiencing with our machines. The scenario I described is happening with one of them (letās call it Machine A). This machine is identical to another one (Machine B), except for some custom code that facilitates communication with an external Beckhoff PLC for MES integration in the production line. Machine B has been powered on and off daily for at least three months and has never had this problem. Given that, I highly doubt the MES custom code is the cause of the code corruption. This being said, your explanation does seem plausible. However, if faulty EtherCAT cables were the issue, why wouldn't the error occur during normal operation? Why would bad cables only cause problems during a hard shutdown? One last question: When you encountered this behavior, did you see a similar error in your logs? i.e, an "AccessViolation" exception in the EtherCAT Task?
Last updated: 2024-10-03
Post by andrax on CodeSys Raspberry pi I2C driver not found
CODESYS Forge
talk
(Post)
Hi, Communication with the ADS1115 is actually simple. 1. write config 2. write address pointer 3. read conversation register The ADS1115 works like a multiplexer. This means that you do this individually for each channel that you want to read. e.g: Channel 1: write config > write address pointer > read conversation register Channel 2: write config > write address pointer > read conversation register Channel 3: write config > write address pointer > read conversation register Channel 4: write config > write address pointer > read conversation register then you start again from the beginning You can also omit individual channels or read only one. It doesn't matter. I have written the driver so that I can also use it on the TCA9548. The driver is from Stefan Dreyer. In your case, the driver works and communication with the ADS1115 is running. As you can see, the cfgWrong:=FALSE If you could not write or read data, cfgWrong:=TRUE; This means that either something is wrong with your ADS1115 or you have connected something incorrectly. Question: what voltage do you want to measure?
Last updated: 2024-11-08
Post by francesco86 on Script python for write in a file Project information
CODESYS Forge
talk
(Post)
Dear all, My python script can read a Codesys project and save in file the different POU, but the problem is that I don't able to read the project info from the obj list. Following of this message there is my python script. Can you help my? Best regards Francesco # encoding:utf-8 # We enable the new python 3 print syntax from __future__ import print_function import os import shutil import time import sys from datetime import datetime print("--- Saving files in the project: ---") print("sys.argv: ", len(sys.argv), " elements:") for arg in sys.argv: print(" - ", arg) if (len(sys.argv)>1): folderExportName = sys.argv[1] print(" folderExportName: ", folderExportName) exportPath = sys.argv[2]+ sys.argv[3]+ "\\"+ sys.argv[1] print(" File path: ", exportPath) # git has_repo=False #save_folder=r'E:\Tmp\ControlPlugins\ControlPlugins\Export' save_folder = exportPath if not os.path.exists(save_folder): os.makedirs(save_folder) else: a=os.listdir(save_folder) for f in a: if not f.startswith("."): sub_path= os.path.join(save_folder,f) if os.path.isdir(sub_path): shutil.rmtree(sub_path) else: os.remove(sub_path) elif f==".git": has_repo=True info={} type_dist={ '792f2eb6-721e-4e64-ba20-bc98351056db':'pm', #property method '2db5746d-d284-4425-9f7f-2663a34b0ebc':'dut', #dut 'adb5cb65-8e1d-4a00-b70a-375ea27582f3':'lib', #lib manager 'f89f7675-27f1-46b3-8abb-b7da8e774ffd':'m', #method no ret '8ac092e5-3128-4e26-9e7e-11016c6684f2':'act', #action '6f9dac99-8de1-4efc-8465-68ac443b7d08':'pou', #pou '6654496c-404d-479a-aad2-8551054e5f1e':'itf', #interface '738bea1e-99bb-4f04-90bb-a7a567e74e3a':'', #folder 'ffbfa93a-b94d-45fc-a329-229860183b1d':'gvl', #global var '5a3b8626-d3e9-4f37-98b5-66420063d91e':'prop', #property '2bef0454-1bd3-412a-ac2c-af0f31dbc40f':'tl', #textlist '63784cbb-9ba0-45e6-9d69-babf3f040511':'gtl', #global textlist '225bfe47-7336-4dbc-9419-4105a7c831fa':'dev', #device 'ae1de277-a207-4a28-9efb-456c06bd52f3':'tc', #task configuration 'f8a58466-d7f6-439f-bbb8-d4600e41d099':'m', #method with ret '261bd6e6-249c-4232-bb6f-84c2fbeef430':'gvl', #gvl_Persistent '98a2708a-9b18-4f31-82ed-a1465b24fa2d':'task', #task '085afe48-c5d8-4ea5-ab0d-b35701fa6009':'progInfo'#project information }; def save(text,path,name,tp): if not tp: tp='' else: tp='.'+tp+'.txt' with open(os.path.join(path,name+tp),'w') as f: f.write(text.encode('utf-8')) def print_tree(treeobj, depth, path): global info #record current Path curpath=path isfolder=False t='' #text tp='' #type # get object name name = treeobj.get_name(False) id = treeobj.type.ToString() if id in type_dist: tp = type_dist[treeobj.type.ToString()] #Print all type of objects #print("--Name: ", tp) else: info[id]=name if treeobj.is_device: deviceid = treeobj.get_device_identification() t = 'type='+str(deviceid.type) +'\nid=' +str(deviceid.id) + '\nver='+ str(deviceid.version) if tp == "progInfo": print("-- There is prog info, ", tp) print("-- It has textual declaration: , ", treeobj.has_textual_declaration) print("-- It has textual implementation: , ", treeobj.has_textual_implementation) print("-- It is folder: , ", treeobj.is_folder) print("-- It is children: , ", treeobj.get_children(False)) print("-- It is children len: , ", len(treeobj.get_children(False))) print("-- It is progInfo type: , ", type(treeobj.ScriptProject)) #for child in treeobj.get_children(False): # print_tree(child, depth+1,curpath) try: if treeobj.is_folder : #system.ui.prompt('folder:'+u, PromptChoice.YesNo, PromptResult.Yes) isfolder=true pass except: pass if treeobj.has_textual_declaration : t=t+'(*#-#-#-#-#-#-#-#-#-#---Declaration---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_declaration t=t+a.text if treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---Implementation---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_implementation t=t+a.text if treeobj.has_textual_declaration and not treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---NOT Implementation visible---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' if treeobj.is_task : exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.task')) if treeobj.is_libman: exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.lib')) if treeobj.is_textlist: treeobj.export(os.path.join(curpath,name+'.tl')) children = treeobj.get_children(False) if children or isfolder: if tp: curpath=os.path.join(curpath,name+'.'+tp) else: curpath=os.path.join(curpath,name) if not os.path.exists(curpath): os.makedirs(curpath) if t: save(t,curpath,name,tp) for child in treeobj.get_children(False): print_tree(child, depth+1,curpath) for obj in projects.primary.get_children(): print_tree(obj,0,save_folder) with open(os.path.join(save_folder,'ExportInfo.txt'),'w') as f: now = datetime.now() infTimeExecution = now.strftime("%Y-%m-%d %H:%M:%S") f.write("Export date and time: "+infTimeExecution + "\r\n" + str(info)) print("--- Script finished. ---") #system.ui.info('save ok') projects.primary.close()
Last updated: 2024-04-30
Post by francesco86 on Script python for write in a file Project information
CODESYS Forge
talk
(Post)
Dear all, My python script can read a Codesys project and save in file the different POU, but the problem is that I don't able to read the project info from the obj list. Following of this message there is my python script. Can you help my? Best regards Francesco # encoding:utf-8 # We enable the new python 3 print syntax from __future__ import print_function import os import shutil import time import sys from datetime import datetime print("--- Saving files in the project: ---") print("sys.argv: ", len(sys.argv), " elements:") for arg in sys.argv: print(" - ", arg) if (len(sys.argv)>1): folderExportName = sys.argv[1] print(" folderExportName: ", folderExportName) exportPath = sys.argv[2]+ sys.argv[3]+ "\\"+ sys.argv[1] print(" File path: ", exportPath) # git has_repo=False #save_folder=r'E:\Tmp\ControlPlugins\ControlPlugins\Export' save_folder = exportPath if not os.path.exists(save_folder): os.makedirs(save_folder) else: a=os.listdir(save_folder) for f in a: if not f.startswith("."): sub_path= os.path.join(save_folder,f) if os.path.isdir(sub_path): shutil.rmtree(sub_path) else: os.remove(sub_path) elif f==".git": has_repo=True info={} type_dist={ '792f2eb6-721e-4e64-ba20-bc98351056db':'pm', #property method '2db5746d-d284-4425-9f7f-2663a34b0ebc':'dut', #dut 'adb5cb65-8e1d-4a00-b70a-375ea27582f3':'lib', #lib manager 'f89f7675-27f1-46b3-8abb-b7da8e774ffd':'m', #method no ret '8ac092e5-3128-4e26-9e7e-11016c6684f2':'act', #action '6f9dac99-8de1-4efc-8465-68ac443b7d08':'pou', #pou '6654496c-404d-479a-aad2-8551054e5f1e':'itf', #interface '738bea1e-99bb-4f04-90bb-a7a567e74e3a':'', #folder 'ffbfa93a-b94d-45fc-a329-229860183b1d':'gvl', #global var '5a3b8626-d3e9-4f37-98b5-66420063d91e':'prop', #property '2bef0454-1bd3-412a-ac2c-af0f31dbc40f':'tl', #textlist '63784cbb-9ba0-45e6-9d69-babf3f040511':'gtl', #global textlist '225bfe47-7336-4dbc-9419-4105a7c831fa':'dev', #device 'ae1de277-a207-4a28-9efb-456c06bd52f3':'tc', #task configuration 'f8a58466-d7f6-439f-bbb8-d4600e41d099':'m', #method with ret '261bd6e6-249c-4232-bb6f-84c2fbeef430':'gvl', #gvl_Persistent '98a2708a-9b18-4f31-82ed-a1465b24fa2d':'task', #task '085afe48-c5d8-4ea5-ab0d-b35701fa6009':'progInfo'#project information }; def save(text,path,name,tp): if not tp: tp='' else: tp='.'+tp+'.txt' with open(os.path.join(path,name+tp),'w') as f: f.write(text.encode('utf-8')) def print_tree(treeobj, depth, path): global info #record current Path curpath=path isfolder=False t='' #text tp='' #type # get object name name = treeobj.get_name(False) id = treeobj.type.ToString() if id in type_dist: tp = type_dist[treeobj.type.ToString()] #Print all type of objects #print("--Name: ", tp) else: info[id]=name if treeobj.is_device: deviceid = treeobj.get_device_identification() t = 'type='+str(deviceid.type) +'\nid=' +str(deviceid.id) + '\nver='+ str(deviceid.version) if tp == "progInfo": print("-- There is prog info, ", tp) print("-- It has textual declaration: , ", treeobj.has_textual_declaration) print("-- It has textual implementation: , ", treeobj.has_textual_implementation) print("-- It is folder: , ", treeobj.is_folder) print("-- It is children: , ", treeobj.get_children(False)) print("-- It is children len: , ", len(treeobj.get_children(False))) print("-- It is progInfo type: , ", type(treeobj.ScriptProject)) #for child in treeobj.get_children(False): # print_tree(child, depth+1,curpath) try: if treeobj.is_folder : #system.ui.prompt('folder:'+u, PromptChoice.YesNo, PromptResult.Yes) isfolder=true pass except: pass if treeobj.has_textual_declaration : t=t+'(*#-#-#-#-#-#-#-#-#-#---Declaration---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_declaration t=t+a.text if treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---Implementation---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' a=treeobj.textual_implementation t=t+a.text if treeobj.has_textual_declaration and not treeobj.has_textual_implementation: t=t+'(*#-#-#-#-#-#-#-#-#-#---NOT Implementation visible---#-#-#-#-#-#-#-#-#-#-#-#-#*)\r\n' if treeobj.is_task : exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.task')) if treeobj.is_libman: exports=[treeobj] projects.primary.export_native(exports,os.path.join(curpath,name+'.lib')) if treeobj.is_textlist: treeobj.export(os.path.join(curpath,name+'.tl')) children = treeobj.get_children(False) if children or isfolder: if tp: curpath=os.path.join(curpath,name+'.'+tp) else: curpath=os.path.join(curpath,name) if not os.path.exists(curpath): os.makedirs(curpath) if t: save(t,curpath,name,tp) for child in treeobj.get_children(False): print_tree(child, depth+1,curpath) for obj in projects.primary.get_children(): print_tree(obj,0,save_folder) with open(os.path.join(save_folder,'ExportInfo.txt'),'w') as f: now = datetime.now() infTimeExecution = now.strftime("%Y-%m-%d %H:%M:%S") f.write("Export date and time: "+infTimeExecution + "\r\n" + str(info)) print("--- Script finished. ---") #system.ui.info('save ok') projects.primary.close()
Last updated: 2024-04-30
Post by spiessli on Raspberry Pi 4 with Legacy Drivers and Codesys 3.5.19 Patch 4
CODESYS Forge
talk
(Post)
Hi, I wanted to use the Adafruit Hat for the Raspberry and get acquainted with Softmotion using servos for RC models. This did work great with Codesys 3.5.19 Patch 1, but with Patch 4 and 5 i get errors. I suspect changes in the SoftMotion library have broken dependencies in the legacy drivers, might that be true? Thanks for any hint, spiessli Here the error log: ------ Ćbersetzungslauf gestartet: Applikation: Device.Application ------- Code typisieren... Code erzeugen... [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0032: Typ 'Unbekannter Typ: 'ConfigGetParameterValueLREAL(pParam, 0)'' kann nicht in Typ 'LREAL' konvertiert werden [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0046: Bezeichner 'ConfigGetParameterValueLREAL' nicht definiert [FEHLER] sm3_drive_servo, 4.6.0.0 (3s - smart software solutions gmbh): GetStandardConfigParams AXIS_REF_SERVO: C0035: Programmname, Funktion oder Funktionsbausteinstanz an Stelle von 'ConfigGetParameterValueLREAL' erwartet Ćbersetzung abgeschlossen -- 15 Fehler, 0 Warnungen : Kein Download mƶglich
Last updated: 2023-12-19
Post by alexgooi on OPC-UA and other communication questions
CODESYS Forge
talk
(Post)
Dear forum, I currently have a big question mark above my head, and maybe this forum can shine some light on the situation. I recently updated to Codesys 3.15 SP19 Patch 6. And now Iām trying to setup the OPC-UA server, besides that Iām trying to connect to the controller with the Codesys V3 (Ethernet) protocol. OPC-UA I have installed the correct licenses on my controller (Runtime and communication). Iām able to connect to the controller with an OPC-UA client, and Iām able to browse the tags, so far so good. Therefore Iām assuming that the OPC-UA server is running on the controller. But now the strange part, in the device security settings I have set the communication Policy to BASCI256SHA256 ( I also have tried the other ones) and the communication mode is set to secure if possible (I also have tried all the other ones) (see picture). With these settings I would assume that I would only be able to login with a Basic256SHA256 policy with a client. But the opposite is true, I am able to login using the no policy mode and when I set it to Basic256SHA256 the client (UA-Expert) notes that this policy is not available on the server. I then check the certificates and I noted that there is no certificate for the OPC-UA server, I tried to generate one but it gave the error that the certificate has not been created by the device (See picture). To summarize I have no clue what is going on, and the controller does the opposite of what I would expect. Codesys Ethernet V3 driver I have a HMI connected to the same controller using the Ethernet V3 driver. But this will not connect. I tried all the Protocols (see picture), with and without the username and password enabled. But it will not connect, when I scan the available servers I can see the controller with the port number that I am expecting, so Iām assuming that the Codesys V3 ethernet driver is up on the controller. Does anyone can give me some direction, because the stuff that I tried doesnāt make sense to me. Thank you in advance
Last updated: 2024-04-02
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
.