hmwright

MrPLC Member
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hmwright

  • Rank
    Sparky

Profile Information

  • Country Australia
  1. Yokogawa Fast Tools

    Hi All; Does anybody here have a copy of Fast tools 10.02. It can like Citect be run for 1 hour in demo mode which is ideal to asses its capability. We are looking at having to use it but would like to review in demo first. Local Distributor is not providing much assistance.
  2. Great news slimskism. I used your concept and switched to the newer citect SQL commands and ended up only needing the one script (below) and using SQLappend to keep making the SQL text string longer. Even amazed myself. Thanks for your help. In the first part I still read tags in to an array as initial post but function now as below:-   FUNCTION SQL_INSERT_lds() // Loop FOR number of tags (16 lots of 30 min) TO be read adding to array Variables INT i;     FOR i = 0 TO 31 DO         tagval = TagRead(tagname);     END      // Open ODBC connection TO CitectDB configured in ODBC Manager with DSN_SQL INT hSQL;      hSQL = SQLConnect("DSN=DSN_SQL"); //* IF connection IS OK, set the begining of a SQL transaction IF hSQL <> -1 THEN     SQLSet(hSQL, "INSERT INTO lds (dateandtime,S0000,S0030,S0100,S0130,S0200,S0230,S0300,S0330,S0400,S0430,S0500,S0530,S0600,S0630,S0700,S0730,");     SQLAppend(hSQL, "S0800,S0830,S0900,S0930,S1000,S1030,S1100,S1130,S1200,S1230,S1300,S1330,S1400,S1430,S1500,S1530) VALUES ");     SQLAppend(hSQL, "(SYSDATETIME(),'"+tagval[0]+"','"+tagval[1]+"','"+tagval[2]+"','"+tagval[3]+"','"+tagval[4]+"','"+tagval[5]+"','"+tagval[6]+"','"+tagval[7]+"','"+tagval[8]+"','"+tagval[9]+"','"+tagval[10]+"','"+tagval[11]+"','"+tagval[12]+"','"+tagval[13]+"','"+tagval[14]+"','"+tagval[15]+"',");     SQLAppend(hSQL, "'"+tagval[16]+"','"+tagval[17]+"','"+tagval[18]+"','"+tagval[19]+"','"+tagval[20]+"','"+tagval[21]+"','"+tagval[22]+"','"+tagval[23]+"','"+tagval[24]+"','"+tagval[25]+"','"+tagval[26]+"','"+tagval[27]+"','"+tagval[28]+"','"+tagval[29]+"','"+tagval[30]+"','"+tagval[31]+"')");     SQLExec(HSQL, "");     SQLEnd(hSQL);     SleepMS(100);     SQLDisconnect(hSQL); ELSE     Message("Error Message","SQL TRADING DAY DATABASE WRITE FAIL",48); END END  
  3. Thanks; It looks like "CSV_DB_execute" was a citect 2015 command and appears in that help. We are suing 2018R2 and this CSV set seems to be missing. If I master the concept then I may be able to get it to work with the "SQLExec" command. In the scripts I also note a few @dEventTime and @sAction. I am assuming the d and s refer to datatype ? IS this referenced anywhere ? Thanks again for the assistance
  4. Thankyou very much. I see a different way of connecting to the MSSQL instance. Whilst trying to understand what this code is I cant reference "CSV_DB_Execute" which appears to be the db connect? is this cicode or cicodeVBA? Also is you application running a seperate query ? "qryInsertOperatorLog" or is this just a tagger event? can you also clarify what "gsPrimaryConnection" is. Sorry to be a pain but I connected using DSN and this is a new method to me which I cant find in cicode reference. Really appreciate the guidance here.
  5. I am having a problem getting citect to write to my sql database.  Whilst it will write I am restricted by the length of a single cicode command. I think its 255 characters. For my problem I am trying to write 48 tags to the database in one write command to obtain 1 time stamp. Is it possible to write multiple times to the same tables row ? Currently when I write a new row is created at the given timestamp. the cicode is attached. A solution would be to do 4 writes of 12 tags at a time but all would need to go in the same MSSQL table row. I'm ok using the data instead of time and date as this write only happens once each day Any help would be awesome..   *********************************************************************************************************************************** /* **    FILE:        SpurLoad.CI ** * Load Tags from Citect in TO temp array */ STRING tagname[24]="M340_PwrCtrl_SLD0000","M340_PwrCtrl_SLD0030","M340_PwrCtrl_SLD0100","M340_PwrCtrl_SLD0130","M340_PwrCtrl_SLD0200","M340_PwrCtrl_SLD0230","M340_PwrCtrl_SLD0300","M340_PwrCtrl_SLD0330","M340_PwrCtrl_SLD0400","M340_PwrCtrl_SLD0430","M340_PwrCtrl_SLD0500","M340_PwrCtrl_SLD0530","M340_PwrCtrl_SLD0600","M340_PwrCtrl_SLD0630","M340_PwrCtrl_SLD0700","M340_PwrCtrl_SLD0730","M340_PwrCtrl_SLD0800","M340_PwrCtrl_SLD0830","M340_PwrCtrl_SLD0900","M340_PwrCtrl_SLD0930","M340_PwrCtrl_SLD1000","M340_PwrCtrl_SLD1030","M340_PwrCtrl_SLD1100"; /* add array TO hold values */ STRING tagval[24]; INT hSQL; FUNCTION SQL_INSERT_lds() /* Loop FOR number of tags (13 lots of 30 min) TO be read adding to array Variables */ INT i;     FOR i = 0 TO 21 DO              tagval = TagRead(tagname);              END      /* Open ODBC connection TO CitectDB configured in ODBC Manager with DSN_SQL */          hSQL = SQLConnect("DSN=DSN_SQL"); /* IF connection IS OK, insert in TO table "lds" the values */ IF hSQL <> -1 THEN     SQLExec(hSQL, "INSERT INTO lds (dateandtime,S0000,S0030,S0100,S0130,S0200,S0230,S0300,S0330,S0400,S0430,S0500,S0530,S0600,S0630,S0700,S0730,S0800,S0830,S0900,S0930,S1000,S1030) VALUES (SYSDATETIME(),'"+tagval[0]+"','"+tagval[1]+"','"+tagval[2]+"','"+tagval[3]+"','"+tagval[4]+"','"+tagval[5]+"','"+tagval[6]+"','"+tagval[7]+"','"+tagval[8]+"','"+tagval[9]+"','"+tagval[10]+"','"+tagval [11]+"','"+tagval[12]+"','"+tagval[13]+"','"+tagval[14]+"','"+tagval[15]+"','"+tagval[16]+"','"+tagval[17]+"','"+tagval[18]+"','"+tagval[19]+"','"+tagval[20]+"','"+tagval[21]+"')");     SQLEnd(hSQL);     SleepMS(100); SQLDisconnect(hSQL); ELSE     Message("Error Message","SQL TRADING DAY DATABASE WRITE FAIL",48); END END   SpurLoad.ci
  6. Issue was a data type, THE variable to write was an INT and the read variable as a string from OPC Lines Changed to:- M340PLC_R03kW = strtoint (Sub03Substation3PowerkWtot); Thanks
  7. I am trying to write some citect variables back to the PLC. I have made a startup cicode script which is suppose to copy one variable to another which I found on the web. I am not sure if just using tag = tag is OK in citect 2018. Any help would be fantastic.   Cicode below: *********************** FUNCTION StartUpFunction()     INT hMyTask;     // Start a new task that runs all the time and transfers values using writetag     hMyTask = TaskNew("fnDoThis","",0); END FUNCTION fnDoThis;     //Never Stop this Loop     WHILE 1 DO         //Update the first Tag         TagWrite ("M340PLC_R02kW",Sub02Substation2PowerkWtot)         M340PLC_R03kW = Sub03Substation3PowerkWtot         M340PLC_R04kW = Sub04Substation4PowerkWtot         M340PLC_R05kW = TerminalSubstation_5InstantaneousPowerkWtot         M340PLC_R06kW = TerminalSubstation_6PowerkWtot         M340PLC_R07kW = Sub07Substation7PowerkWtot         M340PLC_R08kW = Sub08Substation8PowerkWtot         M340PLC_R09kW = Sub09Substation9PowerkWtot         M340PLC_R10kW = M340PLC_G1_GEN_FREQ_PV         M340PLC_R11kW = Sub11Substation11PowerkWtot         M340PLC_R12kW = Sub12Substation12PowerkWtot         M340PLC_R13kW = Sub13Substation13PowerkWtot         M340PLC_R14kW = Sub14Substation14PowerkWtot         M340PLC_R15kW = Sub15Substation15PowerkWtot         M340PLC_R16kW = Sub16Substation_16PowerkWtot         M340PLC_R17kW = TerminalSubstation_17PowerkWtot         M340PLC_R18kW = Sub18Substation18PowerkWtot         M340PLC_R19kW = Sub19Substation19PowerkWtot         M340PLC_R20kW = M340PLC_G1_GEN_FREQ_PV                 M340PLC_R21kW = Sub21Substation21PowerkWtot         M340PLC_R22kW = Sub22Substation_22PowerkWtot         M340PLC_R23kW = Sub23Substation_23PowerkWtot         M340PLC_R24kW = Sub24Substation_24PowerkWtot         M340PLC_R25kW = Sub25Substation25PowerkWtot         M340PLC_R26kW = Sub26Substation26PowerkWtot         M340PLC_R27kW = Sub27Substation27PowerkWtot         M340PLC_R28kW = Sub28Substation28PowerkWtot         M340PLC_R29kW = Sub29Substation29PowerkWtot         M340PLC_R30kW = M340PLC_G1_GEN_FREQ_PV         M340PLC_R31kW = M340PLC_G1_GEN_FREQ_PV         M340PLC_R32kW = PV2_SSB1PowerMeterPowerkWtot         M340PLC_R33kW = PV2_SSB2PowerMeterPowerkWtot         M340PLC_R34kW = M340PLC_G1_GEN_FREQ_PV         M340PLC_R35kW = M340PLC_G1_GEN_FREQ_PV         M340PLC_R36kW = M340PLC_G1_GEN_FREQ_PV         M340PLC_PQM3_WATTS_PV = HV_MetersBunnings_Intake_StnPowerkWtot         M340PLC_SOL01_SSB1_KW = SolarSSB1PowerMeterPowerkWtot         M340PLC_SOL01_SSB2_KW = SolarSSB2PowerMeterPowerkWtot         M340PLC_SOL01_SSB3_KW = SolarSSB3PowerMeterPowerkWtot         M340PLC_SOL01_SSB4_KW = SolarSSB4PowerMeterPowerkWtot         //Go to sleep for 1 second so as to not overload CPU         Sleep(1)     //Go back to start of Loop     END //End of Function END  
  8. Thanks, Already have and read it, still no luck
  9. M340 csv File Read

    I did see this link although it says possible it gives no reference to how it can be done, as its heading says there are no examples. Thanks
  10. I have an application where data gets placed in a csv file. I need to read data from this file in to memory of a M340 PLC. Is there a way to program the M340 PLC to open and read the file in to an array or is this not possible at the PLC. Looked through google with little success.
  11. Please find attached Modbus Manual and User Manual. The 1 offset only seams to apply when using ReadVar and not IO scanning, I did make sure there was no overlap. GenComm2.162 DSE8610-MKII-Operator-Manual.pdfApril 2018.docx
  12. Thanks cHud; Please see set up for scanning two sets from the same device.
  13. As a side note I have now tried not using the IO scanning tab and just setting up two READ_VAR calls. This works with no drama, therefor this must be related to the IO scanning set up tab and not any hardware or connections. I hope we get an answer as I would prefer the IO scan way instead of writing to large arrays of varaiables
  14. I am having issues with M340 IO scanning. I have the NOE card next to the CPU which is a 2020 item. I have set the Network for the CPU as 192.168.0.5 and the NOE card as 192.168.0.12. To the NOE card I have connected a Deep Sea Electronics 8610 MkII generator controller which has configurable modbus pages. Its IP is 192.168.0.3. I have set the IO scan tab of the NOE to read the device at 192.168.0.3 starting at remote address 442497 (Page 166 of the DSE, 166*256). for 80 registers and to store them in PLC at %MW300 onward. When compiled this read works perfectly with values being loaded. The problem comes when I try a second read from the same device. This time Page 167 (167*256) at address 442753 which is sent to local PLC %MW380 onward. Now when I compile the code the first page is read OK as prior but the second read shows a "Faulty/Absent" on teh IO scanner debug page and no values are read. If I change the first entry to scan page 167 with page 166 deleted, again all is OK. It seams I am unable to make more than one read of the DSE product. I have spoke with DSE whom state the device can have multi reads from multiple masters and they have proved multiple reads from the same and different devices. I am now at a loss as to what to try next. I hope somebody can provide some insight. I also tryed doing teh second read with a standard READ_VAR command with teh same result. Just wondering if its a NOE thing or a set up thing I have missed.