├── .gitignore ├── LICENSE ├── README.md ├── tc3-data-logger.sln └── tc3-data-logger ├── MainPlcProgram ├── CsvLogger │ ├── ByteBuffer │ │ ├── ByteBuffer.TcPOU │ │ ├── ByteBufferFileWriter.TcPOU │ │ ├── FileBasedByteBuffer.TcPOU │ │ ├── GVL_ByteBufferConstants.TcGVL │ │ └── Interface │ │ │ └── I_Buffer.TcIO │ ├── CsvDocument │ │ ├── CsvByteDocumentWriter.TcPOU │ │ └── Interfaces │ │ │ ├── I_CsvDocument.TcIO │ │ │ └── I_CsvRecord.TcIO │ └── GVL_RealtimeLogging.TcGVL ├── MainPlcProgram.plcproj ├── POUs │ ├── ExampleApplication.TcPOU │ ├── MAIN.TcPOU │ └── PerformanceTest.TcPOU └── PlcTask.TcTTO └── tc3-data-logger.tsproj /.gitignore: -------------------------------------------------------------------------------- 1 | # Add any directories, files, or patterns you don't want to be tracked by version control # 2 | 3 | ## Ignore Twincat non-source files ## 4 | 5 | ### User-specific files (from 4018 tmc should be ignored) ### 6 | *.~u 7 | *.tpy 8 | *.tmc 9 | *.suo 10 | *.user 11 | *.orig 12 | TrialLicense.tclrs 13 | 14 | ### Build results ### 15 | _Boot/ 16 | _CompileInfo/ 17 | .engineering_servers/ 18 | *.compileinfo 19 | *.bootinfo 20 | *.bootinfo_guids 21 | 22 | ### Visual studio files ### 23 | *.obj 24 | *.exe 25 | *.pdb 26 | *.user 27 | *.aps 28 | *.pch 29 | *.vspscc 30 | *_i.c 31 | *_p.c 32 | *.ncb 33 | *.suo 34 | *.tlb 35 | *.tlh 36 | *.bak 37 | *.cache 38 | *.ilk 39 | *.log 40 | *.dll 41 | *.lib 42 | *.sbr 43 | *.crc 44 | *.cid 45 | *.autostart 46 | *.app 47 | *.compiled-library 48 | *.compileinfo 49 | *.occ 50 | *.tizip 51 | *.plcproj.orig 52 | 53 | ### VS Code files ### 54 | *.vscode 55 | 56 | ### Windows files ### 57 | Thumbs.db 58 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Ben 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Example High Speed CSV data logger 2 | 3 | ## Disclaimer 4 | This is a personal guide not a peer reviewed journal or a sponsored publication. We make 5 | no representations as to accuracy, completeness, correctness, suitability, or validity of any 6 | information and will not be liable for any errors, omissions, or delays in this information or any 7 | losses injuries, or damages arising from its display or use. All information is provided on an as 8 | is basis. It is the reader’s responsibility to verify their own facts. 9 | 10 | The views and opinions expressed in this guide are those of the authors and do not 11 | necessarily reflect the official policy or position of any other agency, organization, employer or 12 | company. Assumptions made in the analysis are not reflective of the position of any entity 13 | other than the author(s) and, since we are critically thinking human beings, these views are 14 | always subject to change, revision, and rethinking at any time. Please do not hold us to them 15 | in perpetuity. 16 | 17 | ## Overview 18 | Demo of high speed logging to CSV. "High speed" simply denotes that I will continue to optimise it's speed using the realtime monitor. 19 | 20 | This code uses the fluent interface design pattern. For more information see https://www.plccoder.com/fluent-code/ 21 | 22 | ### Performance overview 23 | IPC | Performance Class | AddBool | AddBoolLiteral | AddInt | AddIntLiteral | AddString "test" | AddStringLiteral "test" | Max buffer size *1 24 | -|-|-|-|-|-|-|-|- 25 | Laptop | 93 | tba | tba | tba | tba | tba | tba | 26 | 27 | ## Install 28 | Not required. Simply open the project. 29 | 30 | ## TwinCAT 31 | This project uses TcXaeShell 3.1.4024.11 32 | 33 | ## Getting started 34 | This is not a guide for TcXaeShell, please visit http://beckhoff.com/ for further guides 35 | * Open the included TwinCAT project and activate on your local machine 36 | * Login and set the PLC running 37 | * Manually set the loggingState to INITIALISE 38 | 39 | -------------------------------------------------------------------------------- /tc3-data-logger.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # TcXaeShell Solution File, Format Version 11.00 4 | VisualStudioVersion = 15.0.28010.2050 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{B1E792BE-AA5F-4E3C-8C82-674BF9C0715B}") = "tc3-data-logger", "tc3-data-logger\tc3-data-logger.tsproj", "{1BBD5F6E-2EF4-489E-9F64-96E066943849}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|TwinCAT CE7 (ARMV7) = Debug|TwinCAT CE7 (ARMV7) 11 | Debug|TwinCAT OS (ARMT2) = Debug|TwinCAT OS (ARMT2) 12 | Debug|TwinCAT RT (x64) = Debug|TwinCAT RT (x64) 13 | Debug|TwinCAT RT (x86) = Debug|TwinCAT RT (x86) 14 | Release|TwinCAT CE7 (ARMV7) = Release|TwinCAT CE7 (ARMV7) 15 | Release|TwinCAT OS (ARMT2) = Release|TwinCAT OS (ARMT2) 16 | Release|TwinCAT RT (x64) = Release|TwinCAT RT (x64) 17 | Release|TwinCAT RT (x86) = Release|TwinCAT RT (x86) 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT CE7 (ARMV7).ActiveCfg = Debug|TwinCAT CE7 (ARMV7) 21 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT CE7 (ARMV7).Build.0 = Debug|TwinCAT CE7 (ARMV7) 22 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT OS (ARMT2).ActiveCfg = Debug|TwinCAT OS (ARMT2) 23 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT OS (ARMT2).Build.0 = Debug|TwinCAT OS (ARMT2) 24 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT RT (x64).ActiveCfg = Debug|TwinCAT RT (x64) 25 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT RT (x64).Build.0 = Debug|TwinCAT RT (x64) 26 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT RT (x86).ActiveCfg = Debug|TwinCAT RT (x86) 27 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Debug|TwinCAT RT (x86).Build.0 = Debug|TwinCAT RT (x86) 28 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT CE7 (ARMV7).ActiveCfg = Release|TwinCAT CE7 (ARMV7) 29 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT CE7 (ARMV7).Build.0 = Release|TwinCAT CE7 (ARMV7) 30 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT OS (ARMT2).ActiveCfg = Release|TwinCAT OS (ARMT2) 31 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT OS (ARMT2).Build.0 = Release|TwinCAT OS (ARMT2) 32 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT RT (x64).ActiveCfg = Release|TwinCAT RT (x64) 33 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT RT (x64).Build.0 = Release|TwinCAT RT (x64) 34 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT RT (x86).ActiveCfg = Release|TwinCAT RT (x86) 35 | {1BBD5F6E-2EF4-489E-9F64-96E066943849}.Release|TwinCAT RT (x86).Build.0 = Release|TwinCAT RT (x86) 36 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT CE7 (ARMV7).ActiveCfg = Debug|TwinCAT CE7 (ARMV7) 37 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT CE7 (ARMV7).Build.0 = Debug|TwinCAT CE7 (ARMV7) 38 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT OS (ARMT2).ActiveCfg = Debug|TwinCAT OS (ARMT2) 39 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT OS (ARMT2).Build.0 = Debug|TwinCAT OS (ARMT2) 40 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT RT (x64).ActiveCfg = Debug|TwinCAT RT (x64) 41 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT RT (x64).Build.0 = Debug|TwinCAT RT (x64) 42 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT RT (x86).ActiveCfg = Debug|TwinCAT RT (x86) 43 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Debug|TwinCAT RT (x86).Build.0 = Debug|TwinCAT RT (x86) 44 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT CE7 (ARMV7).ActiveCfg = Release|TwinCAT CE7 (ARMV7) 45 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT CE7 (ARMV7).Build.0 = Release|TwinCAT CE7 (ARMV7) 46 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT OS (ARMT2).ActiveCfg = Release|TwinCAT OS (ARMT2) 47 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT OS (ARMT2).Build.0 = Release|TwinCAT OS (ARMT2) 48 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT RT (x64).ActiveCfg = Release|TwinCAT RT (x64) 49 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT RT (x64).Build.0 = Release|TwinCAT RT (x64) 50 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT RT (x86).ActiveCfg = Release|TwinCAT RT (x86) 51 | {4248DE34-8E0A-43D4-BE3E-5C37B65D0FFF}.Release|TwinCAT RT (x86).Build.0 = Release|TwinCAT RT (x86) 52 | EndGlobalSection 53 | GlobalSection(SolutionProperties) = preSolution 54 | HideSolutionNode = FALSE 55 | EndGlobalSection 56 | GlobalSection(ExtensibilityGlobals) = postSolution 57 | SolutionGuid = {A8184D5B-329F-4000-84D5-631D998A066F} 58 | EndGlobalSection 59 | EndGlobal 60 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/ByteBuffer/ByteBuffer.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 35 | 36 | = 4 THEN 40 | memset(availableAddress,16#74,1); 41 | memset(availableAddress+1,16#72,1); 42 | memset(availableAddress+2,16#75,1); 43 | memset(availableAddress+3,16#65,1); 44 | UpdateUsedBufferSize(4); 45 | AddBoolAsStringToBuffer:=TRUE; 46 | END_IF 47 | ELSE 48 | IF Remaining >= 5 THEN 49 | memset(availableAddress,16#66,1); 50 | memset(availableAddress+1,16#61,1); 51 | memset(availableAddress+2,16#6C,1); 52 | memset(availableAddress+3,16#73,1); 53 | memset(availableAddress+4,16#65,1); 54 | UpdateUsedBufferSize(5); 55 | AddBoolAsStringToBuffer:=TRUE; 56 | END_IF 57 | END_IF 58 | 59 | ]]> 60 | 61 | 62 | 63 | 67 | 68 | = SIZE_OF_BOOL THEN 69 | 70 | memcpy(GetNextAvailableAddress(),ADR(Field),SIZE_OF_BOOL); 71 | UpdateUsedBufferSize(SIZE_OF_BOOL); 72 | 73 | END_IF 74 | ]]> 75 | 76 | 77 | 78 | 82 | 83 | = SIZE_OF_CHAR THEN 84 | 85 | memcpy(GetNextAvailableAddress(),ADR(Field),SIZE_OF_CHAR); 86 | UpdateUsedBufferSize(SIZE_OF_CHAR); 87 | 88 | END_IF]]> 89 | 90 | 91 | 92 | 96 | 97 | = SIZE_OF_INT THEN 98 | 99 | memcpy(GetNextAvailableAddress(),ADR(Field),SIZE_OF_INT); 100 | UpdateUsedBufferSize(SIZE_OF_INT); 101 | 102 | END_IF]]> 103 | 104 | 105 | 106 | 107 | 108 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 126 | 127 | = sizeInBytes THEN 130 | 131 | memcpy(GetNextAvailableAddress(),ADR(stringToWrite),sizeInBytes); 132 | UpdateUsedBufferSize(sizeInBytes); 133 | 134 | END_IF]]> 135 | 136 | 137 | 138 | 142 | 143 | = SIZE_OF_ULINT THEN 144 | 145 | memcpy(GetNextAvailableAddress(),ADR(Field),SIZE_OF_ULINT); 146 | UpdateUsedBufferSize(SIZE_OF_ULINT); 147 | 148 | END_IF]]> 149 | 150 | 151 | 152 | 160 | 161 | 163 | 164 | 165 | 166 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 190 | 191 | 193 | 194 | 195 | 196 | 197 | 198 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/ByteBuffer/ByteBufferFileWriter.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 16 | 17 | hFile 39 | ); 40 | 41 | IF NOT fbFileOpen.bBusy THEN 42 | IF NOT fbFileOpen.bError THEN 43 | state := OPENED; 44 | ELSE 45 | state := ERROR; 46 | errId := fbFileOpen.nErrId; 47 | END_IF 48 | END_IF 49 | 50 | OPENED: // 51 | 52 | WRITE: 53 | 54 | fbFileWrite(bExecute := FALSE ); 55 | fbFileWrite( 56 | sNetId := netId, 57 | hFile := hFile, 58 | pWriteBuff := byteBuffer.Address, 59 | cbWriteLen := byteBuffer.Size, 60 | bExecute := TRUE 61 | ); 62 | state := WRITING; 63 | 64 | WRITING: 65 | 66 | fbFileWrite( 67 | bExecute := FALSE 68 | ); 69 | 70 | IF NOT fbFileWrite.bBusy THEN 71 | IF NOT fbFileWrite.bError THEN 72 | state := WRITTEN; 73 | ELSE 74 | state := ERROR; 75 | errId := fbFileWrite.nErrId; 76 | END_IF 77 | END_IF 78 | 79 | WRITTEN: state := OPENED; 80 | 81 | CLOSE: 82 | 83 | fbFileClose(bExecute := FALSE); 84 | fbFileClose( 85 | sNetId := netId, 86 | hFile := hFile, 87 | bExecute := TRUE 88 | ); 89 | state := CLOSING; 90 | 91 | CLOSING: 92 | 93 | fbFileClose( 94 | bExecute := FALSE 95 | ); 96 | 97 | IF ( NOT fbFileClose.bBusy ) THEN 98 | hFile := 0; 99 | state := CLOSED; 100 | END_IF 101 | 102 | CLOSED: state := IDLE; 103 | 104 | ERROR: 105 | 106 | IF ( hFile <> 0 ) THEN 107 | state := CLOSE; 108 | ELSE 109 | state := IDLE; 110 | END_IF 111 | 112 | END_CASE 113 | 114 | 115 | 116 | ]]> 117 | 118 | 119 | 120 | 121 | 125 | 126 | 127 | 128 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 178 | 179 | 188 | 189 | 190 | 191 | 196 | 197 | 210 | 211 | 212 | 213 | 214 | 215 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/ByteBuffer/FileBasedByteBuffer.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 22 | 23 | 66 | 67 | 68 | 72 | 73 | 74 | 75 | 76 | 77 | 81 | 82 | 83 | 84 | 85 | 86 | 90 | 91 | 92 | 93 | 94 | 95 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 119 | 120 | 121 | 122 | 123 | 124 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 190 | 191 | 196 | 197 | 198 | 199 | 203 | 204 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/ByteBuffer/GVL_ByteBufferConstants.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/ByteBuffer/Interface/I_Buffer.TcIO: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 6 | 7 | 11 | 12 | 13 | 17 | 18 | 19 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/CsvDocument/CsvByteDocumentWriter.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 34 | 35 | 36 | 37 | 41 | 42 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | 54 | 55 | 56 | 63 | 64 | 69 | 70 | 71 | 72 | 79 | 80 | 85 | 86 | 87 | 88 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 105 | 106 | 110 | 111 | 112 | 113 | 117 | 118 | 122 | 123 | 124 | 125 | 132 | 133 | 138 | 139 | 140 | 141 | 148 | 149 | 154 | 155 | 156 | 157 | 159 | 160 | 167 | 168 | 169 | 170 | 172 | 173 | 180 | 181 | 182 | 183 | 185 | 186 | 189 | 190 | 191 | 192 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 220 | 221 | 222 | 223 | 224 | 225 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 260 | 261 | 264 | 265 | 266 | 267 | 271 | 272 | 274 | 275 | 276 | 277 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 293 | 294 | 295 | 296 | 297 | 298 | 301 | 302 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/CsvDocument/Interfaces/I_CsvDocument.TcIO: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/CsvDocument/Interfaces/I_CsvRecord.TcIO: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 6 | 7 | 11 | 12 | 13 | 17 | 18 | 19 | 23 | 24 | 25 | 29 | 30 | 31 | 35 | 36 | 37 | 41 | 42 | 43 | 47 | 48 | 49 | 53 | 54 | 55 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/CsvLogger/GVL_RealtimeLogging.TcGVL: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/MainPlcProgram.plcproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0.0.0 4 | 2.0 5 | {4248de34-8e0a-43d4-be3e-5c37b65d0fff} 6 | True 7 | true 8 | true 9 | false 10 | MainPlcProgram 11 | 3.1.4023.0 12 | {6111869b-9fd5-460f-a5c6-8139c129dbed} 13 | {98cb660d-5a5d-4c0d-bee1-a00d86f2fab9} 14 | {a55ba572-5b54-459f-957f-8874656a6af8} 15 | {92e1de1d-07a0-4474-9949-ce318c5ebfcd} 16 | {b6b637e2-2bd7-4d98-a0a7-f2d2300ace87} 17 | {9bac821b-20d7-4ccf-9bfa-9d7d945c71f5} 18 | 19 | 20 | 21 | Code 22 | 23 | 24 | Code 25 | 26 | 27 | Code 28 | 29 | 30 | Code 31 | true 32 | 33 | 34 | Code 35 | 36 | 37 | Code 38 | 39 | 40 | Code 41 | 42 | 43 | Code 44 | 45 | 46 | Code 47 | true 48 | 49 | 50 | Code 51 | 52 | 53 | Code 54 | 55 | 56 | Code 57 | 58 | 59 | Code 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Tc2_Standard, * (Beckhoff Automation GmbH) 75 | Tc2_Standard 76 | 77 | 78 | Tc2_System, * (Beckhoff Automation GmbH) 79 | Tc2_System 80 | 81 | 82 | Tc2_Utilities, * (Beckhoff Automation GmbH) 83 | Tc2_Utilities 84 | 85 | 86 | Tc3_Module, * (Beckhoff Automation GmbH) 87 | Tc3_Module 88 | 89 | 90 | 91 | 92 | Content 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | "<ProjectRoot>" 101 | 102 | 103 | 104 | 105 | 106 | System.Collections.Hashtable 107 | {54dd0eac-a6d8-46f2-8c27-2f43c7e49861} 108 | System.String 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/POUs/ExampleApplication.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 30 | 31 | targetLogCount THEN 95 | loggingState := COMPLETE_LOGGING; 96 | END_IF 97 | 98 | COMPLETE_LOGGING: 99 | 100 | // You must stop the file based buffer to close and release the file. Once the buffer has stopped we can then finish 101 | // by resetting the csvDocument. This resets the internal counters. 102 | fileBasedByteBuffer.Stop(); 103 | 104 | IF fileBasedByteBuffer.IsStopped THEN 105 | csvDocumentWriter.Reset(); 106 | loggingState := IDLE; 107 | END_IF 108 | 109 | 110 | END_CASE 111 | 112 | // You must cyclic call this fileBasedByteBuffer to give it procesing time. There is no requirement to call the csvDocumentWriter as this is 113 | // all event based. 114 | fileBasedByteBuffer(); 115 | 116 | // maxiumumBufferUsage must remain under GVL_ByteBufferConstants.FILE_WRITE_BUFFER_SIZE. If it exceeds then you will drop values. In this instance 117 | // make GVL_ByteBufferConstants.FILE_WRITE_BUFFER_SIZE larger. 118 | IF fileBasedByteBuffer.Size > maxiumumBufferUsage THEN 119 | maxiumumBufferUsage := fileBasedByteBuffer.Size; 120 | END_IF 121 | 122 | 123 | 124 | ]]> 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/POUs/MAIN.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/POUs/PerformanceTest.TcPOU: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 29 | 30 | targetLogCount THEN 96 | loggingState := COMPLETE_LOGGING; 97 | END_IF 98 | 99 | COMPLETE_LOGGING: 100 | 101 | // You must stop the file based buffer to close and release the file. Once the buffer has stopped we can then finish 102 | // by resetting the csvDocument. This resets the internal counters. 103 | fileBasedByteBuffer.Stop(); 104 | 105 | IF fileBasedByteBuffer.IsStopped THEN 106 | csvDocumentWriter.Reset(); 107 | loggingState := IDLE; 108 | END_IF 109 | 110 | 111 | END_CASE 112 | 113 | // You must cyclic call this fileBasedByteBuffer to give it procesing time. There is no requirement to call the csvDocumentWriter as this is 114 | // all event based. 115 | fileBasedByteBuffer(); 116 | 117 | // maxiumumBufferUsage must remain under GVL_ByteBufferConstants.FILE_WRITE_BUFFER_SIZE. If it exceeds then you will drop values. In this instance 118 | // make GVL_ByteBufferConstants.FILE_WRITE_BUFFER_SIZE larger. 119 | IF fileBasedByteBuffer.Size > maxiumumBufferUsage THEN 120 | maxiumumBufferUsage := fileBasedByteBuffer.Size; 121 | END_IF 122 | 123 | 124 | 125 | ]]> 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /tc3-data-logger/MainPlcProgram/PlcTask.TcTTO: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 1000 6 | 20 7 | 8 | MAIN 9 | 10 | {685d9219-bd03-4b46-af06-cff6ce919fed} 11 | {397a06c5-263d-40fb-98f4-d62812f9b240} 12 | {24d8a117-b463-4592-8d40-7dd6da5228fb} 13 | {4d8c3060-d78d-4cf0-8bcc-19e196f7efa4} 14 | {245d3e35-9e09-4536-a245-b17c16fe1bb5} 15 | 16 | -------------------------------------------------------------------------------- /tc3-data-logger/tc3-data-logger.tsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | PlcTask 9 | 10 | 11 | 12 | 13 | 14 | 15 | MainPlcProgram Instance 16 | {08500001-0000-0000-F000-000000000064} 17 | 18 | 19 | 0 20 | PlcTask 21 | 22 | #x02010030 23 | 24 | 20 25 | 1000000 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | --------------------------------------------------------------------------------