Jump to content

Marco G

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by Marco G

  1. Awesome, thanks! This i can work with. I will ask my collegues to see what they prefer, but i think that we'll be going for the save and then write way.
  2. Hello, Sure. I changed a couple of things and removed some specific forms for privacy reasons. but here it is. The saving functions are in the homescreens, the 2 buttons to the right. Right now im working with the save as xml button(the left one of the two). Code is a bit messy, but it is still a work in progress. I usually clean up the code after i'm done and leave the old code or info in commented lines so i can refer to it if something screws up. Edit: Filesize of total project is 1406 kb. So too much for the forum. The solution file is 1 kb, so i don't think you can work from only that file.
  3. Update: Imported the data tables dll(thought i already did this but nope.) and now i stil lget the same error but it wants to gnerate a method stub for me: Private Sub SaveToUDT(ByVal p1 As String) Throw New NotImplementedException End Sub
  4. Ah thanks That solved part of the problem. So i need to declare a function where the datatable will be saved to the pc and then call that function inside the part where the user actually presses Save? I loaded the Unitronics COM driver dll but that doesnt help recognize the SaveToUDT.
  5. No, i took it from the documentation. But in there it uses public void. If i use it in front of the savetoudt part, i get the the error "End of statement expected" after the void.
  6. Thanks, Right now i got this: first saving the UDT to the pc Then uploading it to the plc. Dim fileContent As Byte() fileContent = System.IO.File.ReadAllBytes("c:\Voerkar\" & sDateTimePicker & ".udt") SaveToUDT("C:\Voerkar\", sDateTimePicker, dtverzenden) plc.SD.WriteFile(Sdfolder.EXCEL_EXCEL1, sDateTimePicker & ".udt", fileContent, Nothing) The savetoUDT is a C code i believe, and the dll documentation i have isn't saying anything about how it works in .net. I know(or atleast i think) i need the change the public void to a DIM, but as i need to declare it, can you help me further?
  7. Hello, Thanks. So with the null i need to declare what it should do? VB2010 sees the null as a byte and wants to change it to dbnull.value which doesn't work.
  8. Ah okay. Thanks. Hmm, It looks like it's quite easy to save to UDT then as wel isn't it? Something like Public Void SaveToUDT(Sdfolder.EXCEL_EXCEL1, sDateTimePicker, dtverzenden) ? dtverzenden is the datatable that contains the data that needs to be send to the plc. DatetimePicker contains the value used for the filename(so for example 10-10-1730 to indicate that it should be executed at 10 october at 30 minutes past 5. ) That way it's 2 flys in 1 hit(dutch proverb) because then it will save it on the plc's SD card and as the recommended UDT file.
  9. 1 more question: Right now i got this code: plc.SD.WriteFile(Sdfolder.EXCEL_EXCEL1, sDateTimePicker & ".xml", null) I want to transfer the xml file to that folder on the sdCard. However, i notice that writefile can only write 1 byte? (my collegue is working on something to let the plc read .xml file's, if he doesnt succeed i'll try .udt.)
  10. Thanks, Will dig into the SD Card Explorer sample. Will let you know the result but it may take a while as the solution files are not compatible with my Visual Express 2010 so i'm downloading VS 2013 first.
  11. Thanks, i already looked into the driver documentation, but couldn't really find a answer there. This is my current code: Dim sSelectedIP As String = cbPLCnaam.SelectedValue Dim sDateTimePicker As String = DateTimePicker1.Text Dim sCompleteDirectory As String = sSelectedIP & "\Secure Digital-opslagapparaat\EXCELL" 'oud: Dim sCompleteDirectory As String = "C:\" & sSelectedIP & "\SDCard" slaat op in C:\"ipadres"\SDCard 'Het feitelijke opslaan als xml ds.Tables.Add(dtverzenden) ds.Tables(0).TableName = "verzenden" ds.WriteXml(sCompleteDirectory & "\" & sDateTimePicker & ".xml" As you can see, right now it writes to xml. according to our PLC programmer thats no problem, he has a method of reading it into the program. For the writefile i reckon i need this: plc.SD.Writefile(SdFolder.EXCEL_EXCEL1, sDateTimePicker &".xml", null); Where does the SdFolder and null come from and how can i make sure it writes the contents of the ds "verzenden" ? I tried some things like plc.SD.Writexml but that (ofcourse) doesn't work.
  12. Oh, and no, i dont want to use the Card reader software you made. I want it to be as userfriendly as possible. (meaning the less steps the better)
  13. Yeah.. That's not what i want.. I have a file that needs to be written to the sdcard. Because the software needs to be flexible i have to use the ipadres as part of the saving path. 9so for example: 192.168.1.16\SDcard\Excel. For me that's the easiest way. The ip adres is selected by the user from a dropdown menu. If i need to use the .net driver, how could i do that? I didn't find anything in the documentation.
  14. Small kick, cause i'm investigating the same issue, but then with the use of .net from a pc to a networked plc.
  15. Typed a long text but pressed the wrong button. Anyways, i have found out that in the DLL zip there's a example programm wich looks like it does what i want. Only it writes directly to the plc for as far as i can see. (writes to operands) I figure that if i have the same, but then in a way that writes it to the datatable my problems will be solved. I think that the PLC can read the datatable to chech if there's any row with a date/time that correspondents to his internal clock. It collects all the corresponding rows and then execute it. So: Datatable with rows: Datetime(+id?), location, weight, location where the mix has to go. PLC checks the date, sees 5 rows with a corresponding date, gets the weight from each location(5 kg of hay, 10 kg of grass for example) and then brings it to the location where the mix has to go.
  16. Also, the data i want to write to the PLC is small. It's only the weight per foodlocation and the location where the mix has to go to. So that's 3 fields. 4 if you include date/time. However, i'm not sure if it works when you write it directly to the operands due to the scheduling.
  17. Hello, Thanks I havn't looked into your example yet, but reading your previous post i get the feeling that it's too complicated for the end users. That the Save as XML part is only to save to the PC wasn't very clear to me. Thanks for making that clear. The .net datatables work well when used to save as xml or .csv. Basically, what i'm trying to accomplish is having a piece of software where someone can enter some food data, add diets and then calculate how much of each foodtype is needed for a diet. Then he(or she) can set a location where the foodmix has to go to and a execution date/time(on wich time does the diet has to be mixed and send to the location). I'm still working on the PLC part, but i wanted to have the pc software either send the data to the plc or let the plc check for new files(so date/time in filename). The PLC has to execute the orders at the right time, so when using the first method i think the date/time needs to be saved in the datatable, while in the second method it has to be used as filename. I want to have to use as little additional software as possible to make the software as userfriendly as possible.
  18. Ah yes, i saw that. This is part of my current code: Dim ds As New DataSet dtverzenden = New DataTable() dtverzenden.Columns.Add(New DataColumn("Voerlocatie", Type.GetType("System.String"))) dtverzenden.Columns.Add(New DataColumn("Gewicht", Type.GetType("System.String"))) dtverzenden.Columns.Add(New DataColumn("Voerbak", Type.GetType("System.String"))) 'was Int32 m.u.v. Voerlocatie, die was al string. bij Int32: cannot convert to int32 datatype fillRows(lblVoerzend.Text, lblzendgewicht.Text, lblvoerbaknr.Text) If lblzendgewicht1.Text <> "" Then fillRows(lblvoerzend1.Text, lblzendgewicht1.Text, lblvoerbaknr.Text) If lblzendgewicht2.Text <> "" Then fillRows(lblVoerzend2.Text, lblzendgewicht2.Text, lblvoerbaknr.Text) If lblzendgewicht3.Text <> "" Then ds.Tables.Add(dtverzenden) ds.Tables(0).TableName = "verzenden" ds.WriteXml("C:\Verzendenxml.xml") MsgBox("Done") It needs to have some data that occurs only one time(execution date/time and location) but i got that already figured out. If i understand correctly, for the saving part i have to use: public void SaveToUDT(string filePath, int datetime) (where datetime is a time and date specified by the user in a datetimepicker, will be saved as first colomn in the datatable) public void SaveToUDT(string filePath, string verzenden) For the filepath: do i have to specify that it is a .udt? (so SD/filename.udt) Co-workers say that it is possible for the PLC to read from CSV or XML, but i don't want to have to find out the hard way if it isn't so i'm working on building a save to .udt button right now. It's easier to delete 1 or 2 buttons then to add buttons + code
  19. Hello, i found the manual while looking for more information about this subject. Title is "Unitronics Data Tables DLL" . Unfortunatly, i am still looking at how to save as .udt.
  20. Hello, small kick I was looking trough the Data Tables DLL manual where i saw that it is possible to open and save a .XML file. Doesn´t this imply that it is possible for the plc to read/write to one as well?
  21. Also, i found out that there are .net drivers availible, but it looks like they don't do what i want. I want the user to be able to just enter some names etc and as it is now, the needed information for the PLC(Some numbers that are locations and weights in INT32) will be saved to a csv textfile. Apparently that's not possible, although my collegues think that it should be no problem. Alse, will it work if i save the data as a textfile? (with the comma's being used as seperator)? Because what basically needs to happen is that i need to be able to send some numbers(1-8 and weight) to the PLC, then the PLC can convert them to coordinates so it knows where it needs to take how much weight from and where the cart needs to drop it. (2 separate machines) And is it true that the Unitronics PLC(whe're going to use the V-models, i believe the 350) can also read from xml files? That would be easier, then all i have to do is transform the textboxes into a dataset and save that. All that remains then is the scheduling as in the first post. I think i got a way for that, but will that work? My idea is saving the files(xml or UDT) with a datetime in the filename(picked using a datetimepicker) and then the plc will regulary check if there a file availible that has a datetime of within 5-10 minutes of the current date and time. I think that this is the most flexible option for the user, because he can now set up multiple files and then the plc will automatically run them at the right time.
  22. Okay, no problem. Just a minor setback, now i need to find out how to save to that data type. Is there any code for saving as Unitronics Data table file availible? Preferably in .net.
  23. Hello, I'm quite far with the software for my project. However, i got a few questions related to the PLC part now. (The PLC will probably be programmed by someone else.) The software allows the user to create a CSV of certain data, this csv has to be send to the PLC but there's some extra difficulty here. I want the user to be able to create a scheduled task of it, so he can configure the assignments once and basically forget about it until the schedule runs out. How can i do this? I recon the most easy way is to force the user to add a date/time to the csv filename and then let the plc check the pc(it's done remotely via TCP/IP) once in a while for the file that's up next. But is that possible or are there other/better ways to do this? I would like to have to install only the software i'm working on now(which is a relatively small vb.net application) on the users computer. Also, i tried some googling but it seems that most questions are about importing to the user's pc. The PLC that will be used will be a V130 that's controlling several sensors and engines(hydraulic and electric). Also, it needs to send some of the data(location of the items it needs to take and the weight.) to a other plc.
  24. I think the best way is to let the application create a CSV that is then send by the app to the main PLC. Luckily, The data needed for the plc consists only of numbers(Weight and locations) so it should be relatively easy to convert to csv. but How?
  25. You mean the converted project? I can't find a option to convert to x86 from the original files. And so, i still havn't been able to convert it to vb.net 2010.
×
×
  • Create New...