Compare commits
475 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 133041d030 | |||
| 5731041fd3 | |||
| eda93dae9c | |||
| 1e4e789af6 | |||
| 857426d0c1 | |||
| 372a8547d6 | |||
| 9c10a0c2a5 | |||
| 3213b0049a | |||
| 9e5df29acb | |||
| 2c2648d225 | |||
| 4599307148 | |||
| 0f70ae834c | |||
| e85360810e | |||
| b7f3fa236e | |||
| c315266041 | |||
| 2231e1e1c4 | |||
| 520d6c6e0a | |||
| 5f38bf37ef | |||
| ff86e73840 | |||
| 1fe80bab00 | |||
| f9d78bed4b | |||
| d06e7b16f8 | |||
| 5b256231d8 | |||
| e6c8cfb386 | |||
| 625191ad20 | |||
| e25ed31485 | |||
| 1f765202ae | |||
| 11d4b8849f | |||
| 544a34703e | |||
| b033de593c | |||
| b4f3af65ca | |||
| 5279aa74ba | |||
| 4290d02de4 | |||
| cfc5644164 | |||
| d244bb28d5 | |||
| 7385e71378 | |||
| 3d058de5ee | |||
| f9dd5ba328 | |||
| bba49cb503 | |||
| 85cc440597 | |||
| 492df82954 | |||
| 804393842a | |||
| 9f6e71689e | |||
| 3c43df4342 | |||
| 426e2f5e00 | |||
| f9f8c785fc | |||
| 5047b13617 | |||
| 8c76a31361 | |||
| 5ab52da602 | |||
| 20a8913775 | |||
| 23b50500d8 | |||
| 11d82317e2 | |||
| c13bbef8c7 | |||
| ebf3cb9fe8 | |||
| 35d94b32a2 | |||
| 7548180d27 | |||
| d70aaec4b3 | |||
| ec14499469 | |||
| 8269d837d2 | |||
| ec01e38048 | |||
| b86a71a4e6 | |||
| a3ea6b348b | |||
| bb656b575f | |||
| 7943f99044 | |||
| a3a0ef906f | |||
| dbac3014c0 | |||
| 9e4a70b556 | |||
| ec4e651188 | |||
| 889cdf6218 | |||
| 92b8829451 | |||
| ee0d69d831 | |||
| 249e2845dd | |||
| 968752288d | |||
| e127e0ab67 | |||
| 93b4c0f039 | |||
| 726f7275a3 | |||
| 768f8fd48c | |||
| 6c749a8d03 | |||
| b0390d481f | |||
| 4e1ec9bed5 | |||
| 619b72ed5b | |||
| 15346e6c62 | |||
| 5236b03e4a | |||
| 6e808a5d6c | |||
| 8b4b0c6b1b | |||
| 14adc402a1 | |||
| c18bebb22b | |||
| 4610077f9b | |||
| a59d560ca9 | |||
| 019320df3d | |||
| d356015120 | |||
| 688d6a49bf | |||
| 13f3057a7e | |||
| d0232020ae | |||
| 6dc9f31d53 | |||
| 94e65aeef6 | |||
| e658c4cac6 | |||
| fc627e0bba | |||
| d5cb083fb8 | |||
| ad98729a52 | |||
| 0128b08a76 | |||
| 1da9582a10 | |||
| 0916af645d | |||
| 4f38c61787 | |||
| 0a3cea456d | |||
| 836292ba67 | |||
| 97082a036f | |||
| 8a72f692d5 | |||
| 5e7f54ec5e | |||
| 01c3a14a0c | |||
| e0060a4051 | |||
| 5ebbd1280a | |||
| 56fe715c08 | |||
| 3bd4f2ba6f | |||
| bb82c96579 | |||
| a35cb78763 | |||
| e9b08f84d1 | |||
| 1003d3087c | |||
| 016b8b0c54 | |||
| be0125732f | |||
| 6fa0a0a271 | |||
| fcea93e6cf | |||
| 47c6591d04 | |||
| ea795b377a | |||
| e3039c13be | |||
| 1e592b4294 | |||
| 572822ac87 | |||
| 7ff8974a45 | |||
| 1933481e8b | |||
| e7e61aa05d | |||
| ef377acc51 | |||
| 1011af9988 | |||
| 83cd1e3cdc | |||
| be56c057f9 | |||
| adc8e4cc82 | |||
| dd36907c66 | |||
| 3e25af49ab | |||
| 601611981c | |||
| 3fc577fe20 | |||
| 47094d9947 | |||
| 029642fcac | |||
| 9afcbf5690 | |||
| 7ca832f4c1 | |||
| 01fbf2d7d8 | |||
| bb7111439d | |||
| 5c2dea5044 | |||
| 71c03d54d6 | |||
| 7701642a94 | |||
| 276d9f625b | |||
| 1619aee2c6 | |||
| bc93fce65c | |||
| 3d6be1df92 | |||
| 77fe32b24c | |||
| b2c70b3c43 | |||
| d6c19c1608 | |||
| e29b670498 | |||
| 628635c62a | |||
| 1b3ae79867 | |||
| ea2982714e | |||
| 804c015f8b | |||
| 7219986055 | |||
| c0a22df80c | |||
| 82bdb17474 | |||
| 6f2199c3c2 | |||
| 893fbc130c | |||
| 7b0daf4459 | |||
| b650a0e7ff | |||
| eb2c04097a | |||
| 45012d7e76 | |||
| db04ce25c7 | |||
| 974c16ff54 | |||
| c7055098ed | |||
| e40e500c70 | |||
| a70780e627 | |||
| ae57be0fad | |||
| 55f892aa1c | |||
| f78b01059d | |||
| 2196a29b9a | |||
| ca0d4c8160 | |||
| 9237ab8e0d | |||
| 9fbd875e51 | |||
| 7774a64b17 | |||
| 45260c3b40 | |||
| 0dcbdd3623 | |||
| 895ffef59e | |||
| 3df259f346 | |||
| 7423272a21 | |||
| e94e7a6cb5 | |||
| 285191d4b5 | |||
| 56b6333428 | |||
| cd153038fd | |||
| a0afcf154e | |||
| 0c36f4e66f | |||
| e47f53bc2e | |||
| aff414312b | |||
| 2a836744e8 | |||
| ce5f94c069 | |||
| ee9e0702a2 | |||
| 5c594ad79f | |||
| beb16f130a | |||
| bcf71ecf73 | |||
| 9bf05c538c | |||
| 562b5d50cd | |||
| d5bf08a90d | |||
| 3e0a4d2e62 | |||
| d130ae5ed4 | |||
| f635671718 | |||
| 440645d870 | |||
| 25f0f69718 | |||
| 9e5168d677 | |||
| d00f8f4678 | |||
| b4d0ca1943 | |||
| fa047f0c8a | |||
| 14abfa2a99 | |||
| 6862520e94 | |||
| 8e61255cde | |||
| 5a4e7cb592 | |||
| a344948a42 | |||
| b13b5a3ddf | |||
| 365b6e1a5c | |||
| bc4aaf9e78 | |||
| 0faa466ee8 | |||
| ece150ab56 | |||
| 3f6baafd36 | |||
| b647d93243 | |||
| 5d36b1966d | |||
| 9f07afe796 | |||
| dd22ad7615 | |||
| b924967ad9 | |||
| 55333ce11e | |||
| 4ae259ffa3 | |||
| 8bdfce05f3 | |||
| e57526ae08 | |||
| e6f922c3f7 | |||
| 51de025553 | |||
| b6f062def6 | |||
| 115dedfc9a | |||
| e3b41df917 | |||
| 81cd1e9fe7 | |||
| 3284308eaa | |||
| d39c359b2e | |||
| 55eb53e8df | |||
| 3c4aa781a7 | |||
| 64a1452c36 | |||
| e277568dfc | |||
| fc778074ce | |||
| 0666da83c8 | |||
| f2ed2274ff | |||
| 86bd956895 | |||
| ed8bb92fcc | |||
| 256af0e98f | |||
| a510071775 | |||
| 33f8c9a9a6 | |||
| fdcbc505c1 | |||
| 3f17538e71 | |||
| fd637270c8 | |||
| d19f13e8ad | |||
| ab9bf30a84 | |||
| ef1e3013d3 | |||
| 981340484d | |||
| dde43c21ab | |||
| e62dfe0b03 | |||
| 6d554b44ac | |||
| cf78b16ee4 | |||
| 55d7333936 | |||
| 733a37da98 | |||
| 4d55cbbccc | |||
| 11117bbb20 | |||
| 5bfa2ca5bc | |||
| 4df8a76561 | |||
| 3d20ff9af2 | |||
| c7a8c2525a | |||
| 3ab79d6c08 | |||
| 95d2a7b368 | |||
| ceaf788174 | |||
| bc3048e15c | |||
| 42928c701c | |||
| e4171867be | |||
| 9dcb23bb77 | |||
| b0976c5ee7 | |||
| 92ed3948e6 | |||
| 9538d3a6b2 | |||
| 27e84b42df | |||
| 15eaa3d5eb | |||
| a5c6c2447d | |||
| 0b8d187378 | |||
| ed0174cf8a | |||
| f990ed8f36 | |||
| 6a605cf871 | |||
| 3ba9b94e4d | |||
| 5e6b5078f0 | |||
| d93a29aaff | |||
| cdc4380324 | |||
| fe03653613 | |||
| 5de6da889a | |||
| ec10da262d | |||
| a11d4b57e9 | |||
| fdd1bfe80a | |||
| 3ada597f2e | |||
| 61a32ea476 | |||
| 3e150e81b1 | |||
| 05ec28473a | |||
| 77f2d04507 | |||
| d077137e12 | |||
| aaa310e32b | |||
| 72b44977fc | |||
| 5a2d6bcf94 | |||
| 7183cb8e61 | |||
| 121edb2e77 | |||
| 787da41304 | |||
| e7c69f4c4a | |||
| 6ab87ac751 | |||
| a8abbaa21c | |||
| e090822f4f | |||
| 527dd2b8c2 | |||
| 5bb7ceb3cb | |||
| 177b3e657d | |||
| 28a3e702f5 | |||
| 899f243bf2 | |||
| 0fc4b8619b | |||
| d7ef61f35c | |||
| 8d4193c4f9 | |||
| eb5559b5a8 | |||
| 4cdaedad7f | |||
| 2bf21e285d | |||
| 55fd9a934d | |||
| 329480db74 | |||
| 9a6ca4bff6 | |||
| 9a14dd6366 | |||
| 109e3acde0 | |||
| 740b6727a6 | |||
| 2f9d5062ed | |||
| 7a3c41ecbf | |||
| 5d202c6b70 | |||
| 44efcd2435 | |||
| 556811ec96 | |||
| 010c00ed92 | |||
| 47459c8aa1 | |||
| e27d44a6c4 | |||
| 1fe167069a | |||
| 78e1a3ba6c | |||
| 30439747b9 | |||
| dfde337921 | |||
| 8204b9a3d0 | |||
| a6b401fdc8 | |||
| 82edb8d59d | |||
| b3632f923b | |||
| 4bf6bb39dc | |||
| 5de1241504 | |||
| 4bd034aa95 | |||
| f7623f3187 | |||
| 6fe5b6700d | |||
| 6776fd627e | |||
| acf27d31be | |||
| 16d91bfdac | |||
| a41bf73358 | |||
| 08c5e52102 | |||
| 5c1c557bac | |||
| 6f28f6a71f | |||
| 0eda49b61a | |||
| 928c5f0fb1 | |||
| a045910057 | |||
| e17bc7f1b7 | |||
| 1c9b69709e | |||
| ed8dbdbe87 | |||
| d6cf851f2b | |||
| 083002258c | |||
| 7ed55aaff3 | |||
| 70072b648e | |||
| 72dd39bab3 | |||
| eab578e058 | |||
| 1e3d3b8874 | |||
| b08687933f | |||
| a69e3e5611 | |||
| 5b8a0601d1 | |||
| 53bbb18291 | |||
| 4421e9526a | |||
| 77308497f0 | |||
| 4ac64a9b53 | |||
| 0f53b0aa32 | |||
| e0e0cfc52b | |||
| e2f4c7e50a | |||
| 2444d49095 | |||
| eec1e57c55 | |||
| ae5b03e0a4 | |||
| 3f67249222 | |||
| ef24ddd9fe | |||
| 0a62bf7530 | |||
| da0c51d59a | |||
| 7fd54f3ad1 | |||
| d1a8dab89a | |||
| a929c5db94 | |||
| e25464fe1b | |||
| a81188fbd5 | |||
| 03a65f97d1 | |||
| 39cc92c1e6 | |||
| f73c9cfd10 | |||
| 9f9f472109 | |||
| 6f03fb77a6 | |||
| 7f0fb40dbb | |||
| 875ba2d10c | |||
| b7af9a42a2 | |||
| b8e4b67c86 | |||
| 80de7b7b7d | |||
| 99b137a8ad | |||
| beef5ada08 | |||
| 24a8979621 | |||
| 3057972fa7 | |||
| 756055c017 | |||
| 77e0490586 | |||
| a8b8d03721 | |||
| 4e28e14920 | |||
| 1d5941d63d | |||
| 3c31449c7f | |||
| af79feaac4 | |||
| 57d8e1a528 | |||
| 9b175f24e3 | |||
| 02a16f7219 | |||
| 4a08fc82ab | |||
| 7908cdc483 | |||
| b6c0ab0d2c | |||
| 8967a876e8 | |||
| 4e0d3c9e24 | |||
| fa53d8e374 | |||
| ec4413cc64 | |||
| 2e109fc818 | |||
| aa8267c3ca | |||
| 79e440a8f5 | |||
| aa94c62208 | |||
| 6212431200 | |||
| bc5a17c985 | |||
| a4cbe30c9d | |||
| dc9ee2cc35 | |||
| 428b7c8c68 | |||
| e9306dcfed | |||
| 0d80d78e70 | |||
| bcbceff9e0 | |||
| b463322158 | |||
| 4fb6803617 | |||
| cbdce4d191 | |||
| 1316491b34 | |||
| be87099923 | |||
| ab6321ddec | |||
| efb7ddf0ee | |||
| 276961d88b | |||
| 1a176567bb | |||
| 8ee26a625d | |||
| 00acb767e2 | |||
| f244abc339 | |||
| c31bfabd03 | |||
| eb7a598e18 | |||
| a2cf9fc0e8 | |||
| 9058b7bdc7 | |||
| dfb224e088 | |||
| a4a4e9dde2 | |||
| 7e776c3e73 | |||
| 47a37061ee | |||
| 268dc0bb17 | |||
| 6aefe871e2 | |||
| 16deba684f | |||
| 231d45ad07 | |||
| 0653fe76df | |||
| e8bfc5c130 | |||
| 522065f63b | |||
| fda72dc0d5 | |||
| cee9094c17 | |||
| cc27f623a2 | |||
| 56ab9469ff | |||
| 3c570bb99e | |||
| a774d95522 | |||
| 13c0c19c82 | |||
| 5394039ee6 | |||
| 830fca5826 | |||
| ac69050d99 | |||
| 90a46df214 |
+25
@@ -10,6 +10,31 @@ TestResults
|
||||
Tests.VisualState.xml
|
||||
TestResult.xml
|
||||
*\.vs
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
|
||||
|
||||
# # NuGet Packages
|
||||
# *.nupkg
|
||||
# # The packages folder can be ignored because of Package Restore
|
||||
# **/packages/*
|
||||
# # except build/, which is used as an MSBuild target.
|
||||
# !**/packages/build/
|
||||
# # Uncomment if necessary however generally it will be regenerated when needed
|
||||
# #!**/packages/repositories.config
|
||||
|
||||
#MTC_Adapter/\.vs/MTC_Adapter/v15/sqlite3/storage\.ide
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
variables:
|
||||
NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
MSBUILD_PATH: 'C:\Program Files (Any CPU)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
SOL_NAME: 'SCMA'
|
||||
APP_NAME: 'SCMA'
|
||||
NUM_REL: '0.1.2.3'
|
||||
NUM_DEB: '0.1.2-beta.3'
|
||||
CONFIG: ''
|
||||
VERS_MAIN: '2.2'
|
||||
NEW_REL: ''
|
||||
OUTPUT_DIR: ''
|
||||
NEXUS_PATH: 'SCM/SCMA'
|
||||
|
||||
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
|
||||
.nuget-fix: &nuget-fix
|
||||
- |
|
||||
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
|
||||
if ($hasSource -eq 0) {
|
||||
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||||
} else {
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||||
}
|
||||
echo $hasSource
|
||||
|
||||
# helper x fix version number
|
||||
.version-fix: &version-fix
|
||||
- |
|
||||
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format ddHH)
|
||||
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format dHH)
|
||||
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date –format yyMM)+"-beta."+(get-date –format dHH)
|
||||
$env:NEW_COPYRIGHT = "EgalWare @ 2006-" + (get-date -format yyyy)
|
||||
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
|
||||
$newContenuto = $contenuto -replace '1.0.0.0', $env:NEW_REL
|
||||
$newContenuto = $newContenuto -replace 'EgalWare © 2006', $env:NEW_COPYRIGHT
|
||||
$newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
|
||||
# display versioni generate
|
||||
$resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
|
||||
Write-Output $resoconto;
|
||||
echo "replace completati"
|
||||
|
||||
# helper x fix nuspec file
|
||||
.nuspec-fix: &nuspec-fix
|
||||
- |
|
||||
echo "Modifica dati file nuspec Release"
|
||||
$currRelease = $env:NUM_REL
|
||||
$currDebug = $env:NUM_DEB
|
||||
$find = "<version>(.|\n)*?</version>";
|
||||
$fileNameRel = "$env:APP_NAME.Release.nuspec";
|
||||
$replRel = "<version>" + $currRelease + "</version>";
|
||||
$nuspDataRel = Get-Content $fileNameRel;
|
||||
$nuspDataRelUpd = $nuspDataRel -replace $find, $replRel;
|
||||
$nuspDataRelUpd = $nuspDataRelUpd -replace "#copyright#", $replCopy;
|
||||
$nuspDataRelUpd = $nuspDataRelUpd -replace "#releaseNotes#", "Build $adesso";
|
||||
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
|
||||
echo "Modifica dati file nuspec Debug"
|
||||
$fileNameDeb = "$env:APP_NAME.Debug.nuspec";
|
||||
$replDeb = "<version>" + $currDebug + "</version>";
|
||||
$nuspDataDeb = Get-Content $fileNameDeb;
|
||||
$nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb;
|
||||
$nuspDataDebUpd = $nuspDataDebUpd -replace "#copyright#", $replCopy;
|
||||
$nuspDataDebUpd = $nuspDataDebUpd -replace "#releaseNotes#", "Build $adesso";
|
||||
Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd;
|
||||
echo "replace completati"
|
||||
|
||||
# helper pulizia files zip
|
||||
.cleanup-zip: &cleanup-zip
|
||||
- |
|
||||
$env:OUTPUT_DIR = "Releases\" + $CI_COMMIT_BRANCH + "\*"
|
||||
if ((Test-Path $env:OUTPUT_DIR))
|
||||
{
|
||||
Remove-Item $env:OUTPUT_DIR -Force -Recurse -ErrorAction Ignore
|
||||
}
|
||||
echo "Clening ZIP dir: $env:OUTPUT_DIR"
|
||||
|
||||
# helper creazione files zip
|
||||
.zipper: &zipper
|
||||
- |
|
||||
$7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe"
|
||||
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
|
||||
throw "7 zip file '$7zipPath' not found"
|
||||
}
|
||||
Set-Alias 7zip $7zipPath
|
||||
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
|
||||
cd "$env:APP_NAME\bin\"
|
||||
$Source = "*"
|
||||
7zip a -tzip $Target $Source -xr!DATA
|
||||
echo "called ZIP $Source --> $Target"
|
||||
|
||||
# helper creazione hash files
|
||||
.hashBuild: &hashBuild
|
||||
- |
|
||||
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
|
||||
$MD5 = Get-FileHash $Target -Algorithm MD5
|
||||
$SHA1 = Get-FileHash $Target -Algorithm SHA1
|
||||
New-Item $Target".md5"
|
||||
New-Item $Target".sha1"
|
||||
$MD5.Hash | Set-Content -Path $Target".md5"
|
||||
$SHA1.Hash | Set-Content -Path $Target".sha1"
|
||||
echo "Created HASH files for $Target"
|
||||
|
||||
.nexusUpload: &nexusUpload
|
||||
- |
|
||||
Set-Alias mCurl C:\Windows\system32\curl.exe
|
||||
$VersNumb = $env:NEW_REL
|
||||
echo "Curr Version: $VersNumb"
|
||||
if($CI_COMMIT_BRANCH -eq "master")
|
||||
{
|
||||
$version = "stable"
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = "unstable"
|
||||
}
|
||||
$File2Send = Get-ChildItem("Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".*")
|
||||
ForEach ($File in $File2Send) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
|
||||
}
|
||||
echo "Upload area utility for Releases\$CI_COMMIT_BRANCH\$env:APP_NAME.*"
|
||||
$FileUtility = Get-ChildItem("Releases\$CI_COMMIT_BRANCH\$env:APP_NAME.*")
|
||||
ForEach ($File in $FileUtility) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/utility/MAPO/$env:APP_NAME/$version/$FileName
|
||||
}
|
||||
|
||||
stages:
|
||||
- build
|
||||
- release
|
||||
|
||||
# --------------------------------
|
||||
# BUILD
|
||||
# --------------------------------
|
||||
|
||||
SCMA:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: SCMA
|
||||
only:
|
||||
refs:
|
||||
- develop
|
||||
- main
|
||||
- master
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "MTC_Adapter\$env:SOL_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "MTC_Adapter\$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
|
||||
MTC-ADB:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MTC-ADB
|
||||
only:
|
||||
refs:
|
||||
- develop
|
||||
- main
|
||||
- master
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "MTC_Adapter\$env:SOL_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "MTC_Adapter\$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
|
||||
# --------------------------------
|
||||
# RELEASE
|
||||
# --------------------------------
|
||||
|
||||
SCMA:release:
|
||||
stage: release
|
||||
needs: ["SCMA:build"]
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: SCMA
|
||||
NEXUS_PATH: MAPO/SCMA
|
||||
only:
|
||||
refs:
|
||||
- main
|
||||
- master
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "MTC_Adapter\$env:SOL_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
- *cleanup-zip
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "MTC_Adapter\$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:DebugSymbols=false /p:DebugType=None /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
- *zipper
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
MTC-ADB:release:
|
||||
stage: release
|
||||
needs: ["MTC-ADB:build"]
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MTC-ADB
|
||||
NEXUS_PATH: MAPO/MTC-ADB
|
||||
only:
|
||||
refs:
|
||||
- main
|
||||
- master
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "MTC_Adapter\$env:SOL_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
- *cleanup-zip
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "MTC_Adapter\$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:DebugSymbols=false /p:DebugType=None /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
- *zipper
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
EgwProxy.Icoel:build:release:
|
||||
stage: release
|
||||
needs: ["EgwProxy.Icoel:build"]
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
CONFIG: Release
|
||||
APP_NAME: EgwProxy.Icoel
|
||||
only:
|
||||
refs:
|
||||
- SDK/Icoel
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
- *nuspec-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
|
||||
- '& Remove-Item *.nupkg'
|
||||
- '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
|
||||
# - '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.csproj" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
|
||||
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"workbench.colorCustomizations": {}
|
||||
}
|
||||
Vendored
+45
-58
@@ -8,18 +8,11 @@ pipeline {
|
||||
stage('Checkout') {
|
||||
agent any
|
||||
steps {
|
||||
/* build delle SteamWare libs! */
|
||||
/*build 'SteamWare/SteamWareLib'*/
|
||||
/* copio le libs...*/
|
||||
// step([$class: 'CopyArtifact', fingerprintArtifacts: true, projectName: 'Steamware/SteamWareLib', selector: [$class: 'WorkspaceSelector'], target: '../Steamware/SteamWareLib'])
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=293']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SCMA'
|
||||
}
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILD_DATE_FORMATTED, "ddHH"}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SCMA'
|
||||
}
|
||||
script {
|
||||
currentBuild.displayName = "${env.versionNumber}"
|
||||
@@ -31,8 +24,8 @@ pipeline {
|
||||
}
|
||||
}
|
||||
// CAMBIO numero versione + checkout NuGet in file sorgente!!!
|
||||
bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\MTC_Adapter\\SCMA.sln"
|
||||
bat "e:\\fart.exe ${WORKSPACE}\\MTC_Adapter\\VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
//fixNuget("${WORKSPACE}\\MTC_Adapter\\SCMA.sln")
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
@@ -41,8 +34,8 @@ pipeline {
|
||||
script {
|
||||
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '180', artifactNumToKeepStr: '30', daysToKeepStr: '360', numToKeepStr: '30')), pipelineTriggers([])])
|
||||
// CAMBIO numero versione + checkout NuGet in file sorgente!!!
|
||||
bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\MTC_Adapter\\SCMA.sln"
|
||||
bat "e:\\fart.exe ${WORKSPACE}\\MTC_Adapter\\VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
fixNuget("${WORKSPACE}\\MTC_Adapter\\SCMA.sln")
|
||||
}
|
||||
script {
|
||||
/* compilo installers in base al BRANCH del cliente... */
|
||||
@@ -50,11 +43,11 @@ pipeline {
|
||||
parallel (
|
||||
DB: {
|
||||
sleep 1
|
||||
bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/MTC-ADB/MTC-ADB.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
|
||||
bat "\"${tool 'MSBuild-16.0'}\" MTC_Adapter/MTC-ADB/MTC-ADB.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
|
||||
},
|
||||
MAIN: {
|
||||
sleep 0
|
||||
bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
|
||||
bat "\"${tool 'MSBuild-16.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /p:verbosity=minimal /m"
|
||||
},
|
||||
failFast: false)
|
||||
}
|
||||
@@ -70,8 +63,8 @@ pipeline {
|
||||
// in primis fix versione e recupero pacchetti...
|
||||
script {
|
||||
// CAMBIO numero versione + checkout NuGet in file sorgente!!!
|
||||
bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\MTC_Adapter\\SCMA.sln"
|
||||
bat "e:\\fart.exe ${WORKSPACE}\\MTC_Adapter\\VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
fixNuget("${WORKSPACE}\\MTC_Adapter\\SCMA.sln")
|
||||
}
|
||||
// poi compilo
|
||||
script {
|
||||
@@ -85,7 +78,7 @@ pipeline {
|
||||
// pulizia directory BIN
|
||||
bat "RD /S /Q \"${WORKSPACE}\\MTC_Adapter\\MTC-ADB\\bin\" || EXIT /B 0"
|
||||
// BUILD adapter MySql!
|
||||
bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/MTC-ADB/MTC-ADB.csproj -target:Build /p:Configuration=${env.BRANCH_NAME} /p:VisualStudioVersion=15.0 /p:RunCodeAnalysis=false /p:Platform=\"Any CPU\" /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /m"
|
||||
bat "\"${tool 'MSBuild-16.0'}\" MTC_Adapter/MTC-ADB/MTC-ADB.csproj -target:Build /p:Configuration=${env.BRANCH_NAME} /p:VisualStudioVersion=15.0 /p:RunCodeAnalysis=false /p:Platform=\"Any CPU\" /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /p:verbosity=minimal /m"
|
||||
}
|
||||
else {
|
||||
// pulizia directory BIN
|
||||
@@ -94,7 +87,7 @@ pipeline {
|
||||
env.currConfig='CMS-FANUC'
|
||||
}
|
||||
else if (env.BRANCH_NAME == "KVARA") {
|
||||
env.currConfig='SCM-ESA'
|
||||
env.currConfig='CMS-ESA'
|
||||
}
|
||||
else if (env.BRANCH_NAME == "OSAI") {
|
||||
env.currConfig='CMS-OSAI'
|
||||
@@ -105,12 +98,8 @@ pipeline {
|
||||
else {
|
||||
env.currConfig='Release'
|
||||
}
|
||||
bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:FS30D=1 /p:SIEMENS=1 /p:Configuration=${env.currConfig} /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /m"
|
||||
|
||||
// // Build adapters VERI
|
||||
// // bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:FS30D=1 /p:SIEMENS=1 /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/${env.versionNumber} /m"
|
||||
// // bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/${env.versionNumber} /m"
|
||||
// // bat "\"${tool 'MSBuild-15.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:FS30D=1 /p:SIEMENS=1 /p:Configuration=${env.BRANCH_NAME} /p:VisualStudioVersion=15.0 /p:RunCodeAnalysis=false /p:Platform=\"Any CPU\" /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /m"
|
||||
// Build adapters MTC/OPC-UA-RED
|
||||
bat "\"${tool 'MSBuild-16.0'}\" MTC_Adapter/SCMA/SCMA.csproj -target:Build /p:DefineConstants=\"FS30D=1,SIEMENS=1\" /p:Configuration=${env.currConfig} /p:DebugSymbols=false /p:DebugType=None /p:OutputPath=bin/${env.versionNumber} /p:verbosity=minimal /m"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,7 +132,7 @@ pipeline {
|
||||
bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\SCMA.zip ${WORKSPACE}\\MTC_Adapter\\MTC-ADB\\bin\\${env.versionNumber}\\*"
|
||||
}
|
||||
else {
|
||||
// Compressione in .zip dell'installer x adapter MTC-OPC-UA-RED...
|
||||
// Compressione in .zip dell'installer x adapter MTC/OPC-UA-RED...
|
||||
bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\SCMA.zip ${WORKSPACE}\\MTC_Adapter\\SCMA\\bin\\${env.versionNumber}\\*"
|
||||
}
|
||||
|
||||
@@ -158,40 +147,17 @@ pipeline {
|
||||
}
|
||||
post {
|
||||
success {
|
||||
sendEmail("Successful")
|
||||
sendSlack("Successful", "good")
|
||||
}
|
||||
failure {
|
||||
sendEmail("Failed")
|
||||
sendSlack("Failed", "danger")
|
||||
}
|
||||
unstable {
|
||||
sendEmail("Unstable")
|
||||
sendSlack("Unstable", "warning")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // Funzione x pubblicazione su server IIS di deploy
|
||||
// def publishToDeployServer(prjPath, iisPath, packName) {
|
||||
// echo "Richiesto esecuzione publishToDeployServer con parametri: " + prjPath + " | " + iisPath + " | " + packName
|
||||
// // inizio copiando files di base da area VersGen...
|
||||
// bat "xcopy /y VersGen\\ChangeLog.html " + prjPath + "Resources\\ChangeLog.html "
|
||||
// bat "xcopy /y VersGen\\logoSteamware.png " + prjPath + "Resources\\logoSteamware.png "
|
||||
// bat "xcopy /y VersGen\\manifest.xml " + prjPath + "Resources\\manifest.xml "
|
||||
// // manifest.xml: aggiorno versNumber ed URL del branch di update...
|
||||
// bat "e:\\fart.exe " + prjPath + "Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
// bat "e:\\fart.exe " + prjPath + "Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
|
||||
// bat "e:\\fart.exe " + prjPath + "Resources\\manifest.xml {{PACKNAME}} " + packName + " || EXIT /B 0"
|
||||
// bat "e:\\fart.exe " + prjPath + "Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || EXIT /B 0"
|
||||
// writeFile file: prjPath + 'changeLog.log', text: "${getChangeString()}"
|
||||
// powershell '(Get-Content ' + prjPath + 'Resources\\ChangeLog.html) | ForEach-Object { $_ -replace \"{{LAST-CHANGES}}\", \"${getChangeString()}\" } | Set-Content ' + prjPath + 'Resources\\ChangeLog.html'
|
||||
// // copio ed esporto in IIS02 i vari files .xml, .html, .zip
|
||||
// bat "xcopy /y " + prjPath + "Resources\\manifest.xml " + iisPath + packName + "\\${env.BRANCH_NAME}\\ "
|
||||
// bat "xcopy /y " + prjPath + "Resources\\ChangeLog.html " + iisPath + packName + "\\${env.BRANCH_NAME}\\ "
|
||||
// bat "xcopy /y " + prjPath + "Resources\\logoSteamware.png " + iisPath + packName + "\\${env.BRANCH_NAME}\\ "
|
||||
// // salvo copia della versione...
|
||||
// bat "xcopy /y " + prjPath + "\\ReleaseClienti\\${env.BRANCH_NAME}\\* E:\\Staging\\byProd\\MP\\${env.BRANCH_NAME}\\" + packName + "\\${env.versionNumber}\\ "
|
||||
// // copio x AutoUpdate deploy
|
||||
// bat "xcopy /y " + prjPath + "\\ReleaseClienti\\${env.BRANCH_NAME}\\" + packName + ".zip " + iisPath + packName + "\\${env.BRANCH_NAME}\\ "
|
||||
// }
|
||||
@NonCPS
|
||||
// Funzione x recupero changeLog
|
||||
def getChangeString() {
|
||||
@@ -214,10 +180,31 @@ def getChangeString() {
|
||||
}
|
||||
return changeString
|
||||
}
|
||||
// Funzione x invio email
|
||||
def sendEmail(status) {
|
||||
mail (
|
||||
to: "$EMAIL_RECIPIENTS",
|
||||
subject: "Build $BUILD_NUMBER - " + status + " ($JOB_NAME)",
|
||||
body: "Modifiche:\n " + getChangeString() + "\n\n Verifica console output: $BUILD_URL/console" + "\n")
|
||||
// Funzione x invio slack
|
||||
def sendSlack(status, colorCode) {
|
||||
slackSend (
|
||||
color: colorCode,
|
||||
channel: "#scma-dev",
|
||||
failOnError: false,
|
||||
message: "${env.JOB_NAME} ${env.versionNumber} | " + status + ": Build ${env.BUILD_NUMBER}\n\n" +
|
||||
"Modifiche:\n " + getChangeString() + "\n\n Verifica build: <${env.BUILD_URL}|Apri>" + "\n"
|
||||
)
|
||||
}
|
||||
// funzione x fix pacchetti nuget da NOSTRO repo Nexus con proxy
|
||||
def fixNuget(solutionFile) {
|
||||
// bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-group"
|
||||
// solo la prima volta va aggiunta...
|
||||
hasSource = bat "e:\\nuget sources list | find \"Steamware\" /C"
|
||||
if (hasSource == "0")
|
||||
{
|
||||
bat "e:\\nuget sources Add -Name \"Steamware Nexus\" -Source http://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\""
|
||||
}
|
||||
else
|
||||
{
|
||||
bat "e:\\nuget sources Update -Name \"Steamware Nexus\" -Source http://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\""
|
||||
}
|
||||
// preliminarmente svuoto...
|
||||
bat "rmdir /Q /S ${WORKSPACE}\\MTC_Adapter\\packages"
|
||||
// restore pacchetti
|
||||
bat "e:\\nuget.exe restore ${solutionFile}"
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
Devices = ../DATA/CONF/Agent_ItemList.xml
|
||||
AllowPut = true
|
||||
ReconnectInterval = 1000
|
||||
BufferSize = 17
|
||||
SchemaVersion = 1.3
|
||||
|
||||
Adapters {
|
||||
MTC-ADAPTER {
|
||||
Host = localhost
|
||||
Port = 7878
|
||||
}
|
||||
}
|
||||
|
||||
Files {
|
||||
schemas {
|
||||
Path = ../schemas
|
||||
Location = /schemas/
|
||||
}
|
||||
styles {
|
||||
Path = ../styles
|
||||
Location = /styles/
|
||||
}
|
||||
Favicon {
|
||||
Path = ../styles/favicon.ico
|
||||
Location = /favicon.ico
|
||||
}
|
||||
}
|
||||
|
||||
StreamsStyle {
|
||||
Location = /styles/Streams.xsl
|
||||
}
|
||||
|
||||
# Logger Configuration
|
||||
logger_config
|
||||
{
|
||||
logging_level = debug
|
||||
output = cout
|
||||
}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
@echo off
|
||||
|
||||
REM variabili accessorie
|
||||
set baseDir="C:\CMS\MTC\AGENT\bin\"
|
||||
|
||||
REM calcolo timestamp x creare folders
|
||||
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
|
||||
set YYYY=%dt:~0,4%
|
||||
set MM=%dt:~4,2%
|
||||
set DD=%dt:~6,2%
|
||||
set HH=%dt:~8,2%
|
||||
set Min=%dt:~10,2%
|
||||
set Sec=%dt:~12,2%
|
||||
set stamp=%YYYY%%MM%%DD%_%HH%%Min%%Sec%
|
||||
|
||||
REM Fermo servizio
|
||||
net stop "MTConnect Agent"
|
||||
|
||||
REM Attesa 3 secondi post stop
|
||||
timeout /t 3
|
||||
|
||||
REM spostamento di tutti i files di log
|
||||
mkdir "%baseDir%\logs\%stamp%"
|
||||
|
||||
move "%baseDir%\agent*.log" "%baseDir%\logs\%stamp%"
|
||||
|
||||
REM riavvio servizio
|
||||
net start "MTConnect Agent"
|
||||
|
||||
REM log riavvio
|
||||
echo %date% %time% - Service Restarted Successfully >> "%baseDir%\restart.log"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
Binary file not shown.
@@ -10,7 +10,7 @@
|
||||
<AssemblyName>CMSCncLib</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
@@ -52,58 +52,6 @@
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CMS-FANUC|AnyCPU' ">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\CMS\</OutputPath>
|
||||
<DocumentationFile>CMSCncLib.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DefineConstants>FS30D=1,SIEMENS=1</DefineConstants>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<WarningLevel>0</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'SCM-ESA|AnyCPU' ">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\SCM\</OutputPath>
|
||||
<DocumentationFile>CMSCncLib.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DefineConstants>FS30D=1,SIEMENS=1</DefineConstants>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<WarningLevel>0</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CMS-SIEMENS|AnyCPU'">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\CMS-SIEMENS\</OutputPath>
|
||||
<DefineConstants>FS30D=1,SIEMENS=1</DefineConstants>
|
||||
<DocumentationFile>CMSCncLib.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<WarningLevel>0</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CMS-OSAI|AnyCPU'">
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\CMS-OSAI\</OutputPath>
|
||||
<DefineConstants>FS30D=1,SIEMENS=1</DefineConstants>
|
||||
<DocumentationFile>CMSCncLib.xml</DocumentationFile>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<WarningLevel>0</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Siemens.Sinumerik.Operate.Services, Version=4.7.3.2, Culture=neutral, PublicKeyToken=bdd90fa02fd1c4ee, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -149,6 +97,7 @@
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@@ -1076,6 +1076,23 @@ Namespace CNC
|
||||
Return bRet
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Legge o scrive Parametri Interi
|
||||
''' </summary>
|
||||
''' <param name="bWrite">Se True SCRIVE, se False LEGGE</param>
|
||||
''' <param name="MemIndex">Indice di memoria</param>
|
||||
''' <param name="Size">1 byte, 2 word, 3 dword</param>
|
||||
''' <param name="Value">Valore da scrivere su scrittura o letto su lettura</param>
|
||||
''' <returns>True se andata a buon fine</returns>
|
||||
Public Overloads Function F_RW_ParamAllAxis_Integer(ByVal bWrite As Boolean, ByVal MemIndex As Integer, ByVal Size As Integer, ByRef Value As Object) As Boolean
|
||||
Dim bRet As Boolean
|
||||
Dim oValue(0) As Object
|
||||
If bWrite Then oValue(0) = Value
|
||||
bRet = F_RW_Param_Integer(bWrite, -1, MemIndex, Size, oValue)
|
||||
If Not bWrite Then Value = oValue(0)
|
||||
Return bRet
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
''' <summary>
|
||||
@@ -1495,19 +1512,29 @@ Namespace CNC
|
||||
|
||||
#Region "Funzioni specifiche IOT"
|
||||
|
||||
|
||||
Public Function getAllAxisPos() As Focas1.ODBPOS
|
||||
''' <summary>
|
||||
''' GCodes del path CORRENTE tipo MODALI (se nPAthIdx = 0 --> usa PATH ATTIVO)
|
||||
'''
|
||||
''' Optional nPathIdx As Integer = 0
|
||||
''' </summary>
|
||||
''' <param name="nPathIdx">NumPath 1..n, se 0 = PATH ATTIVO</param>
|
||||
''' <returns></returns>
|
||||
Public Function getAllAxisPos(nPathIdx As Integer) As Focas1.ODBPOS
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdposition.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
Dim posizAssi As Focas1.ODBPOS
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
@@ -1521,22 +1548,32 @@ Namespace CNC
|
||||
End If
|
||||
End If
|
||||
|
||||
' resize in base al num di assi...
|
||||
|
||||
Return posizAssi
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getAllAxisLoad() As Focas1.ODBSVLOAD
|
||||
''' <summary>
|
||||
''' GCodes del path CORRENTE tipo MODALI (se nPAthIdx = 0 --> usa PATH ATTIVO)
|
||||
''' </summary>
|
||||
''' <param name="nPathIdx">NumPath 1..n, se 0 = PATH ATTIVO</param>
|
||||
''' <returns></returns>
|
||||
Public Function getAllAxisLoad(nPathIdx As Integer) As Focas1.ODBSVLOAD
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdsvmeter.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
Dim caricoAssi As Focas1.ODBSVLOAD
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
@@ -1617,11 +1654,11 @@ Namespace CNC
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getAllDynData() As Focas1.ODBDY2_1
|
||||
Public Function getAllDynData(Optional nPathIdx As Integer = 0) As Focas1.ODBDY2_1
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rddynamic2.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
@@ -1629,8 +1666,12 @@ Namespace CNC
|
||||
' inizializzo
|
||||
allData = New Focas1.ODBDY2_1
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
@@ -1690,12 +1731,16 @@ Namespace CNC
|
||||
Return allData
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getPathGCodeMod() As Focas1.ODBGCD
|
||||
''' <summary>
|
||||
''' GCodes del path CORRENTE tipo MODALI (se nPAthIdx = 0 --> usa PATH ATTIVO)
|
||||
''' </summary>
|
||||
''' <param name="nPathIdx">NumPath 1..n, se 0 = PATH ATTIVO</param>
|
||||
''' <returns></returns>
|
||||
Public Function getPathGCodeMod(Optional nPathIdx As Integer = 0) As Focas1.ODBGCD
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
@@ -1703,8 +1748,12 @@ Namespace CNC
|
||||
' inizializzo
|
||||
actGCode = New Focas1.ODBGCD
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
@@ -1721,12 +1770,17 @@ Namespace CNC
|
||||
Return actGCode
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getPathGCode1Shot() As Focas1.ODBGCD
|
||||
''' <summary>
|
||||
''' GCodes del path CORRENTE tipo 1 shot (se nPAthIdx = 0 --> usa PATH ATTIVO)
|
||||
''' </summary>
|
||||
''' <param name="nPathIdx">NumPath 1..n, se 0 = PATH ATTIVO</param>
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function getPathGCode1Shot(Optional nPathIdx As Integer = 0) As Focas1.ODBGCD
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Misc\cnc_rdgcode.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
@@ -1734,8 +1788,12 @@ Namespace CNC
|
||||
' inizializzo
|
||||
actGCode = New Focas1.ODBGCD
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
@@ -1752,12 +1810,17 @@ Namespace CNC
|
||||
Return actGCode
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getPathTTCoord() As Focas1.ODB5AXMAN
|
||||
''' <summary>
|
||||
''' Coordinate di lavoro (punta utensile) del path CORRENTE (se nPAthIdx = 0 --> usa PATH ATTIVO)
|
||||
''' </summary>
|
||||
''' <param name="nPathIdx">NumPath 1..n, se 0 = PATH ATTIVO</param>
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function getPathTTCoord(Optional nPathIdx As Integer = 0) As Focas1.ODB5AXMAN
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rd5axmandt.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
@@ -1765,8 +1828,12 @@ Namespace CNC
|
||||
' inizializzo
|
||||
ttCoord = New Focas1.ODB5AXMAN
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
@@ -1783,19 +1850,28 @@ Namespace CNC
|
||||
Return ttCoord
|
||||
|
||||
End Function
|
||||
|
||||
Public Function getSpindleSpeed() As Focas1.ODBSPEED
|
||||
''' <summary>
|
||||
''' Velocità mandrino del path CORRENTE (se nPAthIdx = 0 --> usa PATH ATTIVO)
|
||||
''' </summary>
|
||||
''' <param name="nPathIdx">NumPath 1..n, se 0 = PATH ATTIVO</param>
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function getSpindleSpeed(Optional nPathIdx As Integer = 0) As Focas1.ODBSPEED
|
||||
' RIFERIMENTO:
|
||||
' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdspeed.htm
|
||||
|
||||
Dim nPathIdx As Integer
|
||||
'Dim nPathIdx As Integer
|
||||
Dim nNumAxisRead As Integer
|
||||
Dim nReturn As Integer
|
||||
|
||||
Dim speedAssi As Focas1.ODBSPEED
|
||||
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
' se fosse 0 --> leggo path attivo...
|
||||
If (nPathIdx = 0) Then
|
||||
'leggo il numero del processo attivo
|
||||
nPathIdx = GetActivePath()
|
||||
End If
|
||||
|
||||
'leggo num max assi dal cn
|
||||
nNumAxisRead = Focas1.MAX_AXIS
|
||||
|
||||
|
||||
@@ -1018,6 +1018,7 @@ Retry: nRetry += 1
|
||||
Dim myGetAxesInfo3R As OPENcontrol.GetAxesInfo3R
|
||||
Dim myGetAxesInfo3 As New OPENcontrol.GetAxesInfo3
|
||||
Dim nRetry As Integer
|
||||
Dim axVirtual As Integer
|
||||
Retry: nRetry += 1
|
||||
|
||||
Try
|
||||
@@ -1030,7 +1031,8 @@ Retry: nRetry += 1
|
||||
|
||||
For i = 0 To 63
|
||||
If myGetAxesInfo3R.AxOwnerList(i) = ProcessId Then
|
||||
If (myGetAxesInfo3R.AxNameList(i) < Asc("a") Or myGetAxesInfo3R.AxNameList(i) > Asc("z")) And myGetAxesInfo3R.AxNameList(i) <> Asc("S") Then
|
||||
axVirtual = myGetAxesInfo3R.AxType(i) And 256
|
||||
If (myGetAxesInfo3R.AxNameList(i) < Asc("a") Or myGetAxesInfo3R.AxNameList(i) > Asc("z")) And myGetAxesInfo3R.AxNameList(i) <> Asc("S") And (axVirtual = 0) Then
|
||||
AxisTable(j) = Chr(myGetAxesInfo3R.AxNameList(i))
|
||||
AxisIdTable(j) = i + 1
|
||||
j += 1
|
||||
@@ -1062,7 +1064,7 @@ Retry: nRetry += 1
|
||||
'O_GetSelectedProcess(ProcessId)
|
||||
myGetAxesPosition.ProcNum = ProcessId
|
||||
myGetAxesPosition.AxisName = "0"
|
||||
myGetAxesPosition.NumAxis = AxisPos.Length
|
||||
myGetAxesPosition.NumAxis = 64
|
||||
myGetAxesPosition.Select = tipoPos
|
||||
|
||||
myGetAxesPositionR = OPENws.GetAxesPosition(myGetAxesPosition)
|
||||
|
||||
@@ -1060,10 +1060,12 @@ Namespace CNC
|
||||
' txt Giuseppe
|
||||
|
||||
ReDim itemRead(4)
|
||||
itemRead(0) = New Item("DB241.DBD0:[16]") 'Posizione attuale
|
||||
'itemRead(0) = New Item("DB241.DBD0:[16]") 'Posizione attuale
|
||||
itemRead(0) = New Item("/Channel/GeometricAxis/actToolEdgeCenterPos[u1,1,16]") 'Posizione attuale
|
||||
itemRead(1) = New Item("/Channel/MachineAxis/actFeedRate[u1,1,16]") ' param manual NC, pg21 legge la feed... da salvare in valore assolulto...
|
||||
itemRead(2) = New Item("/Channel/MachineAxis/feedRateOvr[u1,1,16]") ' param manual NC, pg215 legge la feedOver...
|
||||
itemRead(3) = New Item("/Channel/MachineAxis/toolBaseDistToGo[u1,1,16]")
|
||||
itemRead(2) = New Item("/Channel/MachineAxis/feedRateOvr[u1,1,16]") ' param manual NC, pg215 legge la feedOver...
|
||||
'itemRead(3) = New Item("/Channel/MachineAxis/toolBaseDistToGo[u1,1,16]") ' posizione tgt...
|
||||
itemRead(3) = New Item("/Channel/GeometricAxis/cmdProgPos[u1,1,16]") ' posizione tgt...
|
||||
itemRead(4) = New Item("/Channel/MachineAxis/aaLoad[u1,1,16]") ' param manual NC, pg426 legge carico effettivo asse PRIFIdrive in %... da sempre zero
|
||||
|
||||
'/Channel/MachineAxis/speedOvr[u1,1,16] speed override asse NON VA - errore-eccezione
|
||||
@@ -1088,8 +1090,8 @@ Namespace CNC
|
||||
|
||||
' faccio copia valori!
|
||||
For i As Integer = 0 To 15
|
||||
'datiAssi(i).PosAct = itemRead(0).Value(i)
|
||||
datiAssi(i).PosAct = UIntegerToSingle(itemRead(0).Value(i))
|
||||
'datiAssi(i).PosAct = UIntegerToSingle(itemRead(0).Value(i))
|
||||
datiAssi(i).PosAct = Convert.ToSingle(itemRead(0).Value(i))
|
||||
datiAssi(i).Feed = Math.Abs(Convert.ToSingle(itemRead(1).Value(i)))
|
||||
datiAssi(i).FeedOver = Math.Abs(Convert.ToSingle(itemRead(2).Value(i)))
|
||||
datiAssi(i).PosTgt = Convert.ToSingle(itemRead(3).Value(i))
|
||||
@@ -1330,13 +1332,15 @@ Namespace CNC
|
||||
Public Function getCncAlarm() As Alarm()
|
||||
' RIFERIMENTO:
|
||||
' SynumerikOperate_Net, pg 101 --> 110
|
||||
|
||||
|
||||
' restituisco vettore allarmi...
|
||||
Return currAlarms
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Il codice è stato generato da uno strumento.
|
||||
' Versione runtime:4.0.30319.42000
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
' il codice viene rigenerato.
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
|
||||
+13
-13
@@ -1,10 +1,10 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Il codice è stato generato da uno strumento.
|
||||
' Versione runtime:4.0.30319.42000
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
' il codice viene rigenerato.
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
@@ -15,14 +15,14 @@ Imports System
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder.
|
||||
'tramite uno strumento quale ResGen o Visual Studio.
|
||||
'Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen
|
||||
'con l'opzione /str oppure ricompilare il progetto VS.
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
@@ -33,7 +33,7 @@ Namespace My.Resources
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
@@ -47,8 +47,8 @@ Namespace My.Resources
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
|
||||
''' ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Il codice è stato generato da uno strumento.
|
||||
' Versione runtime:4.0.30319.42000
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
' il codice viene rigenerato.
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
@@ -15,21 +15,21 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Funzionalità di salvataggio automatico My.Settings"
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,4 +30,4 @@
|
||||
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType" name="OPENcontrol"/>
|
||||
</client>
|
||||
</system.serviceModel>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,172 @@
|
||||
[SYS]
|
||||
DEFCN=c:\kvara\Discoi
|
||||
IOREDIR=c:\kvara\Discoi
|
||||
CNINI=c:\kvara\DiscoC\Kvara.ini
|
||||
;LINK=SERIALE
|
||||
;LINK=NETWORK
|
||||
LINK=SIMULATO
|
||||
PERMISSION=APPLICATION
|
||||
;CNSIGNAL=0
|
||||
TMX=0
|
||||
TMY=1
|
||||
TMZ=4
|
||||
|
||||
[COM]
|
||||
IPAddr=10.10.51.100
|
||||
PORT=2
|
||||
;BAUD=38400
|
||||
;MODEM=1
|
||||
;MODEMFILE=.\MODEM.INI
|
||||
;DATATIMEOUT=2000
|
||||
;ACKTIMEOUT=300
|
||||
;SYNCTIMEOUT=1000
|
||||
OPENCHTIMEOUT=20000
|
||||
CLOSECHWAIT=1000
|
||||
;INITSYNC=0
|
||||
;DBG_INFO=8
|
||||
WAITRESETINIT=5000
|
||||
WAITRESETSYNC=5000
|
||||
|
||||
[PLC]
|
||||
SIMDIR=c:\kvara\Logica\TAR
|
||||
TARDIR=C:\PLC
|
||||
|
||||
[GLOBAL]
|
||||
Language=ITA
|
||||
Background=c:\kvara\res\Background.bmp
|
||||
Mouse=ON
|
||||
Dimensions=1200x800
|
||||
Docked=R|D
|
||||
FunKeyRedir=HV
|
||||
;InitFile=Init
|
||||
FunKeyStringDisplay=0
|
||||
AlarmFile=c:\kvara\exe\AlrData.alm
|
||||
StatusH = 50
|
||||
HKeysHsH = 55
|
||||
ExtFunKeyBtn=0
|
||||
StartDrvKey500=0
|
||||
|
||||
[LoadApp]
|
||||
Slave=.\Sim32.exe /0G /A144 /P32
|
||||
NCrun=.\Ncrun.exe /L-
|
||||
PLC=.\Lnk.exe
|
||||
;ShDump=c:\kvara\exe\shdump /HIDE /F:A:shdump.gz
|
||||
|
||||
[CHA.PATH]
|
||||
PGM=c:\kvara\DiscoC\ISO;c:\kvara\DiscoI\ISO;c:\kvara\DiscoD\MDI;c:\kvara\DiscoD\PGM;c:\kvara\DiscoD\TMP
|
||||
CFU=c:\kvara\DiscoC\ISO;c:\kvara\DiscoI\ISO
|
||||
MDI=c:\kvara\DiscoD\MDI
|
||||
CFS=c:\kvara\DiscoC\ISO;c:\kvara\DiscoI\ISO
|
||||
CFM=c:\kvara\DiscoC\ISO;c:\kvara\DiscoI\ISO
|
||||
OVR=c:\kvara\DiscoC
|
||||
PGMHOST=D:\TMP
|
||||
PGMTMP=c:\kvara\DiscoD\TMP
|
||||
CFCDLL=$
|
||||
CVBDLL=$
|
||||
APIODLL=$
|
||||
PMIDLL=.
|
||||
TMAPIDLL=$
|
||||
|
||||
SLAOSC=c:\kvara\DiscoI\SlaOsc.dll
|
||||
SLADLL=c:\kvara\DiscoI\Sladll.dll
|
||||
DGTDLL=c:\kvara\Discoi\mclink.dll
|
||||
|
||||
[CHA.EXT]
|
||||
PGM=PGM
|
||||
CFU=CFU
|
||||
CFS=CFS
|
||||
CFM=CFM
|
||||
CST=CST
|
||||
|
||||
[ENV]
|
||||
LOG=c:\kvara\DiscoF
|
||||
FNZAUX=c:\kvara\DiscoC\ISO;c:\kvara\DiscoI\ISO
|
||||
;FNZCST=c:\kvara\DiscoC\ISO
|
||||
|
||||
[UIM.PATH]
|
||||
CFG=c:\kvara\Dati
|
||||
HFG=c:\kvara\Dati
|
||||
PIC=c:\kvara\Dati
|
||||
DATA=c:\kvara\Dati\Par
|
||||
HISTORY=c:\kvara\Dati
|
||||
PLCERR=c:\kvara\Dati
|
||||
PLCMSG=c:\kvara\Dati
|
||||
RUNERR=c:\kvara\Dati
|
||||
PHIERR=c:\kvara\Dati
|
||||
MDI=c:\kvara\DiscoD\MDI
|
||||
|
||||
MONCLR=c:\kvara\exe\Monitor.ini
|
||||
|
||||
[APP]
|
||||
GRAPH=0
|
||||
PREVIEW=1
|
||||
3D=1
|
||||
|
||||
[CHMONITOR]
|
||||
FPAXE=c:\kvara\Dati\parax.str
|
||||
FNAXE=c:\kvara\Dati\parax?.nam
|
||||
KEYPADRE=KEY_SYSPARAX
|
||||
KEYASSI=KEY_PARAX
|
||||
|
||||
[AUTOSETUP]
|
||||
Inifile=c:\kvara\autosetup.ini
|
||||
BootLoader=c:\kvara\Tar\BootLdr.bin
|
||||
DiscoH=c:\kvara\DiscoH
|
||||
DiscoI=c:\kvara\DiscoI
|
||||
DiscoC=c:\kvara\DiscoC
|
||||
DiscoD=c:\kvara\DiscoD
|
||||
DiscoF=c:\kvara\DiscoF
|
||||
PlcProj=c:\kvara\Logica\ACCORD_10.kva
|
||||
|
||||
[DESKFONT]
|
||||
//"SysMenuFnt", "Arial", 32, 7, FW_MEDIUM,
|
||||
//"CaptionFnt", "Arial", 28, 11, FW_MEDIUM,
|
||||
//"AlarmsFnt", "Arial", 11, 7, FW_MEDIUM,
|
||||
//"PicButtonFnt", "Arial", 16, 5, FW_MEDIUM,
|
||||
//"PicButtonSFnt", -nHeight, nWidth, 0, 0, nBOLD, FALSE, FALSE, 0,
|
||||
//"KeyTipFnt", "Arial", 11, 5, FW_MEDIUM,
|
||||
//"TimeFnt", "Arial", 11, 7, 0,
|
||||
//"LCDFnt", "Arial", 32, 0, FW_BOLD,
|
||||
//"ILCDFnt", "Arial", 14, 0, FW_BOLD,
|
||||
|
||||
//FW_DONTCARE 0
|
||||
//FW_THIN 100
|
||||
//FW_EXTRALIGHT 200
|
||||
//FW_LIGHT 300
|
||||
//FW_NORMAL 400
|
||||
//FW_MEDIUM 500
|
||||
//FW_SEMIBOLD 600
|
||||
//FW_BOLD 700
|
||||
//FW_EXTRABOLD 800
|
||||
//FW_HEAVY 900
|
||||
|
||||
|
||||
PicButtonFnt=MS Sans Serif
|
||||
PicButtonFntBOLD=800
|
||||
PicButtonFntHEIGHT=20
|
||||
PicButtonFntWIDTH=8
|
||||
|
||||
AlarmsFnt=Arial
|
||||
AlarmsFntHEIGHT=14
|
||||
AlarmsFntWIDTH=10
|
||||
AlarmsFntBOLD=800
|
||||
|
||||
CaptionFnt= Ms Sans Serif
|
||||
CaptionFntHEIGHT=34
|
||||
CaptionFntBOLD=800
|
||||
|
||||
[Font]
|
||||
Bold=0
|
||||
Italic=0
|
||||
Size=10
|
||||
FaceName=Courier
|
||||
[Edit]
|
||||
Autosave=0
|
||||
Time=10
|
||||
Sound=0
|
||||
TabSize=2
|
||||
KeepTab=1
|
||||
[Colors]
|
||||
Fore=0 0 0 0 0 0 0
|
||||
Back=15
|
||||
Punte=0 0 0 0 0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{884C07F1-7E6E-4A3D-BF1E-FECF36348268}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EsaCncLib</RootNamespace>
|
||||
<AssemblyName>EsaCncLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>true</UseVSHostingProcess>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ESAutomotionLinkCNC, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>DLL Comunicazione ESA\ESAutomotionLinkCNC.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="clsTimePeriod.cs" />
|
||||
<Compile Include="IniFile.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="thdNcBase.cs" />
|
||||
<Compile Include="thdNcEsaGvKvara.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="DLL Comunicazione ESA\ESAutomotionLinkCNC.dll" />
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,246 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Globalization;
|
||||
|
||||
namespace EsaCncLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new INI file to store or load data
|
||||
/// </summary>
|
||||
public class IniFile
|
||||
{
|
||||
public string FileName; // INI filename
|
||||
|
||||
// import windows dll functions
|
||||
#region DLL_IMPORT_FUNCTIONS
|
||||
[DllImport("kernel32", CharSet = CharSet.Auto, BestFitMapping = false)]
|
||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
[DllImport("kernel32")]
|
||||
private static extern bool WritePrivateProfileSection(string section, string value, string filePath);
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileInt(string section, string key, int def, string filePath);
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileSection(string section, IntPtr retVal, uint size, string filePath);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <PARAM name="INIPath"></PARAM>
|
||||
public IniFile(string INIPath)
|
||||
{
|
||||
FileName = INIPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write data to the INI file
|
||||
/// </summary>
|
||||
/// <PARAM name="Section"></PARAM>
|
||||
/// Section name
|
||||
/// <PARAM name="Key"></PARAM>
|
||||
/// Key Name
|
||||
/// <PARAM name="Value"></PARAM>
|
||||
/// Value Name
|
||||
public void WriteString(string Section, string Key, string Value)
|
||||
{
|
||||
WritePrivateProfileString(Section, Key, Value, FileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a boolean value
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="Value"></param>
|
||||
public void WriteBoolean(string Section, string Key, bool Value)
|
||||
{
|
||||
int flag = Value ? 1 : 0;
|
||||
WriteString(Section, Key, Convert.ToString(flag));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write an integer value
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="Value"></param>
|
||||
public void WriteInteger(string Section, string Key, int Value)
|
||||
{
|
||||
WriteString(Section, Key, Convert.ToString(Value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write a double value
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="Value"></param>
|
||||
public void WriteDouble(string Section, string Key, double Value)
|
||||
{
|
||||
WriteString(Section, Key, Convert.ToString(Value, NumberFormatInfo.InvariantInfo));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the Ini file
|
||||
/// </summary>
|
||||
/// <PARAM name="Section"></PARAM>
|
||||
/// <PARAM name="Key"></PARAM>
|
||||
/// <PARAM name="Path"></PARAM>
|
||||
/// <returns></returns>
|
||||
public string ReadString(string Section, string Key)
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(255);
|
||||
int i = GetPrivateProfileString(Section, Key, "", temp, 255, FileName);
|
||||
return temp.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a string. If not found use default value
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="DefaultVal"></param>
|
||||
/// <returns></returns>
|
||||
public string ReadString(string Section, string Key, string DefaultVal)
|
||||
{
|
||||
string temp = ReadString(Section, Key);
|
||||
if (temp == "") temp = DefaultVal;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read an integer
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
public int ReadInteger(string Section, string Key)
|
||||
{
|
||||
return GetPrivateProfileInt(Section, Key, 0, FileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read an integer. If not found use default value
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="DefaultVal"></param>
|
||||
/// <returns></returns>
|
||||
public int ReadInteger(string Section, string Key, int DefaultVal)
|
||||
{
|
||||
return GetPrivateProfileInt(Section, Key, DefaultVal, FileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a boolean
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
public bool ReadBoolean(string Section, string Key)
|
||||
{
|
||||
return (ReadInteger(Section, Key, 0) != 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a boolean with default value
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="DefaultVal"></param>
|
||||
/// <returns></returns>
|
||||
public bool ReadBoolean(string Section, string Key, bool DefaultVal)
|
||||
{
|
||||
int v = DefaultVal ? 1 : 0;
|
||||
return (ReadInteger(Section, Key, v) != 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a complete section (keys=values)
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// Section name
|
||||
/// <returns></returns>
|
||||
public string[] ReadSection(string Section)
|
||||
{
|
||||
const int bufferSize = 2048; // max is 32767
|
||||
|
||||
StringBuilder returnedString = new StringBuilder();
|
||||
|
||||
IntPtr pReturnedString = Marshal.AllocCoTaskMem(bufferSize);
|
||||
try
|
||||
{
|
||||
int bytesReturned = GetPrivateProfileSection(Section, pReturnedString, bufferSize, FileName);
|
||||
|
||||
//bytesReturned -1 to remove trailing \0
|
||||
for (int i = 0; i < bytesReturned - 1; i++)
|
||||
returnedString.Append((char)Marshal.ReadByte(new IntPtr((uint)pReturnedString + (uint)i)));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeCoTaskMem(pReturnedString);
|
||||
}
|
||||
|
||||
string sectionData = returnedString.ToString();
|
||||
return sectionData.Split('\0');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if value exists
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
/// <returns></returns>
|
||||
public bool ValueExists(string Section, string Key)
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(255);
|
||||
int i = GetPrivateProfileString(Section, Key, "", temp, 255, FileName);
|
||||
return (i > 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Completely remove one section
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
public void IniDeleteSection(string Section)
|
||||
{
|
||||
WritePrivateProfileSection(Section, null, FileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if section exists
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <returns></returns>
|
||||
public bool IniSectionExists(string Section)
|
||||
{
|
||||
int bytesReturned = 0;
|
||||
const int bufferSize = 2048; // max is 32767
|
||||
IntPtr pReturnedString = Marshal.AllocCoTaskMem(bufferSize);
|
||||
try
|
||||
{
|
||||
bytesReturned = GetPrivateProfileSection(Section, pReturnedString, bufferSize, FileName);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeCoTaskMem(pReturnedString);
|
||||
}
|
||||
return (bytesReturned > 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a key from section
|
||||
/// </summary>
|
||||
/// <param name="Section"></param>
|
||||
/// <param name="Key"></param>
|
||||
public void IniDeleteKey(string Section, string Key)
|
||||
{
|
||||
WritePrivateProfileString(Section, Key, null, FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-11
@@ -4,38 +4,53 @@
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||
|
||||
<!-- optional, add some variables
|
||||
|
||||
<!-- optional, add some variabeles
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
<targets async="true">
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File"
|
||||
name="f"
|
||||
fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}"
|
||||
/>
|
||||
<!--<target xsi:type="File"
|
||||
name="default"
|
||||
layout="${longdate} - ${level:uppercase=true}: ${message}${onexception:${newline}EXCEPTION\: ${exception:format=ToString}}"
|
||||
fileName="${specialfolder:ApplicationData}\${appName}\Debug.log"
|
||||
keepFileOpen="false"
|
||||
archiveFileName="${specialfolder:ApplicationData}\${appName}\Debug_${shortdate}.{##}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveEvery="Day"
|
||||
maxArchiveFiles="30"
|
||||
/>-->
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
</rules>
|
||||
</nlog>
|
||||
</nlog>
|
||||
+671
-189
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("EsaCncLib")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("EsaCncLib")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("7a12fe26-9c58-4630-973d-d4872374dbaf")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal sealed class TimePeriod : IDisposable
|
||||
{
|
||||
private const string WINMM = "winmm.dll";
|
||||
|
||||
private static TIMECAPS timeCapabilities;
|
||||
|
||||
private static int inTimePeriod;
|
||||
|
||||
private readonly int period;
|
||||
|
||||
private int disposed;
|
||||
|
||||
[DllImport(WINMM, ExactSpelling = true)]
|
||||
private static extern int timeGetDevCaps(ref TIMECAPS ptc, int cbtc);
|
||||
|
||||
[DllImport(WINMM, ExactSpelling = true)]
|
||||
private static extern int timeBeginPeriod(int uPeriod);
|
||||
|
||||
[DllImport(WINMM, ExactSpelling = true)]
|
||||
private static extern int timeEndPeriod(int uPeriod);
|
||||
|
||||
static TimePeriod()
|
||||
{
|
||||
int result = timeGetDevCaps(ref timeCapabilities, Marshal.SizeOf(typeof(TIMECAPS)));
|
||||
if (result != 0)
|
||||
{
|
||||
throw new InvalidOperationException("The request to get time capabilities was not completed because an unexpected error with code " + result + " occured.");
|
||||
}
|
||||
}
|
||||
|
||||
internal TimePeriod(int period)
|
||||
{
|
||||
if (Interlocked.Increment(ref inTimePeriod) != 1)
|
||||
{
|
||||
Interlocked.Decrement(ref inTimePeriod);
|
||||
throw new NotSupportedException("The process is already within a time period. Nested time periods are not supported.");
|
||||
}
|
||||
|
||||
if (period < timeCapabilities.wPeriodMin || period > timeCapabilities.wPeriodMax)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("period", "The request to begin a time period was not completed because the resolution specified is out of range.");
|
||||
}
|
||||
|
||||
int result = timeBeginPeriod(period);
|
||||
if (result != 0)
|
||||
{
|
||||
throw new InvalidOperationException("The request to begin a time period was not completed because an unexpected error with code " + result + " occured.");
|
||||
}
|
||||
|
||||
this.period = period;
|
||||
}
|
||||
|
||||
internal static int MinimumPeriod
|
||||
{
|
||||
get
|
||||
{
|
||||
return timeCapabilities.wPeriodMin;
|
||||
}
|
||||
}
|
||||
|
||||
internal static int MaximumPeriod
|
||||
{
|
||||
get
|
||||
{
|
||||
return timeCapabilities.wPeriodMax;
|
||||
}
|
||||
}
|
||||
|
||||
internal int Period
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.disposed > 0)
|
||||
{
|
||||
throw new ObjectDisposedException("The time period instance has been disposed.");
|
||||
}
|
||||
|
||||
return this.period;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Interlocked.Increment(ref this.disposed) == 1)
|
||||
{
|
||||
timeEndPeriod(this.period);
|
||||
Interlocked.Decrement(ref inTimePeriod);
|
||||
}
|
||||
else
|
||||
{
|
||||
Interlocked.Decrement(ref this.disposed);
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct TIMECAPS
|
||||
{
|
||||
internal int wPeriodMin;
|
||||
|
||||
internal int wPeriodMax;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
|
||||
<package id="NLog" version="4.7.10" targetFramework="net462" />
|
||||
<package id="NLog.Schema" version="4.7.10" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
namespace EsaCncLib
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Base class for devices
|
||||
/// </summary>
|
||||
public class thdNcBase
|
||||
{
|
||||
public bool Connected = false;
|
||||
protected bool requestStop = false;
|
||||
protected int PlcDelay;
|
||||
|
||||
public bool Finished = false; // this flag will be true when execution is stopped (after a RequestStop)
|
||||
|
||||
public string DeviceName = ""; // name of the device (just for display purpose)
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initialization: common operations for all devices.
|
||||
/// </summary>
|
||||
/// <param name="fIni">The f ini.</param>
|
||||
public thdNcBase(IniFile fIni)
|
||||
{
|
||||
// set delay for execution cycle
|
||||
PlcDelay = fIni.ReadInteger("NC", "PlcDelay", 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request to stop the thread
|
||||
/// </summary>
|
||||
public void RequestStop()
|
||||
{
|
||||
requestStop = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Virtual method for thread main execution
|
||||
/// </summary>
|
||||
public virtual void Execute() { }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,778 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace EsaCncLib
|
||||
{
|
||||
#region ESA_DATA_STRUCTURES
|
||||
// public unsafe struct TS_REG
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
||||
public struct TS_REG
|
||||
{
|
||||
public byte board;
|
||||
public byte iBaseReg;
|
||||
public UInt16 wType;
|
||||
public UInt32 iSharedId;
|
||||
public UInt32 iNum;
|
||||
public UInt32 iMax;
|
||||
public UInt32 iSiz;
|
||||
public UInt32 iOff;
|
||||
public UInt32 ChkSum;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Classe per gestione memoria ESA (nome, indirizzo, aree temporanee, dati reali...)
|
||||
/// </summary>
|
||||
public class EsaBaseMem
|
||||
{
|
||||
/// <summary>
|
||||
/// Dimensione dell'area di memoria (numero oggetti)
|
||||
/// </summary>
|
||||
public UInt16 MemorySize { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Nome dell'area di memoria
|
||||
/// </summary>
|
||||
public string AddressName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Registro della memoria
|
||||
/// </summary>
|
||||
public TS_REG AddresReg { get; set; } = new TS_REG();
|
||||
}
|
||||
/// <summary>
|
||||
/// Strtuttura memoria a Byte
|
||||
/// </summary>
|
||||
public class EsaByteMem : EsaBaseMem
|
||||
{
|
||||
/// <summary>
|
||||
/// Area temp di UINT di 4 byte (32 bit)
|
||||
/// </summary>
|
||||
public UInt32[] tempData;
|
||||
/// <summary>
|
||||
/// Memorie effettiva base byte (8 bit)
|
||||
/// </summary>
|
||||
public Byte[] data;
|
||||
}
|
||||
/// <summary>
|
||||
/// Strtuttura memoria a Word
|
||||
/// </summary>
|
||||
public class EsaWordMem : EsaBaseMem
|
||||
{
|
||||
/// <summary>
|
||||
/// Area temp di UINT di 4 byte (32 bit)
|
||||
/// </summary>
|
||||
public UInt32[] tempData;
|
||||
/// <summary>
|
||||
/// Memorie effettiva base Word (16 bit)
|
||||
/// </summary>
|
||||
public UInt16[] data;
|
||||
}
|
||||
/// <summary>
|
||||
/// Strtuttura memoria a DoubleWord
|
||||
/// </summary>
|
||||
public class EsaDWordMem : EsaBaseMem
|
||||
{
|
||||
/// <summary>
|
||||
/// Area temp di UINT di 4 byte (32 bit)
|
||||
/// </summary>
|
||||
public UInt32[] tempData;
|
||||
/// <summary>
|
||||
/// Memorie effettiva base DoubleWord (32 bit)
|
||||
/// </summary>
|
||||
public UInt32[] data;
|
||||
}
|
||||
/// <summary>
|
||||
/// Strtuttura memoria a string
|
||||
/// </summary>
|
||||
public class EsaStringMem : EsaBaseMem
|
||||
{
|
||||
/// <summary>
|
||||
/// Area temp di UINT di 4 byte (32 bit)
|
||||
/// </summary>
|
||||
public UInt32[] tempData;
|
||||
/// <summary>
|
||||
/// Memorie effettiva base DoubleWord (32 bit)
|
||||
/// </summary>
|
||||
public string data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class for Esa Nc device
|
||||
/// </summary>
|
||||
public class thdNcEsaKvara : thdNcBase
|
||||
{
|
||||
#region oggetti di base
|
||||
|
||||
public Logger lg = LogManager.GetCurrentClassLogger();
|
||||
private string SysLink = "";
|
||||
private string DefCn = "";
|
||||
private int iChannel;
|
||||
private int iError;
|
||||
|
||||
#endregion
|
||||
|
||||
#region setup memoria
|
||||
|
||||
|
||||
public EsaStringMem SCMA_MManCMS_Release;
|
||||
public EsaStringMem SCMA_MManCMS_SerialNumber;
|
||||
public EsaStringMem[] SCMA_MManCMS_Strings;
|
||||
public EsaDWordMem SCMA_MMan_ACK;
|
||||
public EsaDWordMem SCMA_MMan_STROBE;
|
||||
public EsaDWordMem SCMA_MMan_ALM;
|
||||
public EsaDWordMem SCMA_MMan_MNT;
|
||||
public EsaDWordMem SCMA_MMan_ANALOG;
|
||||
public EsaDWordMem SCMA_MMan_CNT;
|
||||
public EsaWordMem SCMA_MMan_WD;
|
||||
public EsaWordMem SCMA_MMan_MF;
|
||||
public EsaWordMem SCMA_MMan_SF;
|
||||
public EsaWordMem SCMA_MMan_TF;
|
||||
public EsaWordMem SCMA_MMan_MNUM;
|
||||
public EsaWordMem SCMA_MMan_SNUM;
|
||||
public EsaWordMem SCMA_MMan_TNUM;
|
||||
public EsaByteMem SCMA_MMan_OVR;
|
||||
public EsaByteMem SCMA_MMan_status;
|
||||
|
||||
#endregion
|
||||
|
||||
#region area assi e altre variabili
|
||||
|
||||
/// <summary>
|
||||
/// Vttore valori correnti assi
|
||||
/// </summary>
|
||||
protected AxisData[] currAxisData;
|
||||
/// <summary>
|
||||
/// Elenco assi "vietati" perché non sono in elenco (errore a rileggerli)
|
||||
/// </summary>
|
||||
protected List<int> vetoAxis = new List<int>();
|
||||
/// <summary>
|
||||
/// periodo reset veto (ogni 5 minuti rivaluta)
|
||||
/// </summary>
|
||||
protected DateTime lastVetoReset = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
// esa constants
|
||||
#region ESA_PLC_CONSTANTS
|
||||
private const UInt32 MAX_PATH = 256;
|
||||
#endregion
|
||||
|
||||
#region ESA_DLL_IMPORT_FUNCTIONS
|
||||
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_ConvComunicationChannel@4")]
|
||||
private static extern int ConvComunicationChannel([MarshalAs(UnmanagedType.LPStr)] string sChannelType);
|
||||
|
||||
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_init_board@8")]
|
||||
private static extern int init_board([MarshalAs(UnmanagedType.LPStr)] string defcn_name, int ChannelType);
|
||||
|
||||
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_exit_board@0")]
|
||||
private static extern int exit_board();
|
||||
|
||||
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_get_reg_by_name@8")]
|
||||
private static extern int get_reg_by_name([MarshalAs(UnmanagedType.LPStr)] string name, ref TS_REG pReg);
|
||||
|
||||
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_read_regbuffer@16")]
|
||||
private static extern int read_regbuffer(ref TS_REG pReg, UInt16 Offset, UInt16 Count, [MarshalAs(UnmanagedType.LPArray)] UInt32[] pDst);
|
||||
|
||||
|
||||
[DllImport("KvCom3x", EntryPoint = "read_regstring")]
|
||||
public static extern int read_regstring(ref TS_REG pReg, short Offset, short wNCharToRead, ref short wpNCharRead, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuff);
|
||||
|
||||
//[DllImport(KVCOM3xDLL, EntryPoint = "read_regstring")]
|
||||
//public static extern int read_regstring(ref TS_REG pReg, short Offset, short wNCharToRead, ref short wpNCharRead, [MarshalAs(UnmanagedType.LPArray)] byte[] pBuff);
|
||||
|
||||
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_write_regbuffer@16")]
|
||||
private static extern int write_regbuffer(ref TS_REG pReg, UInt16 Offset, UInt16 Count, [MarshalAs(UnmanagedType.LPArray)] UInt32[] pSrc);
|
||||
|
||||
[DllImport("VKEnv", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
private static extern void ENVGetProfileString(
|
||||
[MarshalAs(UnmanagedType.LPStr)] string AppName,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string KeyName,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string Default,
|
||||
//[MarshalAs(UnmanagedType.LPArray)] byte[] ReturnedString,
|
||||
[MarshalAs(UnmanagedType.LPStr)] StringBuilder ReturnedString,
|
||||
UInt32 nSize);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// After calling this method the search path is:
|
||||
/// 1 - The directory from which the application loaded
|
||||
/// 2 - The directory specified by the lpPathName parameter
|
||||
/// 3 - The system directory (The name of this directory is System32)
|
||||
/// 4 - The 16-bit system directory (The name of this directory is System)
|
||||
/// 5 - The Windows directory
|
||||
/// 6 - The directories that are listed in the PATH environment variable
|
||||
/// </summary>
|
||||
/// <param name="lpPathName"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool SetDllDirectory(string lpPathName);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="thdNcEsaKvara"/> class.
|
||||
/// </summary>
|
||||
/// <param name="fIni">The f ini.</param>
|
||||
public thdNcEsaKvara(IniFile fIni) : base(fIni)
|
||||
{
|
||||
|
||||
StringBuilder tempS = new StringBuilder(Convert.ToInt32(MAX_PATH));
|
||||
|
||||
// set executable path
|
||||
SetDllDirectory(fIni.ReadString("NC", "SysExe", "C:\\KVARA\\EXE"));
|
||||
|
||||
// communication type
|
||||
string defValue = fIni.ReadString("NC", "SysLink", "SIMULATO");
|
||||
ENVGetProfileString("SYS", "LINK", defValue, tempS, MAX_PATH);
|
||||
//bufferH.Free();
|
||||
SysLink = tempS.ToString();
|
||||
|
||||
// communication channel
|
||||
iChannel = ConvComunicationChannel(SysLink);
|
||||
// definition path
|
||||
defValue = fIni.ReadString("NC", "SysDefCn", "C:\\KVARA\\CNC\\C");
|
||||
ENVGetProfileString("SYS", "DEFCN", defValue, tempS, MAX_PATH);
|
||||
DefCn = tempS.ToString() + "\\defcn";
|
||||
|
||||
// inizializzo le memorie in modo STANDARD
|
||||
setupMemAreaFromIni(fIni);
|
||||
|
||||
if (!Connect())
|
||||
Disconnect();
|
||||
}
|
||||
/// <summary>
|
||||
/// Setup aree di memoria standard SCMA x CMS
|
||||
/// </summary>
|
||||
private void setupMemAreaFromIni(IniFile fIni)
|
||||
{
|
||||
SCMA_MManCMS_Release = new EsaStringMem();
|
||||
SCMA_MManCMS_SerialNumber = new EsaStringMem();
|
||||
SCMA_MManCMS_Strings = new EsaStringMem[20];
|
||||
SCMA_MMan_ACK = new EsaDWordMem();
|
||||
SCMA_MMan_STROBE = new EsaDWordMem();
|
||||
SCMA_MMan_WD = new EsaWordMem();
|
||||
SCMA_MMan_status = new EsaByteMem();
|
||||
SCMA_MMan_ALM = new EsaDWordMem();
|
||||
SCMA_MMan_MNUM = new EsaWordMem();
|
||||
SCMA_MMan_MF = new EsaWordMem();
|
||||
SCMA_MMan_SNUM = new EsaWordMem();
|
||||
SCMA_MMan_SF = new EsaWordMem();
|
||||
SCMA_MMan_TNUM = new EsaWordMem();
|
||||
SCMA_MMan_TF = new EsaWordMem();
|
||||
SCMA_MMan_OVR = new EsaByteMem();
|
||||
SCMA_MMan_ANALOG = new EsaDWordMem();
|
||||
SCMA_MMan_CNT = new EsaDWordMem();
|
||||
SCMA_MMan_MNT = new EsaDWordMem();
|
||||
// aree FIXED secondo necessità: indicazione dimensione x impiego // rif aree reali ESA reale (commento successivo)
|
||||
SCMA_MManCMS_Release.MemorySize = 20;
|
||||
SCMA_MManCMS_SerialNumber.MemorySize = 50;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
SCMA_MManCMS_Strings[i] = new EsaStringMem();
|
||||
SCMA_MManCMS_Strings[i].MemorySize = 50;
|
||||
}
|
||||
SCMA_MMan_ACK.MemorySize = 4; // 32
|
||||
SCMA_MMan_STROBE.MemorySize = 4; // 32
|
||||
SCMA_MMan_WD.MemorySize = 1; // 1
|
||||
SCMA_MMan_status.MemorySize = 1; // 1
|
||||
SCMA_MMan_ALM.MemorySize = 32; // 32
|
||||
SCMA_MMan_MNUM.MemorySize = 2; // 2
|
||||
SCMA_MMan_MF.MemorySize = 20; // 20
|
||||
SCMA_MMan_SNUM.MemorySize = 2; // 2
|
||||
SCMA_MMan_SF.MemorySize = 10; // 10
|
||||
SCMA_MMan_TNUM.MemorySize = 2; // 2
|
||||
SCMA_MMan_TF.MemorySize = 10; // 10
|
||||
SCMA_MMan_OVR.MemorySize = 4; // 16
|
||||
SCMA_MMan_ANALOG.MemorySize = 128; // 128
|
||||
SCMA_MMan_CNT.MemorySize = 128; // 128
|
||||
SCMA_MMan_MNT.MemorySize = 5; // 5
|
||||
|
||||
// indirizzo area ESA...
|
||||
SCMA_MManCMS_Release.AddressName = "CMSretvariables.Release";
|
||||
SCMA_MManCMS_SerialNumber.AddressName = "CMSretvariables.SerialNumber";
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
SCMA_MManCMS_Strings[i].AddressName = $"scma.scmastring[{i}].tag";
|
||||
}
|
||||
SCMA_MMan_ACK.AddressName = "scma.ACK"; //fIni.ReadString("NC", "SCMA_AreaAddress_ACK", "scma.ACK");
|
||||
SCMA_MMan_STROBE.AddressName = "scma.STROBE";
|
||||
SCMA_MMan_WD.AddressName = "scma.WD";
|
||||
SCMA_MMan_status.AddressName = "scma.status";
|
||||
SCMA_MMan_ALM.AddressName = "scma.ALM";
|
||||
SCMA_MMan_MNUM.AddressName = "scma.MNUM";
|
||||
SCMA_MMan_MF.AddressName = "scma.MF";
|
||||
SCMA_MMan_SNUM.AddressName = "scma.SNUM";
|
||||
SCMA_MMan_SF.AddressName = "scma.SF";
|
||||
SCMA_MMan_TNUM.AddressName = "scma.TNUM";
|
||||
SCMA_MMan_TF.AddressName = "scma.TF";
|
||||
SCMA_MMan_OVR.AddressName = "scma.OVR";
|
||||
SCMA_MMan_ANALOG.AddressName = "scma.ANALOG";
|
||||
SCMA_MMan_CNT.AddressName = "scma.CNT";
|
||||
SCMA_MMan_MNT.AddressName = "scma.MNT";
|
||||
|
||||
// Creazione buffers letture memoria
|
||||
SCMA_MManCMS_Release.data = "Release";
|
||||
SCMA_MManCMS_SerialNumber.data = "SerialNumber";
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
SCMA_MManCMS_Strings[i].data = "";
|
||||
}
|
||||
SCMA_MMan_ACK.data = new UInt32[SCMA_MMan_ACK.MemorySize];
|
||||
SCMA_MMan_STROBE.data = new UInt32[SCMA_MMan_STROBE.MemorySize];
|
||||
SCMA_MMan_ALM.data = new UInt32[SCMA_MMan_ALM.MemorySize];
|
||||
SCMA_MMan_MNT.data = new UInt32[SCMA_MMan_MNT.MemorySize];
|
||||
SCMA_MMan_ANALOG.data = new UInt32[SCMA_MMan_ANALOG.MemorySize];
|
||||
SCMA_MMan_CNT.data = new UInt32[SCMA_MMan_CNT.MemorySize];
|
||||
|
||||
SCMA_MMan_WD.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_WD.MemorySize / 2)];
|
||||
SCMA_MMan_WD.data = new UInt16[SCMA_MMan_WD.MemorySize];
|
||||
SCMA_MMan_MF.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_MF.MemorySize / 2)];
|
||||
SCMA_MMan_MF.data = new UInt16[SCMA_MMan_MF.MemorySize];
|
||||
SCMA_MMan_SF.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_SF.MemorySize / 2)];
|
||||
SCMA_MMan_SF.data = new UInt16[SCMA_MMan_SF.MemorySize];
|
||||
SCMA_MMan_TF.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_TF.MemorySize / 2)];
|
||||
SCMA_MMan_TF.data = new UInt16[SCMA_MMan_TF.MemorySize];
|
||||
SCMA_MMan_MNUM.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_MNUM.MemorySize / 2)];
|
||||
SCMA_MMan_MNUM.data = new UInt16[SCMA_MMan_MNUM.MemorySize];
|
||||
SCMA_MMan_SNUM.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_SNUM.MemorySize / 2)];
|
||||
SCMA_MMan_SNUM.data = new UInt16[SCMA_MMan_SNUM.MemorySize];
|
||||
SCMA_MMan_TNUM.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_TNUM.MemorySize / 2)];
|
||||
SCMA_MMan_TNUM.data = new UInt16[SCMA_MMan_TNUM.MemorySize];
|
||||
SCMA_MMan_OVR.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_OVR.MemorySize / 4)];
|
||||
SCMA_MMan_OVR.data = new Byte[SCMA_MMan_OVR.MemorySize];
|
||||
SCMA_MMan_status.tempData = new UInt32[(int)Math.Ceiling((decimal)SCMA_MMan_status.MemorySize / 4)];
|
||||
SCMA_MMan_status.data = new Byte[SCMA_MMan_status.MemorySize];
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Thread main execution
|
||||
/// </summary>
|
||||
public override void Execute()
|
||||
{
|
||||
while (!requestStop)
|
||||
{
|
||||
if (Connected)
|
||||
{
|
||||
// load data from NC
|
||||
ReadBuffer();
|
||||
// if requested make a pause
|
||||
if (PlcDelay > 0)
|
||||
Thread.Sleep(PlcDelay);
|
||||
}
|
||||
else if (!Connected)
|
||||
{
|
||||
// wait 5 sec and retry connection
|
||||
Thread.Sleep(5000);
|
||||
Connect();
|
||||
}
|
||||
else
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
if (Connected) Disconnect();
|
||||
Finished = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// lettura e conversione byte
|
||||
/// </summary>
|
||||
/// <param name="currData"></param>
|
||||
private void readConvByte(EsaByteMem currData)
|
||||
{
|
||||
// variabili di appoggio
|
||||
TS_REG newTsReg = currData.AddresReg;// new TS_REG();
|
||||
// effettuo lettura!
|
||||
iError = read_regbuffer(ref newTsReg, 0, currData.MemorySize, currData.tempData);
|
||||
currData.AddresReg = newTsReg;
|
||||
// ...e copio in array a byte...
|
||||
try
|
||||
{
|
||||
Buffer.BlockCopy(currData.tempData, 0, currData.data, 0, currData.MemorySize);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// lettura e conversione WORD
|
||||
/// </summary>
|
||||
/// <param name="currData"></param>
|
||||
private void readConvWord(EsaWordMem currData)
|
||||
{
|
||||
// variabili di appoggio
|
||||
TS_REG newTsReg = currData.AddresReg;
|
||||
// effettuo lettura!
|
||||
iError = read_regbuffer(ref newTsReg, 0, currData.MemorySize, currData.tempData);
|
||||
currData.AddresReg = newTsReg;
|
||||
// ...e copio in array a byte...
|
||||
try
|
||||
{
|
||||
Buffer.BlockCopy(currData.tempData, 0, currData.data, 0, currData.MemorySize * 2);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
/// <summary>
|
||||
/// lettura e conversione STRING
|
||||
/// </summary>
|
||||
/// <param name="currData"></param>
|
||||
private void readConvString(EsaStringMem currData)
|
||||
{
|
||||
// variabili di appoggio
|
||||
TS_REG newTsReg = currData.AddresReg;
|
||||
|
||||
// lettura diretta stringa metodo nuovo e dedicato
|
||||
byte[] StringRead = new byte[newTsReg.iMax + 1];
|
||||
StringRead.Initialize();
|
||||
short nCharR = 0;
|
||||
iError = read_regstring(ref newTsReg, 0, (short)newTsReg.iMax, ref nCharR, StringRead);
|
||||
if (iError == 0)
|
||||
currData.data = Encoding.ASCII.GetString(StringRead).Replace("\0", " ").Trim();
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo il buffer di memorie STRING
|
||||
/// </summary>
|
||||
public void ReadStringData()
|
||||
{
|
||||
//readConvString(SCMA_MManCMS_Release);
|
||||
//readConvString(SCMA_MManCMS_SerialNumber);
|
||||
// leggo le 20 variabili stringa...
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
readConvString(SCMA_MManCMS_Strings[i]);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo il buffer di memorie DWORD
|
||||
/// </summary>
|
||||
public void ReadAnalogData()
|
||||
{
|
||||
readConvDWord(SCMA_MMan_ANALOG);
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo il buffer di memorie DWORD
|
||||
/// </summary>
|
||||
public void ReadCounterData()
|
||||
{
|
||||
readConvDWord(SCMA_MMan_CNT);
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo il buffer OVR e status
|
||||
/// </summary>
|
||||
public void ReadStatus()
|
||||
{
|
||||
readConvByte(SCMA_MMan_OVR);
|
||||
readConvByte(SCMA_MMan_status);
|
||||
readConvDWord(SCMA_MMan_MNT);
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo il buffer di memorie DWORD ACK e STROBE
|
||||
/// </summary>
|
||||
public void ReadAckStrobe()
|
||||
{
|
||||
readConvDWord(SCMA_MMan_ACK);
|
||||
readConvDWord(SCMA_MMan_STROBE);
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo TUTTI i buffer MST
|
||||
/// </summary>
|
||||
public void ReadMSTData()
|
||||
{
|
||||
readConvWord(SCMA_MMan_MF);
|
||||
readConvWord(SCMA_MMan_SF);
|
||||
readConvWord(SCMA_MMan_TF);
|
||||
readConvWord(SCMA_MMan_MNUM);
|
||||
readConvWord(SCMA_MMan_SNUM);
|
||||
readConvWord(SCMA_MMan_TNUM);
|
||||
}
|
||||
/// <summary>
|
||||
/// Leggo il buffer di memorie DWORD ACK e STROBE
|
||||
/// </summary>
|
||||
public void ReadlAlarms()
|
||||
{
|
||||
readConvDWord(SCMA_MMan_ALM);
|
||||
}
|
||||
public bool WriteAck()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
writeConvDWord(SCMA_MMan_ACK);
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// lettura e conversione DWORD
|
||||
/// </summary>
|
||||
/// <param name="currData"></param>
|
||||
protected void readConvDWord(EsaDWordMem currData)
|
||||
{
|
||||
// variabili di appoggio
|
||||
TS_REG newTsReg = currData.AddresReg;// new TS_REG();
|
||||
// effettuo lettura!
|
||||
iError = read_regbuffer(ref newTsReg, 0, currData.MemorySize, currData.data);
|
||||
currData.AddresReg = newTsReg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scrittura di un area DWORD
|
||||
/// </summary>
|
||||
/// <param name="currData"></param>
|
||||
protected void writeConvDWord(EsaDWordMem currData)
|
||||
{
|
||||
// variabili di appoggio
|
||||
TS_REG newTsReg = currData.AddresReg;// new TS_REG();
|
||||
// effettuo scrittura!
|
||||
iError = write_regbuffer(ref newTsReg, 0, currData.MemorySize, currData.data);
|
||||
currData.AddresReg = newTsReg;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Connects to device.
|
||||
/// </summary>
|
||||
/// <returns>True if connection is ok</returns>
|
||||
public bool Connect()
|
||||
{
|
||||
// inizializzazione comunicazione x aree di memoria A BLOCCHI
|
||||
iError = init_board(DefCn, iChannel);
|
||||
if (iError != (int)ESAutomotionCNCcom.Link.Errors.ele_ok)
|
||||
{
|
||||
string sOut = "";
|
||||
ESAutomotionCNCcom.Link.el_getReadErrorString(iError, ref sOut);
|
||||
lg.Error(sOut);
|
||||
}
|
||||
// init oggetto LINK x gestione dati da CN..
|
||||
iError = ESAutomotionCNCcom.Link.el_connect(@"c:\kvara\exe");
|
||||
if (iError != (int)ESAutomotionCNCcom.Link.Errors.ele_ok)
|
||||
{
|
||||
string sOut = "";
|
||||
ESAutomotionCNCcom.Link.el_getReadErrorString(iError, ref sOut);
|
||||
lg.Error(sOut);
|
||||
}
|
||||
// salvo status connected
|
||||
Connected = (iError == 0);
|
||||
if (Connected)
|
||||
{
|
||||
setupMemConf();
|
||||
setupAxisData();
|
||||
}
|
||||
return Connected;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettuo setup di TUTTE le aree di memoria
|
||||
/// </summary>
|
||||
public void setupMemConf()
|
||||
{
|
||||
// Chiamo tutti i registri memoria!
|
||||
setupMemAreaSingle(SCMA_MMan_ACK);
|
||||
setupMemAreaSingle(SCMA_MMan_STROBE);
|
||||
setupMemAreaSingle(SCMA_MMan_ALM);
|
||||
setupMemAreaSingle(SCMA_MMan_MNT);
|
||||
setupMemAreaSingle(SCMA_MMan_ANALOG);
|
||||
setupMemAreaSingle(SCMA_MMan_CNT);
|
||||
setupMemAreaSingle(SCMA_MMan_MF);
|
||||
setupMemAreaSingle(SCMA_MMan_SF);
|
||||
setupMemAreaSingle(SCMA_MMan_TF);
|
||||
setupMemAreaSingle(SCMA_MMan_MNUM);
|
||||
setupMemAreaSingle(SCMA_MMan_SNUM);
|
||||
setupMemAreaSingle(SCMA_MMan_TNUM);
|
||||
setupMemAreaSingle(SCMA_MMan_OVR);
|
||||
setupMemAreaSingle(SCMA_MMan_status);
|
||||
setupMemAreaSingle(SCMA_MManCMS_Release);
|
||||
setupMemAreaSingle(SCMA_MManCMS_SerialNumber);
|
||||
foreach (var item in SCMA_MManCMS_Strings)
|
||||
{
|
||||
setupMemAreaSingle(item);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua setup preliminare dati assi
|
||||
/// </summary>
|
||||
public void setupAxisData()
|
||||
{
|
||||
int numAxis = ESAutomotionCNCcom.Link.el_getAxisCount();
|
||||
currAxisData = new AxisData[numAxis];
|
||||
iError = ESAutomotionCNCcom.Link.el_getStatus(((uint)ESAutomotionCNCcom.Link.StatusMaskFlags.STATUS_AXES));
|
||||
// recupero dati x TIPO asse e nome...
|
||||
var axisInfo_t = new ESAutomotionCNCcom.Link.AxisInfoT();
|
||||
for (int i = 0; i < numAxis; i++)
|
||||
{
|
||||
iError = ESAutomotionCNCcom.Link.el_getAxisInfo(i, ref axisInfo_t);
|
||||
if (iError == 0)
|
||||
{
|
||||
currAxisData[axisInfo_t.AxisNum] = new AxisData()
|
||||
{
|
||||
num = axisInfo_t.AxisNum,
|
||||
name = "",
|
||||
isLinear = !axisInfo_t.IsRotative,
|
||||
posMac = 0,
|
||||
posTCP = 0,
|
||||
distanceToGo = 0,
|
||||
speed = 0,
|
||||
load = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua setup registro
|
||||
/// </summary>
|
||||
/// <param name="currData"></param>
|
||||
private void setupMemAreaSingle(EsaBaseMem currData)
|
||||
{
|
||||
TS_REG newTsReg = new TS_REG();
|
||||
if (iError == 0)
|
||||
{
|
||||
iError = get_reg_by_name(currData.AddressName, ref newTsReg);
|
||||
currData.AddresReg = newTsReg;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects device.
|
||||
/// </summary>
|
||||
public void Disconnect()
|
||||
{
|
||||
iError = exit_board();
|
||||
iError = ESAutomotionCNCcom.Link.el_disconnect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esa virtual Nc needs 2ms of multimedia timer to work in real time
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool CheckMultimediaTimer()
|
||||
{
|
||||
int minimumPeriod = TimePeriod.MinimumPeriod;
|
||||
//int maximumPeriod = TimePeriod.MaximumPeriod;
|
||||
return ((minimumPeriod <= 2) && (minimumPeriod > 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Valorizza parametri assi e restituisce errore
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AxisData[] getAxisData()
|
||||
{
|
||||
// richiesta update stato assi
|
||||
iError = ESAutomotionCNCcom.Link.el_getStatus(((uint)ESAutomotionCNCcom.Link.StatusMaskFlags.STATUS_AXES));
|
||||
if (iError == 0)
|
||||
{
|
||||
var axis_t = new ESAutomotionCNCcom.Link.AxisT();
|
||||
for (int i = 0; i < (int)ESAutomotionCNCcom.Link.Constants.MAX_AXIS_NUM; i++)
|
||||
{
|
||||
// SOLO SE NON in elenco veto...
|
||||
if (!vetoAxis.Contains(i))
|
||||
{
|
||||
iError = ESAutomotionCNCcom.Link.el_getAxisStatus(i, ref axis_t);
|
||||
if (iError == 0)
|
||||
{
|
||||
currAxisData[axis_t.AxisNum].name = axis_t.AxisName.Trim();
|
||||
currAxisData[axis_t.AxisNum].posMac = axis_t.MachineCoord;
|
||||
currAxisData[axis_t.AxisNum].posTCP = axis_t.RelativeCoord;
|
||||
currAxisData[axis_t.AxisNum].distanceToGo = axis_t.Distance;
|
||||
currAxisData[axis_t.AxisNum].speed = axis_t.Speed;
|
||||
currAxisData[axis_t.AxisNum].load = axis_t.PowerAbsorbtion;
|
||||
}
|
||||
else
|
||||
{
|
||||
// metto in elenco veto...
|
||||
vetoAxis.Add(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// se scaduto il tempo rivaluto veto...
|
||||
if (DateTime.Now.Subtract(lastVetoReset).TotalSeconds > 60)
|
||||
{
|
||||
vetoAxis.Clear();
|
||||
lastVetoReset = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return currAxisData;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restitusice feed e speed
|
||||
/// </summary>
|
||||
public feedSpeedData getFeedSpeed()
|
||||
{
|
||||
feedSpeedData answ = new feedSpeedData();
|
||||
ESAutomotionCNCcom.Link.CncFeedStatusT currData = new ESAutomotionCNCcom.Link.CncFeedStatusT();
|
||||
// richiesta update feed e speed
|
||||
iError = ESAutomotionCNCcom.Link.el_getStatus(((uint)ESAutomotionCNCcom.Link.StatusMaskFlags.STATUS_FEED_SPEED));
|
||||
if (iError == 0)
|
||||
{
|
||||
iError = ESAutomotionCNCcom.Link.el_getFeedStatus(ref currData);
|
||||
if (iError == 0)
|
||||
{
|
||||
answ.programemdFeed = currData.ProgrammedFeed;
|
||||
answ.programemdSpeed = currData.ProgrammedSpeed;
|
||||
answ.realFeed = currData.RealFeed;
|
||||
answ.realSpeed = currData.RealSpeed;
|
||||
answ.overrideFeed = currData.FeedOverride;
|
||||
answ.overrideSpeed = currData.SpeedOverride;
|
||||
answ.overrideRapid = currData.RapidOverride;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// recupera e restituisce elenco codici G attivi...
|
||||
/// </summary>
|
||||
/// <param name="numPath"></param>
|
||||
/// <returns></returns>
|
||||
public int[] getGCodes()
|
||||
{
|
||||
int[] answ = new int[10];
|
||||
|
||||
ESAutomotionCNCcom.Link.CncStatusT currData = new ESAutomotionCNCcom.Link.CncStatusT();
|
||||
// richiesta update feed e speed
|
||||
iError = ESAutomotionCNCcom.Link.el_getStatus(((uint)ESAutomotionCNCcom.Link.StatusMaskFlags.STATUS_MISC_FLAGS));
|
||||
if (iError == 0)
|
||||
{
|
||||
iError = ESAutomotionCNCcom.Link.el_getCNCStatus(ref currData);
|
||||
answ = currData.GroupG;
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Struttura dati asse
|
||||
/// </summary>
|
||||
public struct AxisData
|
||||
{
|
||||
public int num;
|
||||
public string name;
|
||||
public bool isLinear;
|
||||
public double posMac;
|
||||
public double posTCP;
|
||||
public double distanceToGo;
|
||||
public double speed;
|
||||
public int load;
|
||||
}
|
||||
|
||||
public struct feedSpeedData
|
||||
{
|
||||
public double programemdFeed;
|
||||
public double programemdSpeed;
|
||||
public double realFeed;
|
||||
public double realSpeed;
|
||||
public double overrideFeed;
|
||||
public double overrideSpeed;
|
||||
public double overrideRapid;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,61 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="appName" value="MTConnect Adapter DB"/>
|
||||
<add key="appName" value="MTConnect Adapter DB" />
|
||||
<!--obbligatorio x dump compilato su 7879...-->
|
||||
<add key="portMTC" value="7879"/>
|
||||
<add key="recTime" value="true"/>
|
||||
<add key="verbose" value="true"/>
|
||||
<add key="portMTC" value="7879" />
|
||||
<add key="recTime" value="true" />
|
||||
<add key="verbose" value="true" />
|
||||
<!--gestione TIMERS-->
|
||||
<add key="startTimerMs" value="250"/>
|
||||
<add key="startTimerMs" value="250" />
|
||||
<!--invio da adapter ad agent: 10ms-->
|
||||
<add key="timerIntMs" value="10"/>
|
||||
<add key="timerIntMs" value="10" />
|
||||
<!--0.2 sec-->
|
||||
<add key="fastCount" value="20"/>
|
||||
<add key="fastCount" value="20" />
|
||||
<!--0.5 sec-->
|
||||
<add key="normCount" value="50"/>
|
||||
<add key="normCount" value="50" />
|
||||
<!--60 sec-->
|
||||
<add key="slowCount" value="600"/>
|
||||
<add key="slowCount" value="600" />
|
||||
<!--2 min-->
|
||||
<add key="verySlowCount" value="1200"/>
|
||||
<add key="verySlowCount" value="1200" />
|
||||
<!--parametri gestione watchdog-->
|
||||
<add key="maxAdapterLockSec" value="5"/>
|
||||
<add key="maxAdapterLockSec" value="5" />
|
||||
<!--conf file-->
|
||||
<add key="dataPath" value="DATA"/>
|
||||
<add key="dataConfPath" value="DATA\CONF"/>
|
||||
<add key="dataDatPath" value="DATA\DAT"/>
|
||||
<add key="resxPath" value="Resources"/>
|
||||
<add key="defaultPersLayerFile" value="PersistData.dat"/>
|
||||
<add key="maxNumDD" value="30"/>
|
||||
<add key="dataPath" value="DATA" />
|
||||
<add key="dataConfPath" value="DATA\CONF" />
|
||||
<add key="dataDatPath" value="DATA\DAT" />
|
||||
<add key="resxPath" value="Resources" />
|
||||
<add key="defaultPersLayerFile" value="PersistData.dat" />
|
||||
<add key="maxNumDD" value="30" />
|
||||
<!--Definizione avvio Adapter-->
|
||||
<add key="autoStartOnLoad" value="true"/>
|
||||
<add key="openDumpOnStart" value="true"/>
|
||||
<add key="startMinimized" value="false"/>
|
||||
<add key="windowCanMax" value="true"/>
|
||||
<add key="trayClose" value="true"/>
|
||||
<add key="autoSaveSec" value="60"/>
|
||||
<add key="waitRecMSec" value="5000"/>
|
||||
<add key="testCharSep" value="|"/>
|
||||
<add key="autoStartOnLoad" value="true" />
|
||||
<add key="openDumpOnStart" value="true" />
|
||||
<add key="startMinimized" value="false" />
|
||||
<add key="windowCanMax" value="true" />
|
||||
<add key="trayClose" value="true" />
|
||||
<add key="autoSaveSec" value="60" />
|
||||
<add key="waitRecMSec" value="5000" />
|
||||
<add key="testCharSep" value="|" />
|
||||
<!--CONF DB-->
|
||||
<add key="ServerType" value="MySQL"/>
|
||||
<add key="ServerAddress" value="10.74.82.62"/>
|
||||
<add key="DbName" value="savenergy"/>
|
||||
<add key="DbUser" value="root"/>
|
||||
<add key="DbPwd" value="scmgroup"/>
|
||||
<add key="numRetryConnDb" value="10"/>
|
||||
<add key="ServerType" value="MySQL" />
|
||||
<add key="ServerAddress" value="10.74.82.62" />
|
||||
<add key="DbName" value="savenergy" />
|
||||
<add key="DbUser" value="root" />
|
||||
<add key="DbPwd" value="scmgroup" />
|
||||
<add key="numRetryConnDb" value="10" />
|
||||
|
||||
</appSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="lib;libs"/>
|
||||
<probing privatePath="lib;libs" />
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.12.3.0" newVersion="3.12.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.8.6.0" newVersion="1.8.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient"/>
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
|
||||
</DbProviderFactories>
|
||||
</system.data></configuration>
|
||||
</configuration>
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>MTC_ADB</RootNamespace>
|
||||
<AssemblyName>MTC-ADB</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -44,20 +45,59 @@
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.6.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DotNetAdapterSDK, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>ExtLib\DotNetAdapterSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
|
||||
<Reference Include="Google.Protobuf, Version=3.12.3.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.12.3\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.1.11\lib\net46\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.1.11\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing.Design" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
@@ -70,6 +110,12 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Ubiety.Dns.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.21\lib\net452\Zstandard.Net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersGen\VersGen.cs">
|
||||
@@ -115,6 +161,7 @@
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="DATA\DAT\PersistData.dat">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@@ -165,11 +212,11 @@
|
||||
</ItemGroup>
|
||||
<Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
|
||||
</Target>
|
||||
<Import Project="..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets" Condition="Exists('..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets')" />
|
||||
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -384,7 +384,7 @@ namespace MTC_ADB
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\MTCA.ico", utils.resxDir);
|
||||
return string.Format(@"{0}\Scma.ico", utils.resxDir);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
+671
-189
File diff suppressed because it is too large
Load Diff
+30
-38
@@ -1,69 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Codice generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MTC_ADB.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace MTC_ADB.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
|
||||
// tramite uno strumento quale ResGen o Visual Studio.
|
||||
// Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
|
||||
// con l'opzione /str oppure ricompilare il progetto VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MTC_ADB.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
|
||||
/// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-13
@@ -8,21 +8,17 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MTC_ADB.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace MTC_ADB.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MySql.Data" version="6.9.9" targetFramework="net452" />
|
||||
<package id="NLog" version="4.5.8" targetFramework="net452" />
|
||||
<package id="NLog.Config" version="4.5.8" targetFramework="net452" />
|
||||
<package id="NLog.Schema" version="4.5.8" targetFramework="net452" />
|
||||
<package id="BouncyCastle" version="1.8.6.1" targetFramework="net462" />
|
||||
<package id="Google.Protobuf" version="3.12.3" targetFramework="net462" />
|
||||
<package id="K4os.Compression.LZ4" version="1.1.11" targetFramework="net462" />
|
||||
<package id="K4os.Compression.LZ4.Streams" version="1.1.11" targetFramework="net462" />
|
||||
<package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net462" />
|
||||
<package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.26" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="MySql.Data" version="8.0.21" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
|
||||
<package id="NLog" version="4.7.10" targetFramework="net462" />
|
||||
<package id="NLog.Schema" version="4.7.10" targetFramework="net462" />
|
||||
<package id="PrettyBin" version="1.1.0" targetFramework="net452" />
|
||||
<package id="SlowCheetah" version="2.5.48" targetFramework="net452" />
|
||||
<package id="SSH.NET" version="2016.1.0" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -9,8 +9,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MTC</RootNamespace>
|
||||
<AssemblyName>MTC</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -36,9 +37,11 @@
|
||||
<Reference Include="AForge.Math, Version=2.2.5.0, Culture=neutral, PublicKeyToken=abba2e25397ee8c9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AForge.Math.2.2.5\lib\AForge.Math.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
@@ -57,11 +60,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BinaryFormatter.cs" />
|
||||
<Compile Include="enumerations.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="baseUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="NLog.config" />
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
+671
-189
File diff suppressed because it is too large
Load Diff
+1017
-917
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,235 @@
|
||||
namespace MTC
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipologia di ricerca ammessa
|
||||
/// </summary>
|
||||
public enum subsMode
|
||||
{
|
||||
/// ADD: includo
|
||||
A,
|
||||
/// X: ESCLUDO
|
||||
X
|
||||
}
|
||||
/// <summary>
|
||||
/// Tipologia di sostituzioni ammesse
|
||||
/// </summary>
|
||||
public enum substSearch
|
||||
{
|
||||
// CERCO BEGIN: inizia per
|
||||
B,
|
||||
// CERCO END: finisce per
|
||||
E,
|
||||
// CERCO CONTAINS: contiene
|
||||
C,
|
||||
// CERCO IDENTICAL: identica
|
||||
I
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe utility dizionario per sostituzioni
|
||||
/// </summary>
|
||||
public class replDict
|
||||
{
|
||||
/// <summary>
|
||||
/// Valore tradotto
|
||||
/// </summary>
|
||||
public string tradz;
|
||||
/// <summary>
|
||||
/// Tipologia di azione
|
||||
/// </summary>
|
||||
public subsMode modo;
|
||||
/// <summary>
|
||||
/// Modalità di ricerca
|
||||
/// </summary>
|
||||
public substSearch search;
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe item node (tipo/obj)
|
||||
/// </summary>
|
||||
public class itemNode
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo oggetto (per cast)
|
||||
/// </summary>
|
||||
public itemType cType;
|
||||
/// <summary>
|
||||
/// Object specifico
|
||||
/// </summary>
|
||||
public object cObject;
|
||||
/// <summary>
|
||||
/// costruttore
|
||||
/// </summary>
|
||||
public itemNode()
|
||||
{ }
|
||||
/// <summary>
|
||||
/// costruttore
|
||||
/// </summary>
|
||||
/// <param name="_tipo"></param>
|
||||
/// <param name="_obj"></param>
|
||||
public itemNode(itemType _tipo, object _obj)
|
||||
{
|
||||
cType = _tipo;
|
||||
cObject = _obj;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Tipologia di ITEM
|
||||
/// </summary>
|
||||
public enum itemType
|
||||
{
|
||||
/// <summary>
|
||||
/// CONDIZION = ALLARME
|
||||
/// </summary>
|
||||
Condition,
|
||||
/// <summary>
|
||||
/// Evento = point in time data
|
||||
/// </summary>
|
||||
Event,
|
||||
/// <summary>
|
||||
/// Messaggio generico
|
||||
/// </summary>
|
||||
Message,
|
||||
/// <summary>
|
||||
/// Campionamento continuo
|
||||
/// </summary>
|
||||
Sample
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO ATTIVO (es attuatori, sistemi...)
|
||||
/// </summary>
|
||||
public enum actStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato inattivo
|
||||
/// </summary>
|
||||
INACTIVE = 0,
|
||||
/// <summary>
|
||||
/// Stato Attivo
|
||||
/// </summary>
|
||||
ACTIVE
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO OnOff
|
||||
/// </summary>
|
||||
public enum onOffStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato OFF
|
||||
/// </summary>
|
||||
OFF = 0,
|
||||
/// <summary>
|
||||
/// Stato ON
|
||||
/// </summary>
|
||||
ON
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO per EMERGENZA
|
||||
/// </summary>
|
||||
public enum emStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato ARMATO
|
||||
/// </summary>
|
||||
ARMED = 0,
|
||||
/// <summary>
|
||||
/// Stato EMERGENZA PREMUTA
|
||||
/// </summary>
|
||||
TRIGGERED
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ENUM degli stati macchina(alto livello, OPC-UA)
|
||||
/// </summary>
|
||||
public enum macState
|
||||
{
|
||||
UNDEFINED = 0,
|
||||
EXE = 1,
|
||||
READY = 2,
|
||||
FAIL = 3,
|
||||
POWER_OFF = 4
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ENUM degli stati RUN del path MTC
|
||||
/// </summary>
|
||||
public enum MtcRunMode
|
||||
{
|
||||
UNDEFINED = 0,
|
||||
AUTOMATIC,
|
||||
EDIT,
|
||||
MANUAL_DATA_INPUT,
|
||||
MANUAL,
|
||||
SEMI_AUTO
|
||||
}
|
||||
/// <summary>
|
||||
/// ENUM dei MODE del path OPC-UA
|
||||
/// </summary>
|
||||
public enum OpcUaPathMode
|
||||
{
|
||||
UNDEFINED = 0,
|
||||
AUTOMATIC,
|
||||
EDIT,
|
||||
SEMIAUTOMATIC,
|
||||
MANUAL_JOG,
|
||||
SEMIAUTOMATIC_MTC
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ENUM degli stati EXE del path MTC
|
||||
/// </summary>
|
||||
public enum MtcExeMode
|
||||
{
|
||||
UNDEFINED = 0,
|
||||
ACTIVE,
|
||||
READY,
|
||||
STOPPED,
|
||||
FEED_HOLD,
|
||||
OPTIONAL_STOP,
|
||||
PROGRAM_STOPPED,
|
||||
PROGRAM_COMPLETED
|
||||
}
|
||||
/// <summary>
|
||||
/// ENUM degli stati del path OPC-UA
|
||||
/// </summary>
|
||||
public enum OpcUaPathStatus
|
||||
{
|
||||
UNDEFINED = 0,
|
||||
EXE,
|
||||
READY,
|
||||
HOLD,
|
||||
FEED_HOLD,
|
||||
OPTIONAL_STOP,
|
||||
PROGRAM_STOPPED,
|
||||
DONE
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Varibili STATO per AVAIL
|
||||
/// </summary>
|
||||
public enum availStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato DISPONIBILE
|
||||
/// </summary>
|
||||
AVAILABLE = 0,
|
||||
/// <summary>
|
||||
/// Stato NON disponibile NULL/unavailable (era NULL, rimesso UNAVAILABLE su richiesta Nicola Carminati)
|
||||
/// </summary>
|
||||
UNAVAILABLE
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO per AVAIL
|
||||
/// </summary>
|
||||
public enum pathType
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato LAVORO
|
||||
/// </summary>
|
||||
LAVORO = 0,
|
||||
/// <summary>
|
||||
/// Stato ASSERV
|
||||
/// </summary>
|
||||
ASSERV
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="AForge" version="2.2.5" targetFramework="net452" />
|
||||
<package id="AForge.Math" version="2.2.5" targetFramework="net452" />
|
||||
<package id="NLog" version="4.5.8" targetFramework="net452" />
|
||||
<package id="NLog.Config" version="4.5.8" targetFramework="net452" />
|
||||
<package id="NLog.Schema" version="4.5.8" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
|
||||
<package id="NLog" version="4.7.10" targetFramework="net462" />
|
||||
<package id="NLog.Schema" version="4.7.10" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -0,0 +1,16 @@
|
||||
G1128 ed F1343
|
||||
|
||||
leggo bit, se in AND sono 1 --> processo migrato
|
||||
|
||||
parametro 981 --> assegno a
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
2
|
||||
1
|
||||
1
|
||||
1
|
||||
|
||||
devo guardare dove ho 2 (processo predisposto) e se i bit sono 1 --> sono spostati di PROCESSO, e devo guardare quelli...
|
||||
@@ -0,0 +1,707 @@
|
||||
using MTC;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OPC_UA_REDIS
|
||||
{
|
||||
public class AdapterRed
|
||||
{
|
||||
/// <summary>
|
||||
/// wrapper di log
|
||||
/// </summary>
|
||||
public static Logger lg;
|
||||
/// <summary>
|
||||
/// Determina se il server redis sia attivo e connesso (check periodico...)
|
||||
/// </summary>
|
||||
public bool redServAlive;
|
||||
/// <summary>
|
||||
/// DataOra ultimo controllo stato server REDIS
|
||||
/// </summary>
|
||||
protected DateTime lastRedSrvCheck;
|
||||
/// <summary>
|
||||
/// Bool x verifica SE SIANO DA INVIARE info in fase di START (no se REDIS non attivo...)
|
||||
/// </summary>
|
||||
protected bool startData2Send = false;
|
||||
/// <summary>
|
||||
/// Bool x verifica SE SIANO DA INVIARE info in fase di STOP (no se REDIS non attivo...)
|
||||
/// </summary>
|
||||
protected bool stopData2Send = false;
|
||||
/// <summary>
|
||||
/// Bool x verifica SE SIANO DA INVIARE info in fase di REFRESH (no se REDIS non attivo...)
|
||||
/// </summary>
|
||||
protected bool refreshData2Send = false;
|
||||
/// <summary>
|
||||
/// Metodo send changed iniziato e stiamo inviando conditions.
|
||||
/// </summary>
|
||||
bool mBegun = false;
|
||||
/// <summary>
|
||||
/// DataModel di riferimento
|
||||
/// </summary>
|
||||
public string DataModel;
|
||||
/// <summary>
|
||||
/// Oggetto elenco allarmi (in + lingue...)
|
||||
/// </summary>
|
||||
public allarme[] elencoAllarmi { get; set; }
|
||||
/// <summary>
|
||||
/// Dizionario REGOLE conversione nome variabili con replace "like" (per gestione REDIS "_" --> ":")
|
||||
/// </summary>
|
||||
public Dictionary<string, replDict> nameRepRoles { get; set; }
|
||||
/// <summary>
|
||||
/// Dizionario di TUTTE le conversioni variabili (MTC-->OPC-UA) applicate
|
||||
/// </summary>
|
||||
public Dictionary<string, string> nameReplaced = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Dizionario di TUTTE le conversioni variabili (OPC-UA-->MTC) applicate
|
||||
/// </summary>
|
||||
public Dictionary<string, string> nameReplacedInvert = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Dizionario di TUTTE le variabili ESCLUSE (filtrate)
|
||||
/// </summary>
|
||||
public Dictionary<string, string> nameExcluded = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di TUTTI i NODI ITEMS gestiti dal gateway (item/variabile)...
|
||||
/// </summary>
|
||||
public Dictionary<string, itemNode> itemNodes { get; set; }
|
||||
/// <summary>
|
||||
/// Elenco di TUTTI i NODI CONDITIONS gestiti dal gateway (allarme/condizione)...
|
||||
/// </summary>
|
||||
public Dictionary<string, itemNode> conditionNodes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// All the data items we're tracking.
|
||||
/// </summary>
|
||||
private ArrayList mDataItems = new ArrayList();
|
||||
|
||||
/// <summary>
|
||||
/// Classe adapter verso REDIS
|
||||
/// </summary>
|
||||
/// <param name="sPort"></param>
|
||||
/// <param name="sAddress"></param>
|
||||
/// <param name="verbose"></param>
|
||||
public AdapterRed(int sPort = 6379, string sAddress = "127.0.0.1", bool verbose = false)
|
||||
{
|
||||
lg = LogManager.GetCurrentClassLogger();
|
||||
ServerPort = sPort;
|
||||
ServerAddr = sAddress;
|
||||
Verbose = verbose;
|
||||
nameRepRoles = new Dictionary<string, replDict>();
|
||||
itemNodes = new Dictionary<string, itemNode>();
|
||||
conditionNodes = new Dictionary<string, itemNode>();
|
||||
// aggiungo controllo server...
|
||||
checkAlive();
|
||||
lastRedSrvCheck = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// Controlla stato server alive
|
||||
/// </summary>
|
||||
private void checkAlive()
|
||||
{
|
||||
bool newStatus = redUtil.connRedis.IsConnected;
|
||||
// controllo se cambia lo stato...
|
||||
string message = "";
|
||||
if (redServAlive != newStatus)
|
||||
{
|
||||
message = newStatus ? "Server REDIS tornato ONLINE! salvo aggiornamento di stato" : "Server REDIS offline, impossibile inviare aggiornamenti.";
|
||||
lg.Info(message);
|
||||
redServAlive = newStatus;
|
||||
if (newStatus)
|
||||
{
|
||||
checkRedisStatusAndSend();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Heartbeat { get; set; }
|
||||
public bool Running { get; }
|
||||
public int ServerPort { get; set; }
|
||||
public string ServerAddr { get; set; }
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
#region metodi esposti
|
||||
|
||||
/// <summary>
|
||||
/// The asks all data items to begin themselves for collection. Only
|
||||
/// required for conditions and should not be called if you are not
|
||||
/// planning on adding all the conditions before you send. If you skip this
|
||||
/// the adapter will not perform the mark and sweep.
|
||||
/// </summary>
|
||||
public void Begin()
|
||||
{
|
||||
mBegun = true;
|
||||
foreach (DataItemRed di in mDataItems)
|
||||
{
|
||||
di.Begin();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunta di un DataItem (generico)
|
||||
/// </summary>
|
||||
/// <param name="aDI"></param>
|
||||
public void AddDataItem(DataItemRed aDI)
|
||||
{
|
||||
// controllo se ci sia già (sennò NON duplico...)
|
||||
if (!mDataItems.Contains(aDI))
|
||||
{
|
||||
mDataItems.Add(aDI);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Remove all data items.
|
||||
/// </summary>
|
||||
public void RemoveAllDataItems()
|
||||
{
|
||||
mDataItems.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a data item from the adapter.
|
||||
/// </summary>
|
||||
/// <param name="aItem"></param>
|
||||
public void RemoveDataItem(DataItemRed aItem)
|
||||
{
|
||||
int ind = mDataItems.IndexOf(aItem);
|
||||
if (ind >= 0)
|
||||
{
|
||||
mDataItems.RemoveAt(ind);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make all data items unavailable
|
||||
/// </summary>
|
||||
public void Unavailable()
|
||||
{
|
||||
foreach (DataItemRed di in mDataItems)
|
||||
{
|
||||
di.Unavailable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Effettua invio di tutte le variabili modificate...
|
||||
/// </summary>
|
||||
/// <param name="timestamp"></param>
|
||||
public void SendChanged()
|
||||
{
|
||||
// registro che necessito invio dati STOP
|
||||
refreshData2Send = true;
|
||||
if (redServAlive)
|
||||
{
|
||||
sendChangedData(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// controllo se sia scaduto timeout 5 sec prima di scrivere errore...
|
||||
if (DateTime.Now.AddSeconds(-baseUtils.CRI("logRedConnWaitTime")) > lastRedSrvCheck)
|
||||
{
|
||||
lg.Error("Attenzione! server REDIS non disponibile (SendChanged)");
|
||||
lastRedSrvCheck = DateTime.Now;
|
||||
}
|
||||
}
|
||||
// forzo controllo stato
|
||||
checkAlive();
|
||||
}
|
||||
/// <summary>
|
||||
/// Invio dati modificati
|
||||
/// </summary>
|
||||
/// <param name="forceSend">forza invio di TUTTO comunque...</param>
|
||||
/// <returns></returns>
|
||||
private string sendChangedData(bool forceSend = false)
|
||||
{
|
||||
string timestamp = null;
|
||||
// var accessorie
|
||||
string hashKey = "";
|
||||
string hashVal = "";
|
||||
|
||||
if (mBegun)
|
||||
{
|
||||
foreach (DataItemRed di in mDataItems)
|
||||
{
|
||||
di.Prepare();
|
||||
}
|
||||
}
|
||||
|
||||
// Separate out the data items into those that are on one line and those
|
||||
// need separate lines.
|
||||
List<DataItemRed> together = new List<DataItemRed>();
|
||||
foreach (DataItemRed di in mDataItems)
|
||||
{
|
||||
List<DataItemRed> list = di.ItemList(forceSend);
|
||||
together.AddRange(list);
|
||||
}
|
||||
|
||||
if (timestamp == null)
|
||||
{
|
||||
timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd\\THH:mm:ss.fffK");
|
||||
}
|
||||
if (redServAlive)
|
||||
{
|
||||
if (together.Count > 0)
|
||||
{
|
||||
// salvo su REDIS!!!
|
||||
foreach (DataItemRed di in together)
|
||||
{
|
||||
hashKey = machineHash(di.Name);
|
||||
hashVal = di.Value.ToString().Trim();
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
}
|
||||
}
|
||||
// salvo anche heartbeat e running...
|
||||
hashKey = redUtil.man.redHash("Adp:Heartbeat");
|
||||
saveHashKeyVal(hashKey, timestamp);
|
||||
hashKey = redUtil.man.redHash("Adp:Status");
|
||||
hashVal = "running";
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Attenzione! server REDIS non disponibile (SendChanged:toghether)");
|
||||
checkAlive();
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
foreach (DataItemRed di in mDataItems)
|
||||
{
|
||||
di.Cleanup();
|
||||
}
|
||||
|
||||
// finito
|
||||
mBegun = false;
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva hask KeyVal in REDIS
|
||||
/// </summary>
|
||||
/// <param name="hashKey"></param>
|
||||
/// <param name="hashVal"></param>
|
||||
private static void saveHashKeyVal(string hashKey, string hashVal)
|
||||
{
|
||||
if (!hashKey.EndsWith("NONE"))
|
||||
{
|
||||
redUtil.man.setRSV(hashKey, hashVal);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arresto adapter
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
// registro che necessito invio dati STOP
|
||||
stopData2Send = true;
|
||||
if (redServAlive)
|
||||
{
|
||||
sendStopData();
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Attenzione! server REDIS non disponibile (STOP)");
|
||||
// forzo controllo stato
|
||||
checkAlive();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Invio dati in fase di CHIUSURA
|
||||
/// </summary>
|
||||
private void sendStopData()
|
||||
{
|
||||
// var accessorie
|
||||
string hashKey = "";
|
||||
string hashVal = "";
|
||||
|
||||
// Imposto CONF
|
||||
hashKey = redUtil.man.redHash("Adp:Status");
|
||||
hashVal = string.Format("stopped");
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
hashKey = redUtil.man.redHash("Adp:Heartbeat");
|
||||
hashVal = DateTime.UtcNow.ToString("yyyy-MM-dd\\THH:mm:ss.fffK");
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
|
||||
// SOLO se richiesto FULL RESET...
|
||||
if (baseUtils.CRB("fullReset"))
|
||||
{
|
||||
// ora il valore delle chaivi diventa unavailable...
|
||||
hashVal = availStatus.UNAVAILABLE.ToString();
|
||||
// percorro tutto l'albero nodi item ed allarmi e SCRIVO!!!!
|
||||
foreach (var item in itemNodes)
|
||||
{
|
||||
hashKey = machineHash(item.Key);
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
}
|
||||
}
|
||||
|
||||
stopData2Send = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorna stato redis server + invio dati pending
|
||||
/// </summary>
|
||||
private void checkRedisStatusAndSend()
|
||||
{
|
||||
// verifico eventuali invii pending... SE connesso...
|
||||
if (redServAlive)
|
||||
{
|
||||
if (startData2Send)
|
||||
{
|
||||
sendStartData();
|
||||
lg.Info("Reinviati dati sendStartData");
|
||||
}
|
||||
if (refreshData2Send)
|
||||
{
|
||||
sendChangedData(true);
|
||||
lg.Info("Reinviati dati sendChangedData");
|
||||
}
|
||||
if (stopData2Send)
|
||||
{
|
||||
sendStopData();
|
||||
lg.Info("Reinviati dati sendStopData");
|
||||
}
|
||||
}
|
||||
// aggiorno stato redis
|
||||
checkAlive();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Avvio adapter (popolamento iniziale su redis...)
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
// registro che necessito invio dati START
|
||||
startData2Send = true;
|
||||
stopData2Send = false;
|
||||
if (redServAlive)
|
||||
{
|
||||
sendStartData();
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Attenzione! server REDIS non disponibile (START)");
|
||||
// forzo controllo stato
|
||||
checkAlive();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Decodifica il livello di severiti da testo a numerico:
|
||||
/// 900 Alarm
|
||||
/// 500 Warning
|
||||
/// 200 Info
|
||||
/// 100 Maintenance
|
||||
/// </summary>
|
||||
/// <param name="livello"></param>
|
||||
/// <returns></returns>
|
||||
public static string condLevel(string livello)
|
||||
{
|
||||
string answ = "0";
|
||||
switch (livello.ToLower())
|
||||
{
|
||||
case "alarm":
|
||||
case "fault":
|
||||
answ = "900";
|
||||
break;
|
||||
case "warning":
|
||||
answ = "500";
|
||||
break;
|
||||
case "info":
|
||||
answ = "200";
|
||||
break;
|
||||
case "maintenance":
|
||||
answ = "100";
|
||||
break;
|
||||
default:
|
||||
// verifico sia una stringa
|
||||
int lev = 0;
|
||||
int.TryParse(livello, out lev);
|
||||
answ = lev.ToString("000");
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invio dati in fase di AVVIO
|
||||
/// </summary>
|
||||
private void sendStartData()
|
||||
{
|
||||
// var accessorie
|
||||
string hashKey = "";
|
||||
string hashVal = "";
|
||||
string nLevel = "";
|
||||
var listCNC_curr = new List<KeyValuePair<string, string>>();
|
||||
var listPLC_curr = new List<KeyValuePair<string, string>>();
|
||||
var listHMI_curr = new List<KeyValuePair<string, string>>();
|
||||
var listCNC_it = new List<KeyValuePair<string, string>>();
|
||||
var listPLC_it = new List<KeyValuePair<string, string>>();
|
||||
var listHMI_it = new List<KeyValuePair<string, string>>();
|
||||
var listCNC_en = new List<KeyValuePair<string, string>>();
|
||||
var listPLC_en = new List<KeyValuePair<string, string>>();
|
||||
var listHMI_en = new List<KeyValuePair<string, string>>();
|
||||
// resetto TUTTE le aree di competenza
|
||||
redUtil.man.redFlushKey(redUtil.man.redHash("AdpVeto*"));
|
||||
redUtil.man.redFlushKey(redUtil.man.redHash("AdpConf*"));
|
||||
redUtil.man.redFlushKey(redUtil.man.redHash("Adp*"));
|
||||
redUtil.man.redFlushKey(redUtil.man.redHash("Machine*"));
|
||||
// imposto valori "empty" di default....
|
||||
listCNC_curr.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listCNC_en.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listCNC_it.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listHMI_curr.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listHMI_en.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listHMI_it.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listPLC_curr.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listPLC_en.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
listPLC_it.Add(new KeyValuePair<string, string>("000000000000|000", "NONE"));
|
||||
// Imposto CONF
|
||||
hashKey = redUtil.man.redHash("Adp:Vers");
|
||||
hashVal = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
hashKey = redUtil.man.redHash("Adp:Status");
|
||||
hashVal = "started";
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
hashKey = redUtil.man.redHash("Adp:Heartbeat");
|
||||
hashVal = DateTime.UtcNow.ToString("yyyy-MM-dd\\THH:mm:ss.fffK");
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
// allarmi CNC, aggiungo Curr (rif SOURS 2018.11.14)
|
||||
foreach (var item in elencoAllarmi)
|
||||
{
|
||||
// aggiungo secondo gruppo
|
||||
if (item.gruppo.ToUpper().Contains("CNC"))
|
||||
{
|
||||
nLevel = condLevel(item.livello);
|
||||
listCNC_curr.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizione));
|
||||
listCNC_en.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizioneEn));
|
||||
listCNC_it.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizioneIt));
|
||||
}
|
||||
else if (item.gruppo.ToUpper().Contains("HMI"))
|
||||
{
|
||||
nLevel = condLevel(item.livello);
|
||||
listHMI_curr.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizione));
|
||||
listHMI_en.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizioneEn));
|
||||
listHMI_it.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizioneIt));
|
||||
}
|
||||
else if (item.gruppo.ToUpper().Contains("PLC"))
|
||||
{
|
||||
nLevel = condLevel(item.livello);
|
||||
listPLC_curr.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizione));
|
||||
listPLC_en.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizioneEn));
|
||||
listPLC_it.Add(new KeyValuePair<string, string>(item.codNum + "|" + nLevel, item.descrizioneIt));
|
||||
}
|
||||
}
|
||||
// salvo vettori lingua CURR
|
||||
hashKey = confHash("Cnc:Condition:Curr");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listCNC_curr);
|
||||
hashKey = confHash("Hmi:Condition:Curr");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listHMI_curr);
|
||||
hashKey = confHash("Plc:Condition:Curr");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listPLC_curr);
|
||||
// salvo vettori lingua EN
|
||||
hashKey = confHash("Cnc:Condition:En");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listCNC_en);
|
||||
hashKey = confHash("Hmi:Condition:En");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listHMI_en);
|
||||
hashKey = confHash("Plc:Condition:En");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listPLC_en);
|
||||
// salvo vettori lingua IT
|
||||
hashKey = confHash("Cnc:Condition:It");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listCNC_it);
|
||||
hashKey = confHash("Hmi:Condition:It");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listHMI_it);
|
||||
hashKey = confHash("Plc:Condition:It");
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
redUtil.man.redSaveHashList(hashKey, listPLC_it);
|
||||
|
||||
// DataModel --> salvo in redis!
|
||||
hashKey = confHash("DataModel");
|
||||
hashVal = DataModel;
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
|
||||
// imposto VETO
|
||||
hashKey = vetoHash("Cnc:Condition");
|
||||
hashVal = "0,0|000";
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
hashKey = vetoHash("Hmi:Condition");
|
||||
hashVal = "0,0|000";
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
hashKey = vetoHash("Plc:Condition");
|
||||
hashVal = "0,0|000";
|
||||
redUtil.man.redFlushKey(hashKey);
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
|
||||
// Imposto DATI: percorro tutto l'albero nodi item ed allarmi e SCRIVO!!!!
|
||||
foreach (var item in itemNodes)
|
||||
{
|
||||
hashKey = machineHash(item.Key);
|
||||
hashVal = availStatus.UNAVAILABLE.ToString(); // item.Value.cObject.ToString();
|
||||
saveHashKeyVal(hashKey, hashVal);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region helper gestione REDIS
|
||||
|
||||
public string getOrigKey(string redKey)
|
||||
{
|
||||
string answ = redKey;
|
||||
if (nameReplacedInvert.ContainsKey(redKey))
|
||||
{
|
||||
answ = nameReplacedInvert[redKey];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fix KEY x standard redis ("_" --> ":")
|
||||
/// </summary>
|
||||
/// <param name="origKey"></param>
|
||||
/// <returns></returns>
|
||||
public string fixRedKey(string origKey)
|
||||
{
|
||||
// parto da variabile dichiarata
|
||||
string answ = origKey;
|
||||
// se la trovo nel dizionario restituisco...
|
||||
if (nameReplaced != null && nameReplaced.ContainsKey(origKey))
|
||||
{
|
||||
answ = nameReplaced[origKey];
|
||||
}
|
||||
// altrimenti controllo tra esclusi
|
||||
else if (nameExcluded != null && nameExcluded.ContainsKey(origKey))
|
||||
{
|
||||
answ = nameExcluded[origKey];
|
||||
}
|
||||
// altrimenti calcolo e salvo in dizionario...
|
||||
else
|
||||
{
|
||||
bool trovato = false;
|
||||
bool keyExcluded = false;
|
||||
string txt2find = "";
|
||||
// se NON HO un MATCH processo il replace e se trovo corrispondenza processo
|
||||
foreach (var item in nameRepRoles)
|
||||
{
|
||||
// SE NON trovato procedo...
|
||||
if (!trovato)
|
||||
{
|
||||
// cerco se escluso o aggiunto...
|
||||
keyExcluded = item.Value.modo == subsMode.X;
|
||||
// testo cercato
|
||||
txt2find = item.Key;
|
||||
// B --> cerco inizio
|
||||
if (item.Value.search == substSearch.B)
|
||||
{
|
||||
trovato = answ.StartsWith(txt2find);
|
||||
}
|
||||
// E --> cerco fine
|
||||
else if (item.Value.search == substSearch.E)
|
||||
{
|
||||
trovato = answ.EndsWith(txt2find);
|
||||
}
|
||||
// I --> cerco IDENTICO
|
||||
else if (item.Value.search == substSearch.I)
|
||||
{
|
||||
trovato = (answ == txt2find);
|
||||
}
|
||||
// C --> cerco OVUNQUE contenuto
|
||||
else if (item.Value.search == substSearch.C)
|
||||
{
|
||||
trovato = answ.IndexOf(txt2find) >= 0;
|
||||
}
|
||||
// se trovato SOSTITUISCO...
|
||||
if (trovato)
|
||||
{
|
||||
// effetuo sostituzione chiave/valore
|
||||
answ = answ.Replace(txt2find, item.Value.tradz);
|
||||
}
|
||||
}
|
||||
}
|
||||
// se è escluso --> salvo in escluso e restituisco NONE
|
||||
if (keyExcluded && trovato)
|
||||
{
|
||||
answ = "NONE";
|
||||
// salvo in dizionario
|
||||
if (nameExcluded != null && nameExcluded.ContainsKey(origKey))
|
||||
{
|
||||
nameExcluded.Remove(origKey);
|
||||
}
|
||||
// salvo in dizionario
|
||||
nameExcluded.Add(origKey, "NONE");
|
||||
}
|
||||
else
|
||||
{
|
||||
// altrimenti continuo: sostituzione "_" --> ":"
|
||||
try
|
||||
{
|
||||
answ = answ.Replace("_", ":");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// SOLO SE DIFFERISCONO SALVO...
|
||||
if (answ != origKey)
|
||||
{
|
||||
if (nameReplaced != null && !nameReplaced.ContainsKey(origKey))
|
||||
{
|
||||
// salvo in dizionario
|
||||
nameReplaced.Add(origKey, answ);
|
||||
}
|
||||
if (nameReplacedInvert != null && !nameReplacedInvert.ContainsKey(answ))
|
||||
{
|
||||
// salvo in dizionario INVERSO (SE C'E' conversione...)
|
||||
nameReplacedInvert.Add(answ, origKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// HASH x la parte MACHINE del server REDIS
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
/// <returns></returns>
|
||||
public string machineHash(string keyName)
|
||||
{
|
||||
return redUtil.man.redHash("Machine:" + fixRedKey(keyName));
|
||||
}
|
||||
/// <summary>
|
||||
/// HASH x la parte ADAPTER CONF del server REDIS
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
/// <returns></returns>
|
||||
public string confHash(string keyName)
|
||||
{
|
||||
return redUtil.man.redHash("AdpConf:" + fixRedKey(keyName));
|
||||
}
|
||||
/// <summary>
|
||||
/// HASH x la parte ADAPTER ERRORS del server REDIS
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
/// <returns></returns>
|
||||
public string adpErHash(string keyName)
|
||||
{
|
||||
return redUtil.man.redHash("AdpError:" + fixRedKey(keyName));
|
||||
}
|
||||
/// <summary>
|
||||
/// HASH x la parte VETO del server REDIS
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
/// <returns></returns>
|
||||
public string vetoHash(string keyName)
|
||||
{
|
||||
return redUtil.man.redHash("AdpVeto:" + fixRedKey(keyName));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,510 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OPC_UA_REDIS
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe dataitem x REDIS:
|
||||
/// - classe base x dataItem
|
||||
/// - possiede valore e nome astratti
|
||||
/// - tiene traccia di modifica dall'ultimo reset
|
||||
/// </summary>
|
||||
public class DataItemRed
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// NOME del data item
|
||||
/// </summary>
|
||||
protected String mName;
|
||||
|
||||
/// <summary>
|
||||
/// VALORE del data item, può essere ogni type.
|
||||
/// </summary>
|
||||
protected object mValue = "UNAVAILABLE";
|
||||
|
||||
/// <summary>
|
||||
/// A flag to indicate if the data item's value has changed since it
|
||||
/// has last been set.
|
||||
/// </summary>
|
||||
protected bool mChanged = true;
|
||||
|
||||
/// <summary>
|
||||
/// Prefisso (opzionale)
|
||||
/// </summary>
|
||||
public string DevicePrefix = null;
|
||||
|
||||
public DataItemRed(string name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
public string Name { get { return mName; } }
|
||||
/// <summary>
|
||||
/// Get/set del valore
|
||||
/// </summary>
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!mValue.Equals(value))
|
||||
{
|
||||
mValue = value;
|
||||
mChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Rende data item unavailable.
|
||||
/// </summary>
|
||||
public virtual void Unavailable() { Value = "NULL"; }
|
||||
|
||||
/// <summary>
|
||||
/// Controlla se data item sia unavailable.
|
||||
/// </summary>
|
||||
/// <returns>true if Unavailable</returns>
|
||||
public bool IsUnavailable() { return mValue.Equals("NULL"); }
|
||||
|
||||
/// <summary>
|
||||
/// Getter x la proprietà mChanged
|
||||
/// </summary>
|
||||
public bool Changed { get { return mChanged; } }
|
||||
public void ForceChanged()
|
||||
{
|
||||
mChanged = true;
|
||||
}
|
||||
/// <summary>
|
||||
/// These methods are mainly for conditions. They allow for
|
||||
/// mark and sweep of the condition activations.
|
||||
/// </summary>
|
||||
public virtual void Begin() { }
|
||||
public virtual void Prepare() { }
|
||||
|
||||
/// <summary>
|
||||
/// Reset the Changed flag.
|
||||
/// </summary>
|
||||
public virtual void Cleanup() { mChanged = false; }
|
||||
/// <summary>
|
||||
/// Get a list of all the changed data items. Since this is a
|
||||
/// single value, just return a list with one item if it has
|
||||
/// changed
|
||||
/// </summary>
|
||||
/// <param name="onlyChanged">true means to return this data item regardless of the
|
||||
/// changed flag. This is used to send initial data back to a new client.</param>
|
||||
/// <returns>The changed data item</returns>
|
||||
public virtual List<DataItemRed> ItemList(bool all = false)
|
||||
{
|
||||
List<DataItemRed> list = new List<DataItemRed>();
|
||||
if (all || mChanged)
|
||||
{
|
||||
list.Add(this);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A condition handles the fact that a single condition can have multiple
|
||||
/// activations and needs to check when the are present and are cleared.
|
||||
/// </summary>
|
||||
public class ConditionRed : DataItemRed
|
||||
{
|
||||
/// <summary>
|
||||
/// The four values for the condition.
|
||||
/// </summary>
|
||||
public enum Level
|
||||
{
|
||||
UNAVAILABLE,
|
||||
NORMAL,
|
||||
WARNING,
|
||||
FAULT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Activation is itself a data item. This is so it can be cleared
|
||||
/// and treated like other data items when generating text.
|
||||
/// </summary>
|
||||
public class Active : DataItemRed
|
||||
{
|
||||
// The pieces of the activation are only used by the condition.
|
||||
public Level mLevel;
|
||||
public string mText;
|
||||
public string mNativeCode;
|
||||
public string mNativeSeverity;
|
||||
public string mQualifier;
|
||||
|
||||
/// <summary>
|
||||
/// The marked flag tells if this alarm has been reasserted.
|
||||
/// </summary>
|
||||
public bool mMarked = true;
|
||||
|
||||
/// <summary>
|
||||
/// A placeholder activation is just a normal or unavailable.
|
||||
/// </summary>
|
||||
public bool mPlaceholder = false;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new activation
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the condition, passed from the parent</param>
|
||||
/// <param name="level">The condition level</param>
|
||||
/// <param name="text">The descriptive text for the condition</param>
|
||||
/// <param name="code">The native code of the alarm or warning</param>
|
||||
/// <param name="qualifier">A high/low qualifier</param>
|
||||
/// <param name="severity">The native severity of the condition</param>
|
||||
public Active(string name, Level level, string text = "", string code = "",
|
||||
string qualifier = "", string severity = "")
|
||||
: base(name)
|
||||
{
|
||||
mLevel = level;
|
||||
mText = text;
|
||||
mNativeCode = code;
|
||||
mQualifier = qualifier;
|
||||
mNativeSeverity = severity;
|
||||
|
||||
if (mNativeCode.Length == 0 && (mLevel == Level.NORMAL || mLevel == Level.UNAVAILABLE))
|
||||
{
|
||||
mPlaceholder = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the values of the activation. Also marks this activation.
|
||||
/// </summary>
|
||||
/// <param name="level">The condition level</param>
|
||||
/// <param name="text">The descriptive text for the condition</param>
|
||||
/// <param name="qualifier">A high/low qualifier</param>
|
||||
/// <param name="severity">The native severity of the condition</param>
|
||||
/// <returns>true if the condition has changed</returns>
|
||||
public bool Set(Level level, string text = "",
|
||||
string qualifier = "", string severity = "")
|
||||
{
|
||||
mChanged = level != mLevel || text != mText || qualifier != mQualifier ||
|
||||
severity != mNativeSeverity;
|
||||
if (mChanged)
|
||||
{
|
||||
mLevel = level;
|
||||
mQualifier = qualifier;
|
||||
mText = text;
|
||||
mNativeSeverity = severity;
|
||||
}
|
||||
|
||||
mMarked = true;
|
||||
return mChanged;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return mName + "|" + Enum.GetName(mLevel.GetType(), mLevel) + "|" + mNativeCode + "|" + mNativeSeverity + "|" + mQualifier + "|" + mText;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the marked flag.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
mMarked = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A flag to indicate that the mark and sweep has begun.
|
||||
/// </summary>
|
||||
bool mBegun = false;
|
||||
|
||||
/// <summary>
|
||||
/// A flag indicating the second phase of the mark and sweep has completed.
|
||||
/// </summary>
|
||||
bool mPrepared = false;
|
||||
|
||||
/// <summary>
|
||||
/// true means this is a simple condition and does not require
|
||||
/// mark and sweep processing.
|
||||
/// </summary>
|
||||
bool mSimple;
|
||||
List<Active> mActiveList = new List<Active>();
|
||||
|
||||
/// <summary>
|
||||
/// Create a new condition
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the data item</param>
|
||||
/// <param name="simple">If this is a simple condition or if it uses
|
||||
/// mark and sweep</param>
|
||||
public ConditionRed(String name, bool simple = false) : base(name)
|
||||
{
|
||||
mSimple = simple;
|
||||
Add(new Active(mName, Level.UNAVAILABLE));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make this condition unavailable
|
||||
/// </summary>
|
||||
public override void Unavailable()
|
||||
{
|
||||
Add(Level.UNAVAILABLE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This clears all the marks and begins so we can tell which
|
||||
/// conditions were not added during this pass. This is not
|
||||
/// required for simple conditions.
|
||||
/// </summary>
|
||||
public override void Begin()
|
||||
{
|
||||
if (!mSimple)
|
||||
{
|
||||
foreach (Active active in mActiveList)
|
||||
{
|
||||
active.Clear();
|
||||
}
|
||||
|
||||
mBegun = true;
|
||||
}
|
||||
|
||||
mPrepared = mChanged = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called before we send the actual changed data. It
|
||||
/// does the diff from the previous state and finds all the
|
||||
/// activations that need to be removed. This also check to see
|
||||
/// if all the activations have been removed because we only
|
||||
/// need to do a single normal with no native code to clear all.
|
||||
///
|
||||
/// This is not required for simple conditions.
|
||||
/// </summary>
|
||||
public override void Prepare()
|
||||
{
|
||||
if (mBegun)
|
||||
{
|
||||
bool marked = false;
|
||||
|
||||
// Check to see if we have any active marked conditions
|
||||
foreach (Active active in mActiveList)
|
||||
{
|
||||
if (active.mPlaceholder || active.mMarked)
|
||||
{
|
||||
marked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If they've all been cleared, then go back to normal.
|
||||
if (!marked)
|
||||
{
|
||||
Normal();
|
||||
}
|
||||
|
||||
// Sweep the old conditions and if they are not marked
|
||||
// set them to normal.
|
||||
foreach (Active active in mActiveList)
|
||||
{
|
||||
if (!active.mPlaceholder && !active.mMarked)
|
||||
{
|
||||
active.Set(Level.NORMAL, "");
|
||||
active.mMarked = false;
|
||||
}
|
||||
if (active.Changed)
|
||||
{
|
||||
mChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
mPrepared = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the sweep phase where we removed the changed flags
|
||||
/// and remove all the stale activations.
|
||||
/// </summary>
|
||||
public override void Cleanup()
|
||||
{
|
||||
base.Cleanup();
|
||||
|
||||
mBegun = mPrepared = false;
|
||||
foreach (Active active in mActiveList.ToList())
|
||||
{
|
||||
// It is assumed that if the activations are no longer needed, they will
|
||||
// be removed here after they are returned.
|
||||
if (!active.mPlaceholder && !active.mMarked)
|
||||
{
|
||||
mActiveList.Remove(active);
|
||||
}
|
||||
|
||||
active.Cleanup();
|
||||
}
|
||||
|
||||
// Remvoe stale items from the active list that are not marked
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new activation.
|
||||
/// </summary>
|
||||
/// <param name="active"></param>
|
||||
private void Add(Active active)
|
||||
{
|
||||
mActiveList.Add(active);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new activation to the condition or if normal or unavailable, removes the
|
||||
/// activation.
|
||||
/// </summary>
|
||||
/// <param name="level">The level</param>
|
||||
/// <param name="text">The descriptive text for the condition</param>
|
||||
/// <param name="code">The native code</param>
|
||||
/// <param name="qualifier">The qualifier</param>
|
||||
/// <param name="severity">The native severity</param>
|
||||
/// <returns>true if the activation is modified</returns>
|
||||
public bool Add(Level level, string text = "", string code = "", string qualifier = "", string severity = "")
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
// Get the first activation
|
||||
Active first = null;
|
||||
if (mActiveList.Count > 0)
|
||||
{
|
||||
first = mActiveList.First();
|
||||
}
|
||||
|
||||
// Check for a reset of all conditions for a normal or an unavailable
|
||||
if ((level == Level.NORMAL || level == Level.UNAVAILABLE) && code.Length == 0)
|
||||
{
|
||||
// If we haven't changed.
|
||||
if (mActiveList.Count == 1 && first.mLevel == level)
|
||||
{
|
||||
first.mMarked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create a new placeholder activation. We don't need to remember the
|
||||
// old activations because the global normal will reset everything.
|
||||
mActiveList.Clear();
|
||||
Add(new Active(mName, level));
|
||||
result = mChanged = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the first entry is a normal or unavailable and we are entering
|
||||
// into a warning or fault, remove the normal or unavailable
|
||||
if (mActiveList.Count() == 1 && first.mPlaceholder)
|
||||
{
|
||||
mActiveList.Clear();
|
||||
}
|
||||
|
||||
// See if we can find the activation with the same native code.
|
||||
Active found = mActiveList.Find(delegate (Active ak) { return ak.mNativeCode == code; });
|
||||
|
||||
if (found != null)
|
||||
{
|
||||
// If we found it, update all the properties and see if it has changed.
|
||||
// This will mark this activation
|
||||
result = found.Set(level, text, qualifier, severity);
|
||||
mChanged = mChanged || result;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, we have a new activation and we should create a new one.
|
||||
Add(new Active(mName, level, text, code, qualifier, severity));
|
||||
result = mChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear a condition from the active list - Used only for simple Conditions.
|
||||
/// </summary>
|
||||
/// <param name="code">The native code</param>
|
||||
/// <returns>true if the activation is found</returns>
|
||||
public bool Clear(string code)
|
||||
{
|
||||
// Find the activation.
|
||||
Active found = mActiveList.Find(delegate (Active ak) { return ak.mNativeCode == code; });
|
||||
|
||||
if (found != null)
|
||||
{
|
||||
// If we've removed the last activation, go back to normal.
|
||||
if (mActiveList.Count() == 1)
|
||||
{
|
||||
Add(Level.NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, just clear this one.
|
||||
found.Set(Level.NORMAL);
|
||||
// Clear makes the activation be removed next sweep.
|
||||
found.Clear();
|
||||
}
|
||||
mChanged = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Cover to set everything to normal.
|
||||
public bool Normal()
|
||||
{
|
||||
return Add(Level.NORMAL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to get a list of the active conditions for writing out to
|
||||
/// the clients.
|
||||
/// </summary>
|
||||
/// <param name="all">This flag is used to get all activations, regardless
|
||||
/// of their changed state. This is used to deliver initial state to the client</param>
|
||||
/// <returns>A list of activations (also DataItems)</returns>
|
||||
public override List<DataItemRed> ItemList(bool all = false)
|
||||
{
|
||||
List<DataItemRed> list = new List<DataItemRed>();
|
||||
if (all)
|
||||
{
|
||||
// Just grab all the activations.
|
||||
foreach (Active active in mActiveList)
|
||||
{
|
||||
list.Add(active);
|
||||
}
|
||||
}
|
||||
else if (mSimple)
|
||||
{
|
||||
// For a simple condition, we are only looking for the changed set.
|
||||
// Since we don't care about the mark and sweep, this is similar to
|
||||
// all other data items.
|
||||
foreach (Active active in mActiveList)
|
||||
{
|
||||
if (active.Changed)
|
||||
{
|
||||
list.Add(active);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mBegun && mPrepared)
|
||||
{
|
||||
if (mChanged)
|
||||
{
|
||||
// Find all the changed activations and add them to the list
|
||||
foreach (Active active in mActiveList)
|
||||
{
|
||||
if (active.Changed)
|
||||
{
|
||||
list.Add(active);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,38 +4,53 @@
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||
|
||||
<!-- optional, add some variables
|
||||
|
||||
<!-- optional, add some variabeles
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
<targets async="true">
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File"
|
||||
name="f"
|
||||
fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}"
|
||||
/>
|
||||
<!--<target xsi:type="File"
|
||||
name="default"
|
||||
layout="${longdate} - ${level:uppercase=true}: ${message}${onexception:${newline}EXCEPTION\: ${exception:format=ToString}}"
|
||||
fileName="${specialfolder:ApplicationData}\${appName}\Debug.log"
|
||||
keepFileOpen="false"
|
||||
archiveFileName="${specialfolder:ApplicationData}\${appName}\Debug_${shortdate}.{##}.log"
|
||||
archiveNumbering="Sequence"
|
||||
archiveEvery="Day"
|
||||
maxArchiveFiles="30"
|
||||
/>-->
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
</rules>
|
||||
</nlog>
|
||||
</nlog>
|
||||
+671
-189
File diff suppressed because it is too large
Load Diff
@@ -9,9 +9,10 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>OPC_UA_REDIS</RootNamespace>
|
||||
<AssemblyName>OPC-UA-REDIS</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -31,18 +32,57 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="StackExchange.Redis, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\StackExchange.Redis.1.2.6\lib\net46\StackExchange.Redis.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.1.16\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\StackExchange.Redis.2.1.58\lib\net461\StackExchange.Redis.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.7.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Pipelines, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.4.7.2\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Threading.Channels, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Channels.4.7.1\lib\net461\System.Threading.Channels.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -52,17 +92,26 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdapterRed.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SOUR-IO.cs" />
|
||||
<Compile Include="DataItemRed.cs" />
|
||||
<Compile Include="redUtil.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="app.config" />
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MTC\MTC.csproj">
|
||||
<Project>{ec83d80e-9f3b-4de9-b16a-ca216543b7ec}</Project>
|
||||
<Name>MTC</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OPC_UA_REDIS
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe utilità per Input/Output su SERVER REDIS
|
||||
/// </summary>
|
||||
public class SOUR_IO
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,7 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.5.8" targetFramework="net461" />
|
||||
<package id="NLog.Config" version="4.5.8" targetFramework="net461" />
|
||||
<package id="NLog.Schema" version="4.5.8" targetFramework="net461" />
|
||||
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net461" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" />
|
||||
<package id="NLog" version="4.7.10" targetFramework="net462" />
|
||||
<package id="NLog.Schema" version="4.7.10" targetFramework="net462" />
|
||||
<package id="Pipelines.Sockets.Unofficial" version="2.1.16" targetFramework="net462" />
|
||||
<package id="StackExchange.Redis" version="2.1.58" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Diagnostics.PerformanceCounter" version="4.7.0" targetFramework="net462" />
|
||||
<package id="System.IO.Compression" version="4.3.0" targetFramework="net462" />
|
||||
<package id="System.IO.Pipelines" version="4.7.2" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net462" />
|
||||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
|
||||
<package id="System.Threading.Channels" version="4.7.1" targetFramework="net462" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -0,0 +1,803 @@
|
||||
using MTC;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OPC_UA_REDIS
|
||||
{
|
||||
public class redUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// wrapper di log
|
||||
/// </summary>
|
||||
public static Logger lg;
|
||||
|
||||
|
||||
public redUtil()
|
||||
{
|
||||
lg = LogManager.GetCurrentClassLogger();
|
||||
}
|
||||
/// <summary>
|
||||
/// Metodo accesso statico
|
||||
/// </summary>
|
||||
public static redUtil man = new redUtil();
|
||||
|
||||
#region gestione valori in RedisCache
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Nome della variabile HASH da utilizzare (dato CodModulo / Server / DB impiegato da funzionalita' DbConfig) + keyName richiesto...
|
||||
/// </summary>
|
||||
public string redHash(string keyName)
|
||||
{
|
||||
string answ = keyName;
|
||||
try
|
||||
{
|
||||
answ = string.Format("{0}:{1}", baseUtils.CRS("SOURS_baseHash"), keyName);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connessione lazy a redis...
|
||||
/// </summary>
|
||||
private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
|
||||
{
|
||||
return ConnectionMultiplexer.Connect("127.0.0.1,abortConnect=false,ssl=false");
|
||||
});
|
||||
/// <summary>
|
||||
/// Connessione lazy a redis...
|
||||
/// </summary>
|
||||
private static Lazy<ConnectionMultiplexer> lazyConnectionAdmin = new Lazy<ConnectionMultiplexer>(() =>
|
||||
{
|
||||
return ConnectionMultiplexer.Connect("127.0.0.1,abortConnect=false,ssl=false,allowAdmin=true");
|
||||
});
|
||||
/// <summary>
|
||||
/// Oggetto statico connessione redis
|
||||
/// </summary>
|
||||
public static ConnectionMultiplexer connRedis
|
||||
{
|
||||
get
|
||||
{
|
||||
return lazyConnection.Value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Oggetto statico connessione redis
|
||||
/// </summary>
|
||||
public static ConnectionMultiplexer connRedisAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
return lazyConnectionAdmin.Value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce info dei server connessi...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IServer[] redServInfo()
|
||||
{
|
||||
IServer[] answ = new IServer[1];
|
||||
if (connRedisAdmin.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = new IServer[connRedisAdmin.GetEndPoints().Length];
|
||||
int i = 0;
|
||||
foreach (var ep in connRedisAdmin.GetEndPoints())
|
||||
{
|
||||
var server = connRedisAdmin.GetServer(ep);
|
||||
answ[i] = server;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error("Eccezione in redServInfo: " + exc.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Server REDIS Admin non disponibile");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce una chiave salvata in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <returns></returns>
|
||||
public string getRSV(string chiave)
|
||||
{
|
||||
string answ = "";
|
||||
if (connRedis.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
answ = cache.StringGet(chiave);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in getRSV:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Server REDIS non disponibile per getRSV");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salva una chiave in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <param name="valore"></param>
|
||||
/// <returns></returns>
|
||||
public bool setRSV(string chiave, string valore)
|
||||
{
|
||||
bool answ = false;
|
||||
if (connRedis.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
cache.StringSet(chiave, valore);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in setRSV:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Server REDIS non disponibile (setRSV)");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salva una chiave in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <param name="valore"></param>
|
||||
/// <param name="TTL_sec">in secondi</param>
|
||||
/// <returns></returns>
|
||||
public bool setRSV(string chiave, string valore, int TTL_sec)
|
||||
{
|
||||
bool answ = false;
|
||||
if (connRedis.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
TimeSpan expT = new TimeSpan(0, 0, TTL_sec);
|
||||
// salvo con expyry...
|
||||
cache.StringSet(chiave, valore, expT);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in setRSV:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Server REDIS non disponibile (setRSV:TTL)");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Incrementa un contatore in Redis
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <returns></returns>
|
||||
public long setRCntI(string chiave)
|
||||
{
|
||||
long answ = 0;
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
answ = cache.StringIncrement(chiave, 1);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in setRCI:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Decrementa un contatore in Redis
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <returns></returns>
|
||||
public long setRCntD(string chiave)
|
||||
{
|
||||
long answ = 0;
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
answ = cache.StringDecrement(chiave, 1);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in setRCD:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce una chiave COUNTER in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <returns></returns>
|
||||
public int getRCnt(string chiave)
|
||||
{
|
||||
int answInt = 0;
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
answ = cache.StringGet(chiave);
|
||||
answInt = Convert.ToInt32(answ);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in getRSV:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answInt;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resetta (elimina) un contatore in Redis
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <returns></returns>
|
||||
public bool resetRCnt(string chiave)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
answ = cache.KeyDelete(chiave);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in resetRCnt:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce un set KVP (Key Value Pair) salvati in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="chiavi"></param>
|
||||
/// <returns></returns>
|
||||
public RedisValue[] getRKeys(RedisKey[] chiavi)
|
||||
{
|
||||
RedisValue[] answ = null;
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
answ = cache.StringGet(chiavi);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in getRKeys:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salva un set KVP (Key Value Pair) in RedisCache
|
||||
/// </summary>
|
||||
/// <param name="valori">Set KVP chiave-valore da salvare</param>
|
||||
/// <returns></returns>
|
||||
public bool setRKeys(KeyValuePair<RedisKey, RedisValue>[] valori)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
cache.StringSet(valori);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Info(string.Format("Errore in setRKeys:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica se ci siano valori nella hash indicata...
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public bool redHashPresent(RedisKey key)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
answ = cache.HashGetAll(key).Length > 0;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica se ci siano valori nella hash indicata (string)
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public bool redHashPresentSz(string key)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
RedisKey chiave = key;
|
||||
answ = redHashPresent(chiave);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera tutti i valori dalla hash
|
||||
/// </summary>
|
||||
/// <param name="hashKey"></param>
|
||||
/// <returns></returns>
|
||||
public KeyValuePair<string, string>[] redGetHash(string hashKey)
|
||||
{
|
||||
KeyValuePair<string, string>[] answ = new KeyValuePair<string, string>[1];
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
HashEntry[] valori = cache.HashGetAll(chiave);
|
||||
answ = new KeyValuePair<string, string>[valori.Length];
|
||||
int i = 0;
|
||||
foreach (HashEntry item in valori)
|
||||
{
|
||||
answ[i] = new KeyValuePair<string, string>(item.Name, item.Value);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera tutti i valori dalla hash in formato Dictionary
|
||||
/// </summary>
|
||||
/// <param name="hashKey"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<string, string> redGetHashDict(string hashKey)
|
||||
{
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
HashEntry[] valori = cache.HashGetAll(chiave);
|
||||
foreach (HashEntry item in valori)
|
||||
{
|
||||
answ.Add(item.Name, item.Value);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera UN SINGOLO VALORE dalla hash per un dato field
|
||||
/// </summary>
|
||||
/// <param name="hashKey"></param>
|
||||
/// <param name="hashField"></param>
|
||||
/// <returns></returns>
|
||||
public string redGetHashField(string hashKey, string hashField)
|
||||
{
|
||||
string answ = "";
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
RedisValue campo = hashField;
|
||||
RedisValue valOut = cache.HashGet(chiave, campo);
|
||||
answ = valOut.ToString();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvataggio di una hash di valori
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashFields">valori</param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHash(string hashKey, KeyValuePair<string, string>[] hashFields)
|
||||
{
|
||||
bool answ = false;
|
||||
if (connRedis.IsConnected)
|
||||
{
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
HashEntry[] valori = new HashEntry[hashFields.Length];
|
||||
int i = 0;
|
||||
foreach (KeyValuePair<string, string> kvp in hashFields)
|
||||
{
|
||||
valori[i] = new HashEntry(kvp.Key, kvp.Value);
|
||||
i++;
|
||||
}
|
||||
cache.HashSet(chiave, valori);
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Server REDIS non disponibile (redSaveHash)");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvataggio di una hash di valori
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashListKVP">valori come lista KVP</param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHashList(string hashKey, List<KeyValuePair<string, string>> hashListKVP)
|
||||
{
|
||||
bool answ = false;
|
||||
if (connRedis.IsConnected)
|
||||
{
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
HashEntry[] valori = new HashEntry[hashListKVP.Count];
|
||||
int i = 0;
|
||||
foreach (KeyValuePair<string, string> kvp in hashListKVP)
|
||||
{
|
||||
valori[i] = new HashEntry(kvp.Key, kvp.Value);
|
||||
i++;
|
||||
}
|
||||
cache.HashSet(chiave, valori);
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Server REDIS non disponibile (redSaveHashList)");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvataggio di una hash di valori in formato Dictionary
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashFields">valori</param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHashDict(string hashKey, Dictionary<string, string> hashFields)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
HashEntry[] valori = new HashEntry[hashFields.Count];
|
||||
int i = 0;
|
||||
foreach (KeyValuePair<string, string> kvp in hashFields)
|
||||
{
|
||||
valori[i] = new HashEntry(kvp.Key, kvp.Value);
|
||||
i++;
|
||||
}
|
||||
cache.HashSet(chiave, valori);
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvataggio di una hash di valori
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashFields">valori</param>
|
||||
/// <param name="expireSeconds">scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)</param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHash(string hashKey, KeyValuePair<string, string>[] hashFields, double expireSeconds = -1)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
answ = redSaveHash(hashKey, hashFields);
|
||||
if (expireSeconds > 0)
|
||||
{
|
||||
cache.KeyExpire(chiave, DateTime.Now.AddSeconds(expireSeconds));
|
||||
}
|
||||
//answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvataggio di una hash di valori in formato Dictionary
|
||||
/// </summary>
|
||||
/// <param name="hashKey">chiave</param>
|
||||
/// <param name="hashFields">valori</param>
|
||||
/// <param name="expireSeconds">scadenza preimpostata hash (secondi) | defaoult = -1 (non scade)</param>
|
||||
/// <returns></returns>
|
||||
public bool redSaveHashDict(string hashKey, Dictionary<string, string> hashFields, double expireSeconds = -1)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = hashKey;
|
||||
answ = redSaveHashDict(hashKey, hashFields);
|
||||
if (expireSeconds > 0)
|
||||
{
|
||||
cache.KeyExpire(chiave, DateTime.Now.AddSeconds(expireSeconds));
|
||||
}
|
||||
//answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elimina una key (hash, string)
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public bool redDelKey(string key)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
try
|
||||
{
|
||||
RedisKey chiave = key;
|
||||
cache.KeyDelete(chiave);
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Flush completo cache redis
|
||||
/// </summary>
|
||||
/// <param name="keyPattern">** = tutti</param>
|
||||
/// <returns></returns>
|
||||
public bool redFlushKey(string keyPattern)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
// se vuoto = ALL...
|
||||
keyPattern = keyPattern == "" ? "**" : keyPattern;
|
||||
try
|
||||
{
|
||||
foreach (var ep in connRedis.GetEndPoints())
|
||||
{
|
||||
var server = connRedis.GetServer(ep);
|
||||
foreach (var key in server.Keys(pattern: keyPattern))
|
||||
{
|
||||
cache.KeyDelete(key);
|
||||
}
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Eccezione: {0}", exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Conta num oggetti cache redis che rispondono a pattern
|
||||
/// </summary>
|
||||
/// <param name="keyPattern">** = tutti</param>
|
||||
/// <returns></returns>
|
||||
public int redCountKey(string keyPattern)
|
||||
{
|
||||
int answ = 0;
|
||||
// cerco se ci sia valore in redis...
|
||||
IDatabase cache = connRedis.GetDatabase();
|
||||
// se vuoto = ALL...
|
||||
keyPattern = keyPattern == "" ? "**" : keyPattern;
|
||||
try
|
||||
{
|
||||
foreach (var ep in connRedis.GetEndPoints())
|
||||
{
|
||||
var server = connRedis.GetServer(ep);
|
||||
foreach (var key in server.Keys(pattern: keyPattern))
|
||||
{
|
||||
answ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Eccezione: {0}", exc));
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce numero record in Redis DB
|
||||
/// </summary>
|
||||
public long numRecRedis
|
||||
{
|
||||
get
|
||||
{
|
||||
long answ = 0;
|
||||
try
|
||||
{
|
||||
foreach (var ep in connRedis.GetEndPoints())
|
||||
{
|
||||
var server = connRedis.GetServer(ep);
|
||||
answ += server.DatabaseSize();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce oggetti cache redis che rispondono a pattern
|
||||
/// </summary>
|
||||
/// <param name="keyPattern">** = tutti</param>
|
||||
/// <param name="orderBy">Tipo di ordinamento per kvp</param>
|
||||
/// <returns></returns>
|
||||
public List<KeyValuePair<string, int>> redGetCounterByKey(string keyPattern, kvpOrderBy orderBy)
|
||||
{
|
||||
int numAnsw = redCountKey(keyPattern);
|
||||
RedisKey[] chiavi = new RedisKey[numAnsw];
|
||||
List<KeyValuePair<string, int>> answ = new List<KeyValuePair<string, int>>();
|
||||
// se vuoto = ALL...
|
||||
keyPattern = keyPattern == "" ? "**" : keyPattern;
|
||||
|
||||
// recupero in primis elenco chiavi
|
||||
try
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var ep in connRedis.GetEndPoints())
|
||||
{
|
||||
var server = connRedis.GetServer(ep);
|
||||
foreach (var key in server.Keys(pattern: keyPattern))
|
||||
{
|
||||
chiavi[i] = key;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Eccezione: {0}", exc));
|
||||
}
|
||||
// ora recupero valori!
|
||||
var valori = getRKeys(chiavi);
|
||||
int currVal = 0;
|
||||
// popolo rispsota
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < numAnsw; i++)
|
||||
{
|
||||
Int32.TryParse(valori[i], out currVal);
|
||||
answ.Add(new KeyValuePair<string, int>(chiavi[i], currVal));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// se richiesto riordino...
|
||||
switch (orderBy)
|
||||
{
|
||||
case kvpOrderBy.KeyAsc:
|
||||
answ.Sort(CompareKey);
|
||||
break;
|
||||
case kvpOrderBy.KeyDesc:
|
||||
answ.Sort(CompareKeyDesc);
|
||||
break;
|
||||
case kvpOrderBy.ValAsc:
|
||||
answ.Sort(CompareVal);
|
||||
break;
|
||||
case kvpOrderBy.ValDesc:
|
||||
answ.Sort(CompareValDesc);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x CHIAVE in KVP ASC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private int CompareKey(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return x.Key.CompareTo(y.Key);
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x VALORE in KVP ASC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int CompareVal(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return x.Value.CompareTo(y.Value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x CHIAVE in KVP DESC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
private int CompareKeyDesc(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return y.Key.CompareTo(x.Key);
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua comaprazione x VALORE in KVP DESC
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int CompareValDesc(KeyValuePair<string, int> x, KeyValuePair<string, int> y)
|
||||
{
|
||||
return y.Value.CompareTo(x.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia di ordinamento x liste KVP
|
||||
/// </summary>
|
||||
public enum kvpOrderBy
|
||||
{
|
||||
/// <summary>
|
||||
/// Ordinamento ASCending per KEY
|
||||
/// </summary>
|
||||
KeyAsc,
|
||||
/// <summary>
|
||||
/// Ordinamento DESCending per KEY
|
||||
/// </summary>
|
||||
KeyDesc,
|
||||
/// <summary>
|
||||
/// Ordinamento ASCending per VAL
|
||||
/// </summary>
|
||||
ValAsc,
|
||||
/// <summary>
|
||||
/// Ordinamento DESCending per VAL
|
||||
/// </summary>
|
||||
ValDesc
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+35
-18
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26403.7
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29926.136
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{695A97F7-B396-4DD3-8596-F043ECA3E2BD}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
@@ -24,12 +24,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MTC-ADB", "MTC-ADB\MTC-ADB.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MTC", "MTC\MTC.csproj", "{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetAdapterSDK", "..\..\..\..\GitHub\MTConnect\dot_net_sdk\DotNetAdapterSDK.csproj", "{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OPC-UA-REDIS", "OPC-UA-REDIS\OPC-UA-REDIS.csproj", "{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EsaCncLib", "EsaCncLib\EsaCncLib.csproj", "{884C07F1-7E6E-4A3D-BF1E-FECF36348268}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CMS-ESA|Any CPU = CMS-ESA|Any CPU
|
||||
CMS-FANUC|Any CPU = CMS-FANUC|Any CPU
|
||||
CMS-OSAI|Any CPU = CMS-OSAI|Any CPU
|
||||
CMS-SIEMENS|Any CPU = CMS-SIEMENS|Any CPU
|
||||
@@ -39,6 +40,8 @@ Global
|
||||
SCM-ESA|Any CPU = SCM-ESA|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -53,6 +56,8 @@ Global
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2D769FFD-1122-4276-A115-29246E6D23C5}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.CMS-ESA|Any CPU.ActiveCfg = CMS-ESA|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.CMS-ESA|Any CPU.Build.0 = CMS-ESA|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.CMS-FANUC|Any CPU.ActiveCfg = CMS-FANUC|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.CMS-FANUC|Any CPU.Build.0 = CMS-FANUC|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.CMS-OSAI|Any CPU.ActiveCfg = CMS-OSAI|Any CPU
|
||||
@@ -67,6 +72,8 @@ Global
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.SCM-ESA|Any CPU.ActiveCfg = SCM-ESA|Any CPU
|
||||
{736DF121-11E6-4D46-835D-6560ACF241E4}.SCM-ESA|Any CPU.Build.0 = SCM-ESA|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -81,6 +88,8 @@ Global
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{58E399F3-9D4E-49D3-AB35-9ED536543D50}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -95,6 +104,8 @@ Global
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7A12FE26-9C58-4630-973D-D4872374DBAF}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -109,6 +120,8 @@ Global
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DF877E5E-8D04-4532-BA01-CEFD8636D4DA}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -123,20 +136,8 @@ Global
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC83D80E-9F3B-4DE9-B16A-CA216543B7EC}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.CMS-OSAI|Any CPU.Build.0 = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.CMS-SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.CMS-SIEMENS|Any CPU.Build.0 = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.MySql|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.MySql|Any CPU.Build.0 = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8D08DBE-B511-4DE0-B5A9-563EBFC60C4F}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -151,6 +152,22 @@ Global
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AFCCD6A-3758-44C8-96ED-84E809FCA8A1}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-FANUC|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-FANUC|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-OSAI|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-OSAI|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-SIEMENS|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.CMS-SIEMENS|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.MySql|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.MySql|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.SCM-ESA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{884C07F1-7E6E-4A3D-BF1E-FECF36348268}.SCM-ESA|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using MTC;
|
||||
using NLog;
|
||||
using OPC_UA_REDIS;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
|
||||
namespace SCMA.AdapterCom
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gateway di comunicazione secondo diversi standard, partendo da oggetti BASE MTC
|
||||
/// </summary>
|
||||
@@ -12,6 +16,14 @@ namespace SCMA.AdapterCom
|
||||
|
||||
#region oggetti base
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary degli errori item ricorrenti
|
||||
/// </summary>
|
||||
protected Dictionary<string, int> itemErrors;
|
||||
/// <summary>
|
||||
/// wrapper di log
|
||||
/// </summary>
|
||||
public static Logger lg;
|
||||
/// <summary>
|
||||
/// Protocollo attivo per la comunicazione dell'adapter
|
||||
/// </summary>
|
||||
@@ -26,6 +38,18 @@ namespace SCMA.AdapterCom
|
||||
/// </summary>
|
||||
public allarme[] elencoAllarmi;
|
||||
/// <summary>
|
||||
/// DataModel di riferimento
|
||||
/// </summary>
|
||||
public string DataModel;
|
||||
/// <summary>
|
||||
/// Dizionario conversione nome variabili con replace "like" (per gestione REDIS "_" --> ":")
|
||||
/// </summary>
|
||||
public Dictionary<string, replDict> nameRepRoles = new Dictionary<string, replDict>();
|
||||
/// <summary>
|
||||
/// Dizionario conversione nome variabiliin memoria REDIS
|
||||
/// </summary>
|
||||
public Dictionary<string, string> memCopyList = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Porta comunicazione standard oggetto
|
||||
/// </summary>
|
||||
public int port;
|
||||
@@ -53,6 +77,14 @@ namespace SCMA.AdapterCom
|
||||
/// Elenco di TUTTI i NODI CONDITIONS gestiti dal gateway (allarme/condizione)...
|
||||
/// </summary>
|
||||
public Dictionary<string, itemNode> conditionNodes = new Dictionary<string, itemNode>();
|
||||
/// <summary>
|
||||
/// Elenco ultimi allarmi riportati...
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> lastAlarmList;
|
||||
/// <summary>
|
||||
/// Bool di allarmi presenti
|
||||
/// </summary>
|
||||
public bool alarmPresent = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -63,9 +95,12 @@ namespace SCMA.AdapterCom
|
||||
/// </summary>
|
||||
public Gateway()
|
||||
{
|
||||
lg = LogManager.GetCurrentClassLogger();
|
||||
itemErrors = new Dictionary<string, int>();
|
||||
port = 0;
|
||||
connConfig = "";
|
||||
protocollo = gwProtocol.LOGFILE;
|
||||
lastAlarmList = new Dictionary<string, string>();
|
||||
}
|
||||
/// <summary>
|
||||
/// Inizia la raccolta dati per confronto modifica da precedente...
|
||||
@@ -92,52 +127,6 @@ namespace SCMA.AdapterCom
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
// Separate out the data items into those that are on one line and those
|
||||
// need separate lines.
|
||||
List<SimpleDataItem> together = new List<SimpleDataItem>();
|
||||
List<SimpleDataItem> separate = new List<SimpleDataItem>();
|
||||
foreach (object di in trackItems)
|
||||
{
|
||||
List<SimpleDataItem> list = di.ItemList();
|
||||
if (di.NewLine)
|
||||
separate.AddRange(list);
|
||||
else
|
||||
together.AddRange(list);
|
||||
}
|
||||
|
||||
// Compone all the same line data items onto one line.
|
||||
string line;
|
||||
if (timestamp == null)
|
||||
{
|
||||
DateTime now = DateTime.UtcNow;
|
||||
timestamp = now.ToString("yyyy-MM-dd\\THH:mm:ss.fffffffK");
|
||||
}
|
||||
if (together.Count > 0)
|
||||
{
|
||||
line = timestamp;
|
||||
foreach (SimpleDataItem di in together)
|
||||
line += "|" + di.ToString();
|
||||
line += "\n";
|
||||
|
||||
SendToAll(line);
|
||||
}
|
||||
|
||||
// Now write out all the separate lines
|
||||
if (separate.Count > 0)
|
||||
{
|
||||
foreach (SimpleDataItem di in separate)
|
||||
{
|
||||
line = timestamp;
|
||||
line += "|" + di.ToString() + "\n";
|
||||
SendToAll(line);
|
||||
}
|
||||
}
|
||||
|
||||
// Flush the output
|
||||
FlushAll();
|
||||
#endif
|
||||
|
||||
// Cleanup
|
||||
foreach (object di in itemNodes)
|
||||
{
|
||||
@@ -147,7 +136,7 @@ namespace SCMA.AdapterCom
|
||||
myBegun = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Imposta TUTTI i data items unavailable
|
||||
/// Imposta TUTTI i data items null/unavailable
|
||||
/// </summary>
|
||||
public virtual void setAllUnavailable()
|
||||
{
|
||||
@@ -162,40 +151,49 @@ namespace SCMA.AdapterCom
|
||||
/// </summary>
|
||||
public virtual void start()
|
||||
{
|
||||
#if false
|
||||
if (!mRunning)
|
||||
{
|
||||
mListener = new TcpListener(IPAddress.Any, mPort);
|
||||
mListener.Start();
|
||||
mListenThread = new Thread(new ThreadStart(ListenForClients));
|
||||
mListenThread.Start();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// FERMA processo lettura CNC e invio dati a client
|
||||
/// </summary>
|
||||
public virtual void stop()
|
||||
{
|
||||
#if false
|
||||
if (mRunning)
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione controllo stato catena applicativi e messaggi da piattaforma
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Effettua chiamata URL e restituisce risultato
|
||||
/// </summary>
|
||||
/// <param name="URL"></param>
|
||||
/// <returns></returns>
|
||||
public string callUrl(string URL)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
mRunning = false;
|
||||
mListener.Stop();
|
||||
foreach (Object obj in mClients)
|
||||
{
|
||||
Stream client = (Stream)obj;
|
||||
client.Close();
|
||||
}
|
||||
mClients.Clear();
|
||||
|
||||
// Wait 5 seconds for the thread to exit.
|
||||
mListenThread.Join(2000);
|
||||
|
||||
// Wait for all client threads to exit.
|
||||
mActiveClients.Wait(2000);
|
||||
}
|
||||
#endif
|
||||
var client = new WebClient();
|
||||
client.Headers.Add("user-agent", utils.CRS("appName"));
|
||||
answ = client.DownloadString(URL);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, "Errore in chiamata URL {0}{1}{2}", URL, Environment.NewLine, exc);
|
||||
}
|
||||
// restituisco valore!
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica lo stato di un servizio indicato per via numerica (differente x MTC / OPC-UA-REDIS)
|
||||
/// </summary>
|
||||
/// <param name="numServ"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool checkStatus(int numServ)
|
||||
{
|
||||
bool answ = false;
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -211,12 +209,7 @@ namespace SCMA.AdapterCom
|
||||
{
|
||||
if (!itemNodes.ContainsKey(key))
|
||||
{
|
||||
itemNode currItem = new itemNode(tipo, availStatus.UNAVAILABLE.ToString());
|
||||
#if false
|
||||
// di base salvo tipo/valore come KVP nell'item...
|
||||
Dictionary<itemType, object> currObj = new Dictionary<itemType, object>();
|
||||
currObj.Add(tipo, "UNAVAILABLE");
|
||||
#endif
|
||||
itemNode currItem = new itemNode(tipo, availStatus.UNAVAILABLE.ToString().ToLower());
|
||||
itemNodes.Add(key, currItem);
|
||||
}
|
||||
}
|
||||
@@ -228,7 +221,11 @@ namespace SCMA.AdapterCom
|
||||
public virtual void addItemNodeAndSet(string key, itemType tipo, object value)
|
||||
{
|
||||
addItemNodeByType(key, tipo);
|
||||
updateItemNodeValue(key, value);
|
||||
// SOLO se richiesto FULL RESET...
|
||||
if (baseUtils.CRB("fullReset"))
|
||||
{
|
||||
updateItemNodeValue(key, value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunge un generico item all'elenco di quelli tracciati (NON STRONGLY TYPED!!! occhio!!!)
|
||||
@@ -275,7 +272,45 @@ namespace SCMA.AdapterCom
|
||||
/// <param name="key"></param>
|
||||
public virtual object getItemNode(string key)
|
||||
{
|
||||
return itemNodes[key].cObject;
|
||||
object answ = null;
|
||||
// controllos e ci sia chiave...
|
||||
if (itemNodes.ContainsKey(key))
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = itemNodes[key].cObject;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error($"Eccezione in getItemNode per la chiave {key}:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "";
|
||||
try
|
||||
{
|
||||
// salvo in memoria nelle chiavi non trovate
|
||||
if (itemErrors.ContainsKey(key))
|
||||
{
|
||||
itemErrors[key]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemErrors.Add(key, 1);
|
||||
}
|
||||
// ...se > 100 volte --> log...
|
||||
if (itemErrors[key] > 100)
|
||||
{
|
||||
lg.Error($"Errore: è stato richiesto 100 volte in getItemNode la chiave {key} NON ESISTENTE");
|
||||
itemErrors[key] = 1;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// AGGIORNA un generico item all'elenco di quelli tracciati (NON STRONGLY TYPED!!! occhio!!!)
|
||||
@@ -337,27 +372,142 @@ namespace SCMA.AdapterCom
|
||||
/// </summary>
|
||||
public virtual void processAlarm()
|
||||
{
|
||||
if (AlarmFlags != null)
|
||||
// continuo controllo
|
||||
if (AlarmFlags != null && AlarmFlags.Length > 0)
|
||||
{
|
||||
// variabili helper
|
||||
StFlag32 AlarmBlock = 0;
|
||||
allarme currAllarm;
|
||||
Dictionary<string, string> grpAlarmList = new Dictionary<string, string>();
|
||||
string alarmChannel = "";
|
||||
// controllo TUTTI i bit della variabile COMPLETA degli status allarmi: se ce ne sono di alzati DEVO processare...
|
||||
for (int i = 0; i < AlarmFlags.Length / 4; i++)
|
||||
{
|
||||
// leggo 32bit alla volta...
|
||||
AlarmBlock = (StFlag32)BitConverter.ToUInt32(AlarmFlags, i * 4);
|
||||
for (int j = 0; j < 32; j++)
|
||||
if (AlarmBlock != StFlag32.NONE)
|
||||
{
|
||||
// converto! e aggiungo allarmi sollevati al corretto controller allarmi...
|
||||
if (AlarmBlock.HasFlag((StFlag32)Math.Pow(2, j)))
|
||||
alarmPresent = true;
|
||||
for (int j = 0; j < 32; j++)
|
||||
{
|
||||
// recupero allarme da oggetto in memoria...
|
||||
currAllarm = elencoAllarmi[i * 32 + j];
|
||||
addAlarm(currAllarm);
|
||||
// converto! e aggiungo allarmi sollevati al corretto controller allarmi...
|
||||
if (AlarmBlock.HasFlag((StFlag32)Math.Pow(2, j)))
|
||||
{
|
||||
// recupero allarme da oggetto in memoria...
|
||||
currAllarm = elencoAllarmi[i * 32 + j];
|
||||
addAlarm(currAllarm);
|
||||
// ora in base al TIPO di gateway determino il canale allarme...
|
||||
alarmChannel = currAllarm.gruppo;
|
||||
// se sono in SOURS
|
||||
if (protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
// sostituisco gruppo con nome esatto...
|
||||
switch (alarmChannel.ToUpper())
|
||||
{
|
||||
case "CNC":
|
||||
alarmChannel = nCncConditions;
|
||||
break;
|
||||
case "HMI":
|
||||
alarmChannel = nHmiConditions;
|
||||
break;
|
||||
case "PLC":
|
||||
alarmChannel = nPlcConditions;
|
||||
break;
|
||||
}
|
||||
// sostituisco livello allarme
|
||||
|
||||
// aggiorno stringa...
|
||||
if (!grpAlarmList.ContainsKey(alarmChannel))
|
||||
{
|
||||
grpAlarmList.Add(alarmChannel, "");
|
||||
}
|
||||
grpAlarmList[alarmChannel] += string.Format("{0}|{1},", currAllarm.codNum, AdapterRed.condLevel(currAllarm.livello));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// se in modalità SOUR riporto variabile alarmState
|
||||
if (protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
foreach (var item in grpAlarmList)
|
||||
{
|
||||
// tolgo ultima stringa
|
||||
string elenco = item.Value.Substring(0, item.Value.Length - 1);
|
||||
// salvo...
|
||||
updateItemNodeValue(item.Key, elenco);
|
||||
}
|
||||
// se ho ALMENO un allarme attivo, altrimenti procedo che resetta da solo
|
||||
if (grpAlarmList.Count > 0)
|
||||
{
|
||||
// salvo i LAST alarm...
|
||||
lastAlarmList = grpAlarmList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!alarmPresent)
|
||||
{
|
||||
// devo resettare gli allarmi notificati...
|
||||
foreach (var item in lastAlarmList)
|
||||
{
|
||||
// tolgo ultima stringa
|
||||
string elenco = "0|000";
|
||||
// salvo...
|
||||
updateItemNodeValue(item.Key, elenco);
|
||||
}
|
||||
// resetto
|
||||
lastAlarmList = new Dictionary<string, string>();
|
||||
}
|
||||
// se in modalità SOUR riporto variabile alarmState
|
||||
if (protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
updateItemNodeValue("Alarm", alarmPresent);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Nome del channel allarmi CNC
|
||||
/// </summary>
|
||||
public string nCncConditions
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "CNC";
|
||||
if (protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
answ = "Cnc:Condition";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Nome del channel allarmi HMI
|
||||
/// </summary>
|
||||
public string nHmiConditions
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "HMI";
|
||||
if (protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
answ = "Hmi:Condition";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Nome del channel allarmi PLC
|
||||
/// </summary>
|
||||
public string nPlcConditions
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "PLC";
|
||||
if (protocollo == gwProtocol.SOURS)
|
||||
{
|
||||
answ = "Plc:Condition";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -366,8 +516,8 @@ namespace SCMA.AdapterCom
|
||||
public virtual void addAlarmNodes()
|
||||
{
|
||||
// minimo sempre PLC/CNC
|
||||
addConditionNode("CNC", "CNC");
|
||||
addConditionNode("PLC", "PLC");
|
||||
addConditionNode(nCncConditions, "CNC");
|
||||
addConditionNode(nPlcConditions, "PLC");
|
||||
}
|
||||
/// <summary>
|
||||
/// INIT allarmi a normal
|
||||
@@ -388,31 +538,6 @@ namespace SCMA.AdapterCom
|
||||
/// <param name="currAllarm">Allarme da riportare al nodo</param>
|
||||
public virtual void addAlarm(allarme currAllarm)
|
||||
{
|
||||
#if false
|
||||
// in base al tipo di allarme decodifico condizione...
|
||||
Condition.Level livello = Condition.Level.NORMAL;
|
||||
switch (currAllarm.livello)
|
||||
{
|
||||
case "WARNING":
|
||||
livello = Condition.Level.WARNING;
|
||||
break;
|
||||
case "FAULT":
|
||||
default:
|
||||
livello = Condition.Level.FAULT;
|
||||
break;
|
||||
}
|
||||
// in base al gruppo decido dove assegnare come CONDITION...
|
||||
switch (currAllarm.gruppo)
|
||||
{
|
||||
case "PLC":
|
||||
mAlarmPLC.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
break;
|
||||
case "CNC":
|
||||
default:
|
||||
mAlarmCNC.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunta SINGOLO allarme su SPECIFICO nodo
|
||||
@@ -421,31 +546,6 @@ namespace SCMA.AdapterCom
|
||||
/// <param name="currAllarm">Allarme da riportare al nodo</param>
|
||||
public virtual void addAlarm(itemNode alarmNode, allarme currAllarm)
|
||||
{
|
||||
#if false
|
||||
// in base al tipo di allarme decodifico condizione...
|
||||
Condition.Level livello = Condition.Level.NORMAL;
|
||||
switch (currAllarm.livello)
|
||||
{
|
||||
case "WARNING":
|
||||
livello = Condition.Level.WARNING;
|
||||
break;
|
||||
case "FAULT":
|
||||
default:
|
||||
livello = Condition.Level.FAULT;
|
||||
break;
|
||||
}
|
||||
// in base al gruppo decido dove assegnare come CONDITION...
|
||||
switch (currAllarm.gruppo)
|
||||
{
|
||||
case "PLC":
|
||||
mAlarmPLC.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
break;
|
||||
case "CNC":
|
||||
default:
|
||||
mAlarmCNC.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// RESTITUISCE un nodo CONDITION da KEY
|
||||
@@ -459,35 +559,6 @@ namespace SCMA.AdapterCom
|
||||
#endregion
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe item node (tipo/obj)
|
||||
/// </summary>
|
||||
public class itemNode
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo oggetto (per cast)
|
||||
/// </summary>
|
||||
public itemType cType;
|
||||
/// <summary>
|
||||
/// Object specifico
|
||||
/// </summary>
|
||||
public object cObject;
|
||||
/// <summary>
|
||||
/// costruttore
|
||||
/// </summary>
|
||||
public itemNode()
|
||||
{ }
|
||||
/// <summary>
|
||||
/// costruttore
|
||||
/// </summary>
|
||||
/// <param name="_tipo"></param>
|
||||
/// <param name="_obj"></param>
|
||||
public itemNode(itemType _tipo, object _obj)
|
||||
{
|
||||
cType = _tipo;
|
||||
cObject = _obj;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia protocolli di comunicazione ammessi
|
||||
@@ -507,96 +578,4 @@ namespace SCMA.AdapterCom
|
||||
/// </summary>
|
||||
SOURS
|
||||
}
|
||||
/// <summary>
|
||||
/// Tipologia di ITEM
|
||||
/// </summary>
|
||||
public enum itemType
|
||||
{
|
||||
/// <summary>
|
||||
/// CONDIZION = ALLARME
|
||||
/// </summary>
|
||||
Condition,
|
||||
/// <summary>
|
||||
/// Evento = point in time data
|
||||
/// </summary>
|
||||
Event,
|
||||
/// <summary>
|
||||
/// Messaggio generico
|
||||
/// </summary>
|
||||
Message,
|
||||
/// <summary>
|
||||
/// Campionamento continuo
|
||||
/// </summary>
|
||||
Sample
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO ATTIVO (es attuatori, sistemi...)
|
||||
/// </summary>
|
||||
public enum actStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato inattivo
|
||||
/// </summary>
|
||||
INACTIVE = 0,
|
||||
/// <summary>
|
||||
/// Stato Attivo
|
||||
/// </summary>
|
||||
ACTIVE
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO OnOff
|
||||
/// </summary>
|
||||
public enum onOffStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato OFF
|
||||
/// </summary>
|
||||
OFF = 0,
|
||||
/// <summary>
|
||||
/// Stato ON
|
||||
/// </summary>
|
||||
ON
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO per EMERGENZA
|
||||
/// </summary>
|
||||
public enum emStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato ARMATO
|
||||
/// </summary>
|
||||
ARMED = 0,
|
||||
/// <summary>
|
||||
/// Stato EMERGENZA PREMUTA
|
||||
/// </summary>
|
||||
TRIGGERED
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO per AVAIL
|
||||
/// </summary>
|
||||
public enum availStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato DISPONIBILE
|
||||
/// </summary>
|
||||
AVAILABLE = 0,
|
||||
/// <summary>
|
||||
/// Stato NON disponibile
|
||||
/// </summary>
|
||||
UNAVAILABLE
|
||||
}
|
||||
/// <summary>
|
||||
/// Varibili STATO per AVAIL
|
||||
/// </summary>
|
||||
public enum pathType
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato LAVORO
|
||||
/// </summary>
|
||||
LAVORO = 0,
|
||||
/// <summary>
|
||||
/// Stato ASSERV
|
||||
/// </summary>
|
||||
ASSERV
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using MTC;
|
||||
using MTC;
|
||||
using MTC;
|
||||
using MTConnect;
|
||||
using System;
|
||||
|
||||
namespace SCMA.AdapterCom
|
||||
{
|
||||
@@ -65,6 +60,83 @@ namespace SCMA.AdapterCom
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione controllo stato catena applicativi e messaggi da piattaforma
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora ultima risposta AGENT x testing PROBE
|
||||
/// </summary>
|
||||
protected DateTime lastCurrProbe;
|
||||
/// <summary>
|
||||
/// Valore testuale ultima risposta agent (currentProbe)
|
||||
/// </summary>
|
||||
protected string currProbe;
|
||||
/// <summary>
|
||||
/// Valore testuale ultima risposta agent (StatusCurrent)
|
||||
/// </summary>
|
||||
protected string currStatus;
|
||||
|
||||
/// <summary>
|
||||
/// Verifica lo stato di un servizio indicato per via numerica:
|
||||
/// 1: verifica che l'AGENT sia attivo (risponde a porta 5000 con qualcosa)
|
||||
/// 2: verifica risposta AGENT: deve essere XML e deve contenere stringa "MTConnectDevices"
|
||||
/// 3: verifica che lo status (localhost:5000/current) contenga qualcosa
|
||||
/// </summary>
|
||||
/// <param name="numServ"></param>
|
||||
/// <returns></returns>
|
||||
public override bool checkStatus(int numServ)
|
||||
{
|
||||
// in primis verifico se ho una risposta recente (< 2 sec) dall'agent...
|
||||
if (lastCurrProbe == null || lastCurrProbe.AddSeconds(2) < DateTime.Now)
|
||||
{
|
||||
// altrimenti carico la risposta
|
||||
refreshAgentResp();
|
||||
}
|
||||
// ora so x certo che ho caricato dati recenti...
|
||||
bool answ = false;
|
||||
switch (numServ)
|
||||
{
|
||||
case 1:
|
||||
answ = (currProbe != "");
|
||||
break;
|
||||
case 2:
|
||||
answ = (currProbe.IndexOf("MTConnectDevices") >= 0 && currProbe.IndexOf("xml") >= 0);
|
||||
break;
|
||||
case 3:
|
||||
answ = (currStatus != "");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua una chiamata all'agent e salva valore e data chiamata...
|
||||
/// </summary>
|
||||
private void refreshAgentResp()
|
||||
{
|
||||
// controllo catena AGENT: cerco di scaricare il PROBE alla porta 5000
|
||||
try
|
||||
{
|
||||
currProbe = callUrl("http://localhost:5000");
|
||||
}
|
||||
catch
|
||||
{
|
||||
currProbe = "";
|
||||
}
|
||||
// controllo catena AGENT x CURRENT STATUS: cerco di scaricare /current alla porta 5000
|
||||
try
|
||||
{
|
||||
currStatus = callUrl("http://localhost:5000/current");
|
||||
}
|
||||
catch
|
||||
{
|
||||
currStatus = "";
|
||||
}
|
||||
lastCurrProbe = DateTime.Now;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione nodi (dataItems, conditions)
|
||||
|
||||
public override void addItemNodeByType(string key, itemType tipo)
|
||||
@@ -112,6 +184,7 @@ namespace SCMA.AdapterCom
|
||||
{
|
||||
base.addItemNode(key, value);
|
||||
// aggiungo ad adapter
|
||||
mAdapter.RemoveDataItem((DataItem)value);
|
||||
mAdapter.AddDataItem((DataItem)value);
|
||||
}
|
||||
}
|
||||
@@ -162,7 +235,12 @@ namespace SCMA.AdapterCom
|
||||
}
|
||||
public override void updateItemNodeValue(string key, object value)
|
||||
{
|
||||
((DataItem)getItemNode(key)).Value = value;
|
||||
// aggiorno SE cambiato...
|
||||
DataItem currDataItem = (DataItem)getItemNode(key);
|
||||
if (!currDataItem.Value.Equals(value))
|
||||
{
|
||||
((DataItem)getItemNode(key)).Value = value;
|
||||
}
|
||||
}
|
||||
public override void updateItemNodeCodeValue(string key, string code, object value)
|
||||
{
|
||||
@@ -178,7 +256,9 @@ namespace SCMA.AdapterCom
|
||||
public override void addConditionNode(string key, object value)
|
||||
{
|
||||
base.addConditionNode(key, value);
|
||||
// aggiungo ad adapter
|
||||
|
||||
// aggiungo ad adapter
|
||||
mAdapter.RemoveDataItem((Condition)value);
|
||||
mAdapter.AddDataItem((Condition)value);
|
||||
}
|
||||
public override void removeAllConditionNodes()
|
||||
@@ -203,31 +283,20 @@ namespace SCMA.AdapterCom
|
||||
#region gestione allarmi
|
||||
|
||||
/// <summary>
|
||||
/// Speciofica implementazione x formattazione ALLARMI
|
||||
/// Specifica implementazione x formattazione ALLARMI
|
||||
/// </summary>
|
||||
/// <param name="currAllarm"></param>
|
||||
public override void addAlarm(allarme currAllarm)
|
||||
{
|
||||
// in base al tipo di allarme decodifico condizione...
|
||||
Condition.Level livello = Condition.Level.NORMAL;
|
||||
switch (currAllarm.livello)
|
||||
{
|
||||
case "WARNING":
|
||||
livello = Condition.Level.WARNING;
|
||||
break;
|
||||
case "FAULT":
|
||||
default:
|
||||
livello = Condition.Level.FAULT;
|
||||
break;
|
||||
}
|
||||
// implemento chiamata specifica...
|
||||
if (conditionNodes.ContainsKey(currAllarm.gruppo))
|
||||
{
|
||||
Condition mAlarm = (Condition)conditionNodes[currAllarm.gruppo].cObject;
|
||||
mAlarm.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
itemNode nodo = conditionNodes[currAllarm.gruppo];
|
||||
addAlarm(nodo, currAllarm);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Speciofica implementazione x formattazione ALLARMI
|
||||
/// Specifica implementazione x formattazione ALLARMI
|
||||
/// </summary>
|
||||
/// <param name="currAllarm"></param>
|
||||
/// <param name="alarmNode">Generico nodo di tipo condition</param>
|
||||
@@ -255,10 +324,10 @@ namespace SCMA.AdapterCom
|
||||
{
|
||||
// registro
|
||||
Condition newCondNode;
|
||||
newCondNode = new Condition("CNC");
|
||||
addConditionNode("CNC", newCondNode);
|
||||
newCondNode = new Condition("PLC");
|
||||
addConditionNode("PLC", newCondNode);
|
||||
newCondNode = new Condition(nCncConditions);
|
||||
addConditionNode(nCncConditions, newCondNode);
|
||||
newCondNode = new Condition(nPlcConditions);
|
||||
addConditionNode(nPlcConditions, newCondNode);
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper inizializzazione allarmi
|
||||
|
||||
@@ -1,16 +1,320 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
using MTC;
|
||||
using OPC_UA_REDIS;
|
||||
|
||||
namespace SCMA.AdapterCom
|
||||
{
|
||||
public class GatewaySOURS : Gateway
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// adapter globale REDIS
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
public AdapterRed mAdapter = new AdapterRed();
|
||||
|
||||
#region gestione globale oggetto
|
||||
|
||||
/// <summary>
|
||||
/// Gateway SOUR
|
||||
/// </summary>
|
||||
public GatewaySOURS()
|
||||
{
|
||||
protocollo = gwProtocol.SOURS;
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo Begin
|
||||
/// </summary>
|
||||
public override void beginDataCollect()
|
||||
{
|
||||
mAdapter.Begin();
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo SendChanged
|
||||
/// </summary>
|
||||
public override void sendChanged()
|
||||
{
|
||||
mAdapter.SendChanged();
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo imposta tutto a UNAVAILABLE
|
||||
/// </summary>
|
||||
public override void setAllUnavailable()
|
||||
{
|
||||
mAdapter.Unavailable();
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo START
|
||||
/// </summary>
|
||||
public override void start()
|
||||
{
|
||||
// passo le tabelle di remap/replace
|
||||
mAdapter.ServerPort = 6379; // !!! port hard coded
|
||||
mAdapter.ServerAddr = "127.0.0.1"; // !!! IP hard coded
|
||||
mAdapter.nameRepRoles = nameRepRoles;
|
||||
mAdapter.DataModel = DataModel;
|
||||
// aggiunge il set di allarmi (che è NATIVAMENTE già su 3 lingue... )
|
||||
mAdapter.elencoAllarmi = elencoAllarmi;
|
||||
mAdapter.itemNodes = itemNodes;
|
||||
mAdapter.conditionNodes = conditionNodes;
|
||||
|
||||
// avvio oggetto
|
||||
mAdapter.Start();
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo STOP
|
||||
/// </summary>
|
||||
public override void stop()
|
||||
{
|
||||
mAdapter.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region gestione controllo stato catena applicativi e messaggi da piattaforma
|
||||
|
||||
/// <summary>
|
||||
/// Verifica lo stato di un servizio indicato per via numerica:
|
||||
/// 1: verifica che servizio REDIS sia OK
|
||||
/// 2: verifica OPC-UA-SERVER sia ALIVE
|
||||
/// 3: verifica gateway sia OK (attivo)
|
||||
/// 4: verifica gateway abbia accesso internet
|
||||
/// </summary>
|
||||
/// <param name="numServ"></param>
|
||||
/// <returns></returns>
|
||||
public override bool checkStatus(int numServ)
|
||||
{
|
||||
bool answ = false;
|
||||
switch (numServ)
|
||||
{
|
||||
case 1:
|
||||
answ = mAdapter.redServAlive;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione nodi (dataItems, conditions)
|
||||
|
||||
|
||||
public override void addItemNodeByType(string key, itemType tipo)
|
||||
{
|
||||
if (!itemNodes.ContainsKey(key))
|
||||
{
|
||||
// in base al TIPO genero l'oggetto corretto...
|
||||
DataItemRed currObj;
|
||||
switch (tipo)
|
||||
{
|
||||
case itemType.Condition:
|
||||
currObj = new DataItemRed(key);
|
||||
//currObj = new ConditionRed(key);
|
||||
break;
|
||||
default:
|
||||
currObj = new DataItemRed(key);
|
||||
break;
|
||||
}
|
||||
mAdapter.AddDataItem(currObj);
|
||||
if (tipo == itemType.Condition)
|
||||
{
|
||||
addConditionNode(key, currObj);
|
||||
addItemNode(key, currObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
addItemNode(key, currObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Effettua chiamata VERA su adapter MTConnect...
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public override void addItemNode(string key, object value)
|
||||
{
|
||||
if (!itemNodes.ContainsKey(key))
|
||||
{
|
||||
base.addItemNode(key, value);
|
||||
// aggiungo ad adapter
|
||||
mAdapter.AddDataItem((DataItemRed)value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua chiamata VERA su adapter MTConnect...
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public override void addItemNode(object value)
|
||||
{
|
||||
DataItemRed currObj = (DataItemRed)value;
|
||||
string key = currObj.Name;
|
||||
if (!itemNodes.ContainsKey(key))
|
||||
{
|
||||
base.addItemNode(key, value);
|
||||
// aggiungo ad adapter
|
||||
mAdapter.AddDataItem((DataItemRed)value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo rimozione di TUTTI gli ITEMS
|
||||
/// </summary>
|
||||
public override void removeAllItemNodes()
|
||||
{
|
||||
foreach (var item in itemNodes)
|
||||
{
|
||||
// rimuovo da SCMA
|
||||
mAdapter.RemoveDataItem((DataItemRed)item.Value.cObject);
|
||||
}
|
||||
base.removeAllItemNodes();
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper metodo rimozione ITEMS
|
||||
/// </summary>
|
||||
/// <param name="anItem"></param>
|
||||
public override void removeItemNode(string key)
|
||||
{
|
||||
// rimuovo da MTC
|
||||
mAdapter.RemoveDataItem((DataItemRed)itemNodes[key].cObject);
|
||||
// rimuovo da vett interno
|
||||
base.removeItemNode(key);
|
||||
}
|
||||
public override void updateItemNodeValue(string key, object value)
|
||||
{
|
||||
((DataItemRed)getItemNode(key)).Value = value;
|
||||
}
|
||||
public override void updateItemNodeCodeValue(string key, string code, object value)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// wrapper aggiunta condizione
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public override void addConditionNode(string key, object value)
|
||||
{
|
||||
if (!conditionNodes.ContainsKey(key))
|
||||
{
|
||||
base.addConditionNode(key, value);
|
||||
// aggiungo ad adapter
|
||||
mAdapter.AddDataItem((DataItemRed)value);
|
||||
//mAdapter.AddDataItem((ConditionRed)value);
|
||||
}
|
||||
// aggiungo itemnode (se non c'è)
|
||||
addItemNode(key, value);
|
||||
}
|
||||
public override void removeAllConditionNodes()
|
||||
{
|
||||
foreach (var item in conditionNodes)
|
||||
{
|
||||
// rimuovo da MTC
|
||||
mAdapter.RemoveDataItem((DataItemRed)item.Value.cObject);
|
||||
//mAdapter.RemoveDataItem((ConditionRed)item.Value.cObject);
|
||||
}
|
||||
base.removeAllConditionNodes();
|
||||
}
|
||||
public override void removeConditionNode(string key)
|
||||
{
|
||||
// rimuovo da oggetti specifici
|
||||
mAdapter.RemoveDataItem((DataItemRed)conditionNodes[key].cObject);
|
||||
//mAdapter.RemoveDataItem((ConditionRed)conditionNodes[key].cObject);
|
||||
// rimuovo da vett interno
|
||||
base.removeConditionNode(key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region gestione allarmi
|
||||
|
||||
/// <summary>
|
||||
/// Speciofica implementazione x formattazione ALLARMI
|
||||
/// </summary>
|
||||
/// <param name="currAllarm"></param>
|
||||
public override void addAlarm(allarme currAllarm)
|
||||
{
|
||||
//// in base al tipo di allarme decodifico condizione...
|
||||
//ConditionRed.Level livello = ConditionRed.Level.NORMAL;
|
||||
//switch (currAllarm.livello)
|
||||
//{
|
||||
// case "WARNING":
|
||||
// livello = ConditionRed.Level.WARNING;
|
||||
// break;
|
||||
// case "FAULT":
|
||||
// default:
|
||||
// livello = ConditionRed.Level.FAULT;
|
||||
// break;
|
||||
//}
|
||||
//if (conditionNodes.ContainsKey(currAllarm.gruppo))
|
||||
//{
|
||||
// ConditionRed mAlarm = (ConditionRed)conditionNodes[currAllarm.gruppo].cObject;
|
||||
// mAlarm.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// Specifica implementazione x formattazione ALLARMI
|
||||
/// </summary>
|
||||
/// <param name="currAllarm"></param>
|
||||
/// <param name="alarmNode">Generico nodo di tipo condition</param>
|
||||
public override void addAlarm(itemNode alarmNode, allarme currAllarm)
|
||||
{
|
||||
//// in base al tipo di allarme decodifico condizione...
|
||||
//ConditionRed.Level livello = ConditionRed.Level.NORMAL;
|
||||
//switch (currAllarm.livello)
|
||||
//{
|
||||
// case "WARNING":
|
||||
// livello = ConditionRed.Level.WARNING;
|
||||
// break;
|
||||
// case "FAULT":
|
||||
// default:
|
||||
// livello = ConditionRed.Level.FAULT;
|
||||
// break;
|
||||
//}
|
||||
//ConditionRed mAlarm = (ConditionRed)alarmNode.cObject;
|
||||
//mAlarm.Add(livello, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper setup obj allarmi
|
||||
/// </summary>
|
||||
public override void addAlarmNodes()
|
||||
{
|
||||
// registro
|
||||
DataItemRed newCondNode;
|
||||
newCondNode = new DataItemRed(nCncConditions);
|
||||
addConditionNode(nCncConditions, newCondNode);
|
||||
newCondNode = new DataItemRed(nPlcConditions);
|
||||
addConditionNode(nPlcConditions, newCondNode);
|
||||
newCondNode = new DataItemRed(nHmiConditions);
|
||||
addConditionNode(nHmiConditions, newCondNode);
|
||||
}
|
||||
/// <summary>
|
||||
/// Wrapper inizializzazione allarmi
|
||||
/// </summary>
|
||||
public override void initAlarms()
|
||||
{
|
||||
//// trasformo i nodi in elenchi conditions e li aggiungo...
|
||||
//foreach (var item in conditionNodes)
|
||||
//{
|
||||
// ((ConditionRed)item.Value.cObject).Normal();
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// inizializazione allarme a normal
|
||||
/// </summary>
|
||||
/// <param name="alarmNode"></param>
|
||||
public override void initAlarm(itemNode alarmNode)
|
||||
{
|
||||
//ConditionRed mAlarm = (ConditionRed)alarmNode.cObject;
|
||||
//mAlarm.Normal();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace SCMA
|
||||
element[] _VacuumAct;
|
||||
element[] _Lubro;
|
||||
element[] _SlittaMag;
|
||||
element[] _SlittaTas;
|
||||
element[] _ProtMag;
|
||||
element[] _Cooler;
|
||||
element[] _Press;
|
||||
@@ -117,6 +118,23 @@ namespace SCMA
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public int nSlittaTas
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SlittaTas != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = Convert.ToInt32(SlittaTas.Length);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
public int nProtMag
|
||||
{
|
||||
get
|
||||
@@ -366,6 +384,11 @@ namespace SCMA
|
||||
get { return _SlittaMag; }
|
||||
set { _SlittaMag = value; }
|
||||
}
|
||||
public element[] SlittaTas
|
||||
{
|
||||
get { return _SlittaTas; }
|
||||
set { _SlittaTas = value; }
|
||||
}
|
||||
public element[] ProtMag
|
||||
{
|
||||
get { return _ProtMag; }
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
using MTC;
|
||||
using MTConnect;
|
||||
using SCMA.AdapterCom;
|
||||
using System;
|
||||
|
||||
namespace SCMA
|
||||
{
|
||||
public class AdapterDemo : AdapterGeneric
|
||||
{
|
||||
public Condition mTemp;
|
||||
public Condition mFillLevel;
|
||||
|
||||
/// <summary>
|
||||
/// estende l'init della classe base...
|
||||
/// </summary>
|
||||
/// <param name="caller">FORM chaimante</param>
|
||||
/// <param name="adpConf">CONFIGURAZIONE adapter</param>
|
||||
/// <param name="gatewayObj">OGGETTO gestione comunicazione OUT (tipologia e metodi)</param>
|
||||
public AdapterDemo(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
{
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info("Start init Adapter DEMO");
|
||||
}
|
||||
// IMPLICITO: carica da metodo base tutte le specifiche del conf...
|
||||
|
||||
mTemp = new Condition("temp");
|
||||
mFillLevel = new Condition("cool_low", true);
|
||||
// aggiungo specifiche del demo: allarmi gestiti a buttons!!!
|
||||
currGateway.addItemNode("temp", mTemp);
|
||||
currGateway.addItemNode("cool_low", mFillLevel);
|
||||
}
|
||||
|
||||
public override void startAdapter()
|
||||
{
|
||||
base.startAdapter();
|
||||
// aggiungo altre condizioni specifiche...
|
||||
mTemp.Normal();
|
||||
mFillLevel.Normal();
|
||||
}
|
||||
|
||||
public override void getSlowChangingData()
|
||||
{
|
||||
// recupero SEMPRE dati ulteriori: status ON/OFF, clock, ...
|
||||
currGateway.updateItemNodeValue("STATUS", parentForm.datiProd.Status);
|
||||
currGateway.updateItemNodeValue("ACC_TIME", parentForm.datiProd.AccTime);
|
||||
currGateway.updateItemNodeValue("OperatorId", parentForm.datiProd.Operator);
|
||||
currGateway.updateItemNodeValue("POWER", parentForm.datiProd.Power);
|
||||
currGateway.updateItemNodeValue("CLOCK", DateTime.Now.Date.ToFileTimeUtc());
|
||||
}
|
||||
|
||||
public override void getStrobeAndAckStatus()
|
||||
{
|
||||
base.getStrobeAndAckStatus();
|
||||
|
||||
// controllo bool allarmi...
|
||||
if (parentForm.datiProd.EmrStop)
|
||||
{
|
||||
currGateway.updateItemNodeValue("E_STOP", emStatus.TRIGGERED.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
currGateway.updateItemNodeValue("E_STOP", emStatus.ARMED.ToString());
|
||||
}
|
||||
|
||||
// imposto func mode...
|
||||
currGateway.updateItemNodeValue("FUNCT_MODE", parentForm.datiProd.FuncMode);
|
||||
|
||||
// se ho un messaggio...
|
||||
if (parentForm.datiProd.MessageText.Length > 0)
|
||||
{
|
||||
currGateway.updateItemNodeCodeValue("MESSAGE", parentForm.datiProd.MessageCode, parentForm.datiProd.MessageText);
|
||||
}
|
||||
}
|
||||
|
||||
public override void getConfigParam()
|
||||
{
|
||||
base.getConfigParam();
|
||||
}
|
||||
|
||||
|
||||
public override void processStrobe()
|
||||
{
|
||||
// qui forzo la gestione di update dei path & co...
|
||||
getPath();
|
||||
getUnOp();
|
||||
getAxis();
|
||||
}
|
||||
/// <summary>
|
||||
/// non fa nulla perché recupera allarmi in vettore al singolo cambio...
|
||||
/// </summary>
|
||||
/// <param name="Alarm2Refresh"></param>
|
||||
/// <param name="giveAck"></param>
|
||||
public override void refreshAlarmState(StFlag32 Alarm2Refresh, bool giveAck)
|
||||
{
|
||||
base.refreshAlarmState(Alarm2Refresh, giveAck);
|
||||
}
|
||||
|
||||
public override void getPath()
|
||||
{
|
||||
base.getPath();
|
||||
|
||||
PathData PtData = parentForm.CurrPath;
|
||||
if (PtData.PathSel >= 0)
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].feedKey, PtData.PathFeedrate);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].feedOverKey, PtData.PathFeedrateOver);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].rapidOverKey, PtData.PathRapidOver);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].posAct_X_Key, PtData.PathPosAct.x);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].posAct_Y_Key, PtData.PathPosAct.y);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].posAct_Z_Key, PtData.PathPosAct.z);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].posAct_I_Key, PtData.PathPosAct.i);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].posAct_J_Key, PtData.PathPosAct.j);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].posAct_K_Key, PtData.PathPosAct.k);
|
||||
// aggiunta x revisione 2016.05.05
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].pathTypeKey, PtData.PathType);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].partIdKey, PtData.PartId);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].partCountKey, PtData.pzTot);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].runModeKey, PtData.RunMode);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].exeModeKey, PtData.ExeMode);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].currProgKey, PtData.ProgramName);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].currProgRowNumKey, PtData.ProgrRow);
|
||||
currGateway.updateItemNodeValue(vettPath[PtData.PathSel].activeAxesKey, PtData.ActiveAxes);
|
||||
}
|
||||
}
|
||||
|
||||
public override void getUnOp()
|
||||
{
|
||||
base.getUnOp();
|
||||
|
||||
UnOpData uoData = parentForm.CurrUnOp;
|
||||
if (uoData.UnOpSel >= 0)
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].toolIdKey, uoData.UnOpToolId);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].numCUKey, uoData.UnOpNumCU);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].statusKey, uoData.UnOpStatus);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].vitaResKey, uoData.UnOpVitaRes);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].speedKey, uoData.UnOpSpeed);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].loadKey, uoData.UnOpLoad);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].accTimeKey, uoData.UnOpAccTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override void getAxis()
|
||||
{
|
||||
base.getAxis();
|
||||
AxisData AxData = parentForm.CurrAxis;
|
||||
if (AxData.AxisSel >= 0)
|
||||
{
|
||||
// USO asse selezionato + dati visualizzati e di conseguenza aggiorno...
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisMainProc);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisIsMaster);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisMastId);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisType);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisDir);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisLoad);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisPosAct);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisPosTgt);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisFeedAct);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisFeedOver);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisAccel);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisAccTime);
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisBattery);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,868 @@
|
||||
using MTC;
|
||||
using SCMA.AdapterCom;
|
||||
using EsaCncLib;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace SCMA.AdapterPLC.CMS
|
||||
{
|
||||
public class EsaKosmos : Generic
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurazione valori da leggere IOT_Byte
|
||||
/// </summary>
|
||||
public otherData[] mapIOT_Byte;
|
||||
/// <summary>
|
||||
/// Configurazione valori da leggere IOT_Word
|
||||
/// </summary>
|
||||
public otherData[] mapIOT_Word;
|
||||
/// <summary>
|
||||
/// Configurazione valori da leggere IOT_DWord
|
||||
/// </summary>
|
||||
public otherData[] mapIOT_DWord;
|
||||
/// <summary>
|
||||
/// Configurazione valori da leggere IOT_String
|
||||
/// </summary>
|
||||
public otherData[] mapIOT_String;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto elenco allarmi SOLO CNC (OCCHIO codice numerico = INDICE!!!)
|
||||
/// </summary>
|
||||
public allarme[] elencoAllarmiCNC;
|
||||
/// <summary>
|
||||
/// variabile contatore cicli prima di rileggere codici G di un path inattivo...
|
||||
/// </summary>
|
||||
public int contChkGCod;
|
||||
/// <summary>
|
||||
/// Vettore codici G attivi...
|
||||
/// </summary>
|
||||
int[] vettGCodesAct;
|
||||
/// <summary>
|
||||
/// Override asse Z (hard coded x ESA)
|
||||
/// </summary>
|
||||
int ZRateOver = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Carico file conf dati IOT
|
||||
/// </summary>
|
||||
protected override void loadOtherFile()
|
||||
{
|
||||
base.loadOtherFile();
|
||||
loadMaintData("CNT", 0, 1);
|
||||
loadStatusData("MNT", 0, 1);
|
||||
loadAnalogData("ANALOG", 0, 1);
|
||||
loadStringData("STR", 0, 1);
|
||||
loadAllarmiCNC();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caricamento allarmi da file (CON RIEMPIMENTO MANCANTI!!!!)
|
||||
/// </summary>
|
||||
protected void loadAllarmiCNC()
|
||||
{
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info("Inizio caricamento vettore allarmi");
|
||||
}
|
||||
|
||||
int totRighe = 0;
|
||||
string fileName = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("AlarmListCNC"));
|
||||
string linea;
|
||||
try
|
||||
{
|
||||
string lastLine = File.ReadLines(fileName).Last();
|
||||
totRighe = startNumb(lastLine, utils.CRC("testCharSep"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
totRighe = File.ReadLines(fileName).Count();
|
||||
}
|
||||
// creo un vettore della dimensione corretta... PRENDO IL MASSIMO dei valori...
|
||||
elencoAllarmiCNC = new allarme[totRighe];
|
||||
// ora creo un vettore di allarmi VUOTI...
|
||||
for (int i = 1; i <= totRighe; i++)
|
||||
{
|
||||
elencoAllarmiCNC[i - 1] = new allarme(i.ToString(), "CNC", "WARNING", string.Format("[{0}] MISSING", i), string.Format("[{0}] MISSING", i), string.Format("[{0}] MISSING", i));
|
||||
}
|
||||
// carica da file...
|
||||
System.IO.StreamReader file = new System.IO.StreamReader(fileName);
|
||||
// leggo 1 linea alla volta...
|
||||
int numRiga = 0;
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
{
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
// recupero numRiga da prima parte linea...
|
||||
numRiga = startNumb(linea, utils.CRC("testCharSep"));
|
||||
elencoAllarmiCNC[numRiga - 1] = decodeAlarmLine(linea, utils.CRC("testCharSep"));
|
||||
}
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info(string.Format("Fine caricamento vettore allarmi CNC: {0} allarmi caricati!", numRiga));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce path completo file da chaive configurazione
|
||||
/// </summary>
|
||||
/// <param name="keyFile">chaive conf x file richiesto</param>
|
||||
/// <returns></returns>
|
||||
protected string filePath(string keyFile)
|
||||
{
|
||||
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS(keyFile));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// oggetto onnessione ESA
|
||||
/// </summary>
|
||||
protected thdNcEsaKvara ncDevice;
|
||||
/// <summary>
|
||||
/// thread del processo comunicazione esa
|
||||
/// </summary>
|
||||
protected Thread thdDevice;
|
||||
|
||||
/// <summary>
|
||||
/// estende l'init della classe base...
|
||||
/// </summary>
|
||||
/// <param name="caller">FORM chaimante</param>
|
||||
/// <param name="adpConf">CONFIGURAZIONE adapter</param>
|
||||
/// <param name="gatewayObj">OGGETTO gestione comunicazione OUT (tipologia e metodi)</param>
|
||||
public EsaKosmos(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
{
|
||||
// !!!HARD CODED!!! aggiunto banco STATUS del 2 processo IN CODA... (4+1)DW=20byte x strobes...!!!
|
||||
Strobes = new byte[20];
|
||||
|
||||
//fix dimensione memorie MST: 26 short(16bit) x (11+6+6) aree (attenzione: secondo set di 2 bit è VUOTO...)
|
||||
MemBlock_MST = new byte[46];
|
||||
|
||||
// GCodes!
|
||||
vettGCodesAct = new int[10];
|
||||
contChkGCod = utils.CRI("contChkGCod");
|
||||
|
||||
|
||||
string iniPath = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("defaultEsaFile"));
|
||||
|
||||
lg.Info("Start init Adapter ESA dal file {0}", iniPath);
|
||||
|
||||
EsaCncLib.IniFile EsaIni = new EsaCncLib.IniFile(iniPath);
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info("step 01: impostato INI File {0}", iniPath);
|
||||
}
|
||||
|
||||
loadOtherFile();
|
||||
|
||||
parentForm.commPlcActive = true;
|
||||
// init classe comunicazione NC
|
||||
ncDevice = new thdNcEsaKvara(EsaIni);
|
||||
parentForm.commPlcActive = false;
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
lg.Info("step 02: avviato thdNcEsaGvKvara da INI File {0}", iniPath);
|
||||
}
|
||||
|
||||
// inizializzo posizioni assi...
|
||||
prevPosAxis = new double[adpConf.nAxis];
|
||||
prevDirAxis = new int[adpConf.nAxis];
|
||||
|
||||
// verifica avvio...
|
||||
lg.Info("ESA: tryConnect");
|
||||
tryConnect();
|
||||
lg.Info("End init Adapter ESA");
|
||||
|
||||
// leggo dati "statici" dal PLC...
|
||||
}
|
||||
/// <summary>
|
||||
/// Override disconnessione
|
||||
/// </summary>
|
||||
public override void tryDisconnect()
|
||||
{
|
||||
base.tryDisconnect();
|
||||
// disconnetto
|
||||
ncDevice.Disconnect();
|
||||
connectionOk = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Override connessione
|
||||
/// </summary>
|
||||
public override void tryConnect()
|
||||
{
|
||||
base.tryConnect();
|
||||
|
||||
// se non già connesso provo a connettermi...
|
||||
if (!ncDevice.Connected)
|
||||
{
|
||||
// provo a collegarmi
|
||||
if (!ncDevice.Connect())
|
||||
{
|
||||
//altrimenti disconnette...
|
||||
ncDevice.Disconnect();
|
||||
connectionOk = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionOk = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifico connessione ESA...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool connectionOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return ncDevice.Connected;
|
||||
}
|
||||
set
|
||||
{
|
||||
ncDevice.Connected = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legge vettore di TUTTE memorie tipo DWord dato vettore memorie (completo)
|
||||
/// </summary>
|
||||
/// <param name="MemBlock"></param>
|
||||
/// <returns></returns>
|
||||
public override bool readAllAlarms(ref uint[] MemBlock)
|
||||
{
|
||||
ncDevice.ReadlAlarms();
|
||||
MemBlock = ncDevice.SCMA_MMan_ALM.data;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettuo lettura dei 16 byte di strobe/status
|
||||
/// </summary>
|
||||
public override void getStrobeAndAckStatus()
|
||||
{
|
||||
base.getStrobeAndAckStatus();
|
||||
if (connectionOk)
|
||||
{
|
||||
// leggo TUTTO il blocco di memoria
|
||||
parentForm.commPlcActive = true;
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadStatus();
|
||||
ncDevice.ReadAckStrobe();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("R-PLC_SCMA-ACK-Strobe", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
|
||||
parentForm.commPlcActive = false;
|
||||
|
||||
// copio ACK
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_ACK.data, 0, Acknowl, 0, 16);
|
||||
|
||||
// copio strobes (all)
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_STROBE.data, 0, Strobes, 0, 16);
|
||||
|
||||
// status...
|
||||
ouStatus = ncDevice.SCMA_MMan_status.data[0];
|
||||
// copio su ack...
|
||||
Acknowl[12] = (byte)ouStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Errore connessione mancante in getStrobeAndAckStatus");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// processing strobe!
|
||||
/// </summary>
|
||||
public override void processStrobe()
|
||||
{
|
||||
// inizializzo userAction
|
||||
string UserAction = "";
|
||||
// oggetti "accessori" x processing (1 byte di strobe x ogni path)
|
||||
StFlag8 currStrobe;
|
||||
StFlag8 currAck;
|
||||
|
||||
// processo ora i dati dei path... di sicuro il primo
|
||||
currStrobe = (StFlag8)(Strobes[4]); // 5° byte
|
||||
currAck = (StFlag8)(Acknowl[4]); // 5° byte
|
||||
procPathStrobes(0, currStrobe, currAck, 1, 0, ref UserAction); // 0 --> primo byte della ACK MST
|
||||
|
||||
//...e se c'è pure il secondo...
|
||||
if (currAdpConf.nPath > 1)
|
||||
{
|
||||
currStrobe = (StFlag8)(Strobes[6]); // 7° byte
|
||||
currAck = (StFlag8)(Acknowl[6]); // 7° byte
|
||||
procPathStrobes(1, currStrobe, currAck, 1, 2, ref UserAction); // 2 --> terzo byte della ACK MST
|
||||
}
|
||||
|
||||
//2019.07.22 NON RIPORTO USER_ACTION x SOUR
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
// 2017.01.16 INVIO vettore azioni (1 o +)... SE CE NE SONO!
|
||||
if (UserAction.Trim() != "")
|
||||
{
|
||||
currGateway.updateItemNodeValue("USER_ACTION", UserAction.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
// verifico strobe dell'auto-test
|
||||
currStrobe = (StFlag8)(Strobes[7]); // 8° byte
|
||||
currAck = (StFlag8)(Acknowl[7]); // 8° byte
|
||||
processTestStrobe(currStrobe, currAck, 1, 30);
|
||||
|
||||
// gestione bit di watchdog... sulal DWord successiva
|
||||
sendWatchDog();
|
||||
}
|
||||
/// <summary>
|
||||
/// Scrive ACK x dati MST
|
||||
/// </summary>
|
||||
/// <param name="idxPath"></param>
|
||||
/// <param name="memIndexMST"></param>
|
||||
/// <param name="MemBlock_W"></param>
|
||||
/// <returns></returns>
|
||||
public override bool writeMST_ACK(int memIndexAck, ref byte[] currACK_DW)
|
||||
{
|
||||
bool fatto = false;
|
||||
// converto DWord a byte, è la DW1 = ACK[1]...
|
||||
byte[] actualAck = BitConverter.GetBytes(ncDevice.SCMA_MMan_ACK.data[1]);
|
||||
// sistemo nella memoria dell'NC i valori di ack richiesti...
|
||||
Buffer.BlockCopy(currACK_DW, 0, actualAck, memIndexAck, 1);
|
||||
// riconverto a DWord
|
||||
ncDevice.SCMA_MMan_ACK.data[1] = BitConverter.ToUInt32(actualAck, 0);
|
||||
try
|
||||
{
|
||||
inizio = DateTime.Now;
|
||||
// scrivo TUTTA la Hack
|
||||
fatto = ncDevice.WriteAck();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(string.Format("W{0}-ACK_DW1", currACK_DW.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Errore in scrittura dati ACK MST:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Legge area memoria dati MST
|
||||
/// </summary>
|
||||
/// <param name="idxPath"></param>
|
||||
/// <param name="memIndexMST"></param>
|
||||
/// <param name="MemBlock_MST"></param>
|
||||
/// <returns></returns>
|
||||
public override bool readMST_data(int idxPath, int memIndexMST, ref byte[] MemBlock_MST)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
inizio = DateTime.Now;
|
||||
// leggo memoria (TUTTA) e POI ricopio a byte x il resto delal gestione...
|
||||
ncDevice.ReadMSTData();
|
||||
// copio M
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_MNUM.data, idxPath, MemBlock_MST, 0, 2);
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_MF.data, idxPath * 10, MemBlock_MST, 2, 20);
|
||||
// copio S
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_SNUM.data, idxPath, MemBlock_MST, 22, 2);
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_SF.data, idxPath * 5, MemBlock_MST, 24, 10);
|
||||
// copio T
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_TNUM.data, idxPath, MemBlock_MST, 34, 2);
|
||||
Buffer.BlockCopy(ncDevice.SCMA_MMan_TF.data, idxPath * 5, MemBlock_MST, 36, 10);
|
||||
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-STRB_DW1-P{1:00}", MemBlock_MST.Length, idxPath), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Errore in lettura dati MST:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Scrive watchdog
|
||||
/// </summary>
|
||||
/// <param name="retACK_DW"></param>
|
||||
/// <returns></returns>
|
||||
public override bool writeWatchDog(ref byte[] retACK_DW)
|
||||
{
|
||||
bool fatto = false;
|
||||
// converto DWord a byte, è la DW2 = ACK[2]...
|
||||
byte[] actualAck = BitConverter.GetBytes(ncDevice.SCMA_MMan_ACK.data[2]);
|
||||
// sistemo nella memoria dell'NC i valori di ack richiesti...
|
||||
Buffer.BlockCopy(retACK_DW, 0, actualAck, 0, 4);
|
||||
// riconverto a DWord
|
||||
ncDevice.SCMA_MMan_ACK.data[2] = BitConverter.ToUInt32(actualAck, 0);
|
||||
|
||||
// chiamo scrittura...
|
||||
fatto = ncDevice.WriteAck();
|
||||
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Scrive vettore ACK degli allarmi
|
||||
/// </summary>
|
||||
/// <param name="retACK_DW0"></param>
|
||||
/// <returns></returns>
|
||||
public override bool writeAlarmAck(ref byte[] retACK_DW0)
|
||||
{
|
||||
bool fatto = false;
|
||||
// converto DWord a byte, è la DW2 = ACK[2]...
|
||||
byte[] actualAck = BitConverter.GetBytes(ncDevice.SCMA_MMan_ACK.data[0]);
|
||||
// sistemo nella memoria dell'NC i valori di ack richiesti...
|
||||
Buffer.BlockCopy(retACK_DW0, 0, actualAck, 0, 4);
|
||||
// riconverto a DWord
|
||||
ncDevice.SCMA_MMan_ACK.data[0] = BitConverter.ToUInt32(actualAck, 0);
|
||||
// chiamo scrittura...
|
||||
fatto = ncDevice.WriteAck();
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legge vettore di TUTTE memorie tipo DWord dato indice di partenza e vettore memorie
|
||||
/// </summary>
|
||||
/// <param name="MemBlock"></param>
|
||||
/// <param name="blockIndex"></param>
|
||||
/// <returns></returns>
|
||||
public override bool readAlarmBlock(ref uint[] MemBlock, int blockIndex)
|
||||
{
|
||||
// rileggo comunque tutto che faccio prima...
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
ncDevice.ReadlAlarms();
|
||||
var currMemBlock = ncDevice.SCMA_MMan_ALM.data;
|
||||
MemBlock[0] = currMemBlock[blockIndex];
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
#region implementazione processing GlobalData
|
||||
|
||||
/// <summary>
|
||||
/// Legge dati globali...
|
||||
/// </summary>
|
||||
public override void readGlobalData()
|
||||
{
|
||||
// leggo dati globali...
|
||||
parentForm.commPlcActive = true;
|
||||
inizio = DateTime.Now;
|
||||
|
||||
ncDevice.ReadMSTData();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("PLC-MST-Data", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
parentForm.commPlcActive = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// legge dati override...
|
||||
/// </summary>
|
||||
/// <param name="sb1"></param>
|
||||
/// <returns></returns>
|
||||
public override bool readOverrides(ref StringBuilder sb1)
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// lettura override
|
||||
inizio = DateTime.Now;
|
||||
var allSpeedFeedData = ncDevice.getFeedSpeed();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("PLC-R-overrides", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
|
||||
// inizio indicando feed...
|
||||
sb1.AppendLine(string.Format("FeedRate: {0} mm/min", allSpeedFeedData.realFeed));
|
||||
sb1.AppendLine(string.Format("SpeedRate: {0} mm/min", allSpeedFeedData.realSpeed));
|
||||
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, "Eccezione in readOverrides");
|
||||
}
|
||||
|
||||
|
||||
// HARD CODE: forzo path 1 (indice 0...)
|
||||
int idxPath = 0;
|
||||
// accodo dati path in DataMonitor......
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// Processing area BYTE x OVERRIDE e status
|
||||
ZRateOver = ncDevice.SCMA_MMan_OVR.data[0];
|
||||
FeedRateOver = ncDevice.SCMA_MMan_OVR.data[1];
|
||||
RapidOver = ncDevice.SCMA_MMan_OVR.data[2];
|
||||
SpeedRateOver = ncDevice.SCMA_MMan_OVR.data[3];
|
||||
|
||||
// commentato x test sul campo da Gianandrea Grisetti + Marco Annese: si sovrascrivono status da PATH (processo) e generale, eliminato qui
|
||||
#if false
|
||||
string pathExeMode = $"{(macState)ouStatus}";
|
||||
// copio exeMode sul path corrente
|
||||
currGateway.updateItemNodeValue(vettPath[idxPath].exeModeKey, pathExeMode);
|
||||
// sistemo le stringhe x display
|
||||
sb.AppendLine(string.Format("ExeMode: {0}", pathExeMode));
|
||||
#endif
|
||||
sb.AppendLine(string.Format("ZRateOver: {0} %", ZRateOver));
|
||||
sb.AppendLine(string.Format("FeedRateOver: {0} %", FeedRateOver));
|
||||
sb.AppendLine(string.Format("RapidOver: {0} %", RapidOver));
|
||||
sb.AppendLine(string.Format("SpeedRateOver: {0} %", SpeedRateOver));
|
||||
// update form!
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gestione lettura dati manutenzione
|
||||
/// </summary>
|
||||
public override bool getMtzDataFromPlc()
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (maintData != null)
|
||||
{
|
||||
if (maintData.Length > 0)
|
||||
{
|
||||
// recupero dati
|
||||
uint[] tabDatiMtz = new uint[maintDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadCounterData();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
|
||||
// copio maint data
|
||||
tabDatiMtz = ncDevice.SCMA_MMan_CNT.data.Take(maintDataMaxNum).ToArray();
|
||||
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processMaintData(tabDatiMtz, maintData);
|
||||
// se log verboso 10+ --> scrivo tutti!
|
||||
if (utils.CRI("loglevel") > 9)
|
||||
{
|
||||
lg.Info($" Lettura di {maintDataMaxNum} variabili maintData");
|
||||
}
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gestione lettura dati analogici
|
||||
/// </summary>
|
||||
public override bool getAnalogDataFromPlc()
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// leggo e salvo var analogiche ANALOG
|
||||
if (analogDataMaxNum > 0)
|
||||
{
|
||||
// recupero dati
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadAnalogData();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("R-AnalogData", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
uint[] tabDatiAnalog = new uint[analogDataMaxNum];
|
||||
tabDatiAnalog = ncDevice.SCMA_MMan_ANALOG.data.Take(analogDataMaxNum).ToArray();
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processAnalogData(tabDatiAnalog, analogData);
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione lettura dati stringa
|
||||
/// </summary>
|
||||
public override bool getStringDataFromPlc()
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// leggo e salvo var analogiche ANALOG
|
||||
if (stringDataMaxNum > 0)
|
||||
{
|
||||
// recupero dati
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadStringData();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("R-StringData", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
string[] tabDatiString = new string[stringDataMaxNum];
|
||||
for (int i = 0; i < stringDataMaxNum; i++)
|
||||
{
|
||||
tabDatiString[i] = ncDevice.SCMA_MManCMS_Strings[i].data.Trim();
|
||||
}
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processStringData(tabDatiString, stringData);
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione lettura dati status da PLC
|
||||
/// </summary>
|
||||
public override bool getStatusDataFromPlc()
|
||||
{
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
// leggo e salvo status BIT STATUS MNT
|
||||
if (statusDataMaxNum > 0)
|
||||
{
|
||||
// recupero dati
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadStatus();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("R-Status", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
int numByte = 1 + (statusDataMaxNum / 8);
|
||||
// arrotondo ai 4 byte...
|
||||
numByte = 4 * (int)Math.Ceiling((double)numByte / 4);
|
||||
byte[] tabDatiStatus = new byte[numByte];
|
||||
for (int i = 0; i < numByte / 4; i++)
|
||||
{
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(ncDevice.SCMA_MMan_MNT.data[i]), 0, tabDatiStatus, i * 4, 4);
|
||||
}
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processStatusData(tabDatiStatus, statusData);
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("{0}", exc));
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override void getPath()
|
||||
{
|
||||
var allSpeedFeedData = ncDevice.getFeedSpeed();
|
||||
// cicl su path
|
||||
for (int i = 0; i < currAdpConf.nPath; i++)
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettPath[i].feedKey, allSpeedFeedData.realFeed);
|
||||
currGateway.updateItemNodeValue(vettPath[i].feedOverKey, FeedRateOver);
|
||||
currGateway.updateItemNodeValue(vettPath[i].rapidOverKey, RapidOver);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera la speed override x i mandrini (UnOp)
|
||||
/// </summary>
|
||||
public override void getUnOp()
|
||||
{
|
||||
var allSpeedFeedData = ncDevice.getFeedSpeed();
|
||||
// cicl su UnOp
|
||||
for (int i = 0; i < currAdpConf.nUnOp; i++)
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettUnOp[i].speedOverKey, SpeedRateOver);
|
||||
currGateway.updateItemNodeValue(vettUnOp[i].speedKey, allSpeedFeedData.realSpeed);
|
||||
}
|
||||
|
||||
// ora recupero G Codes
|
||||
StringBuilder sb_2;
|
||||
StringBuilder sb_3;
|
||||
|
||||
// faccio VERA lettura SOLO ogni TOT cicli...
|
||||
if (contChkGCod <= 0)
|
||||
{
|
||||
// reimposto contatore
|
||||
contChkGCod = utils.CRI("contChkGCod");
|
||||
// recupero vettore generale G MODE
|
||||
parentForm.commPlcActive = true;
|
||||
inizio = DateTime.Now;
|
||||
vettGCodesAct = ncDevice.getGCodes();
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
parentForm.commPlcActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
contChkGCod--;
|
||||
}
|
||||
|
||||
for (int i = 0; i < currAdpConf.nPath; i++)
|
||||
{
|
||||
// accodo dati path in DataMonitor...
|
||||
sb_2 = new StringBuilder();
|
||||
sb_3 = new StringBuilder();
|
||||
|
||||
// attenzione: il vettore contiene come campi "vuoti" il valore MAX di USHort (16bit) ovvero 2^16 -1 (base 0) --> 65535
|
||||
string GCodAttivi = "";
|
||||
for (int j = 0; j < vettGCodesAct.Length; j++)
|
||||
{
|
||||
// se il valore è < di UShort.max (65535)...
|
||||
if (vettGCodesAct[j] < ushort.MaxValue && vettGCodesAct[j] >= 0)
|
||||
{
|
||||
GCodAttivi += string.Format("[G{0}]", vettGCodesAct[j]);
|
||||
}
|
||||
}
|
||||
if (currGateway.getItemNode(vettPath[i].gCodeAct_Key).ToString() != $"{vettPath[i].gCodeAct_Key}||{GCodAttivi}")
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettPath[i].gCodeAct_Key, GCodAttivi);
|
||||
}
|
||||
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
// 2017.01.16 da rivedere
|
||||
currGateway.updateItemNodeValue(vettPath[i].currProgRowNumKey, "");
|
||||
currGateway.updateItemNodeValue(vettPath[i].activeAxesKey, "");
|
||||
sb_2.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, currGateway.getItemNode(vettPath[i].currProgKey)));
|
||||
}
|
||||
|
||||
sb_3.AppendLine(string.Format("Path {0}, GCodes: {1}", i + 1, GCodAttivi));
|
||||
|
||||
parentForm.dataMonitor_2 += sb_2.ToString();
|
||||
parentForm.dataMonitor_3 += sb_3.ToString();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Carica info accessorie assi (direzione, feed, ...)
|
||||
/// </summary>
|
||||
public override void getAxis()
|
||||
{
|
||||
// mostro assi in DataMonitor......
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// leggo in blocco dati dall'NC
|
||||
var allAxisData = ncDevice.getAxisData();
|
||||
|
||||
var allSpeedFeedData = ncDevice.getFeedSpeed();
|
||||
|
||||
// nuova posizione (per calcoli)
|
||||
double newPos = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
string direzione = "";
|
||||
int numInvAx = 0;
|
||||
int currFeedOver = 0;
|
||||
|
||||
// leggo in modo "cablato" i dati dei vari assi...
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
{
|
||||
// speed singolo asse
|
||||
currGateway.updateItemNodeValue(vettAxis[i].feedrateKey, allAxisData[i].speed);
|
||||
|
||||
/*--------------------------------------------------------
|
||||
* Override calcolata come segue:
|
||||
* - asse Z: sempre "specifica"
|
||||
* - altri assi:
|
||||
* - se HO G0 (RAPID) --> OVR[2]
|
||||
* - se HO G1 (FEED) --> OVR[1]
|
||||
--------------------------------------------------------*/
|
||||
if (!string.IsNullOrEmpty(allAxisData[i].name))
|
||||
{
|
||||
if (allAxisData[i].name == "Z")
|
||||
{
|
||||
currFeedOver = ZRateOver;
|
||||
}
|
||||
else
|
||||
{
|
||||
currFeedOver = FeedRateOver;
|
||||
}
|
||||
// imposto!
|
||||
currGateway.updateItemNodeValue(vettAxis[i].feedOverKey, currFeedOver);
|
||||
}
|
||||
|
||||
|
||||
// load... divido per 10 x avere Ampere
|
||||
currGateway.updateItemNodeValue(vettAxis[i].loadKey, allAxisData[i].load / 10);
|
||||
|
||||
// name
|
||||
if (!string.IsNullOrEmpty(allAxisData[i].name))
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettAxis[i].descriptionKey, allAxisData[i].name);
|
||||
}
|
||||
|
||||
// calcolo distanza e salvo valore...
|
||||
newPos = allAxisData[i].posMac;
|
||||
currGateway.updateItemNodeValue(vettAxis[i].posActKey, newPos);
|
||||
distPerc = newPos - prevPosAxis[i];
|
||||
|
||||
// posizione target = posizione atutale + sistance
|
||||
currGateway.updateItemNodeValue(vettAxis[i].posTgtKey, newPos + allAxisData[i].distanceToGo);
|
||||
|
||||
// sistemo direzione +/- (POS/NEG se lineari, CCW/CW se rotativi)
|
||||
if (distPerc != 0)
|
||||
{
|
||||
newDir = Convert.ToInt32(distPerc / Math.Abs(distPerc));
|
||||
}
|
||||
else
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
|
||||
// calcolo direzione
|
||||
direzione = calculateDirection(newDir, i);
|
||||
// imposto direzione
|
||||
currGateway.updateItemNodeValue(vettAxis[i].directionKey, direzione);
|
||||
|
||||
// se la direzione è variata salvo il cambio direzione...
|
||||
if (newDir != prevDirAxis[i])
|
||||
{
|
||||
// recupero num prec...
|
||||
numInvAx = Convert.ToInt32(istNumInvAssi[i].vcMedian);
|
||||
numInvAx++;
|
||||
// salvo "+1" come cambi direzione.... ATTENZIONE servirà che la finestra sia "corta" (tipo 1 sec...) mentre io ne inserisco 3 distanziati di 1/5 sec
|
||||
istNumInvAssi[i].addValue(DateTime.Now.AddMilliseconds(-400), numInvAx);
|
||||
istNumInvAssi[i].addValue(DateTime.Now.AddMilliseconds(-200), numInvAx);
|
||||
istNumInvAssi[i].addValue(DateTime.Now, numInvAx);
|
||||
}
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
sb.AppendLine($"Asse {i}: PosAct:{newPos:N3} | {direzione}");
|
||||
sb.AppendLine($"Asse {i}: ESA speed {allAxisData[i].speed}");
|
||||
}
|
||||
|
||||
// salvo valori vettore prec...
|
||||
prevPosAxis[i] = newPos;
|
||||
prevDirAxis[i] = newDir;
|
||||
}
|
||||
|
||||
parentForm.dataMonitor_3 += sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,9 +5,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SCMA
|
||||
namespace SCMA.AdapterPLC.CMS
|
||||
{
|
||||
public class AdapterOsai : AdapterGeneric
|
||||
public class Osai : Generic
|
||||
{
|
||||
/// <summary>
|
||||
/// Oggetto MAIN x connessione OSAI
|
||||
@@ -196,7 +196,7 @@ namespace SCMA
|
||||
/// <param name="caller">FORM chaimante</param>
|
||||
/// <param name="adpConf">CONFIGURAZIONE adapter</param>
|
||||
/// <param name="gatewayObj">OGGETTO gestione comunicazione OUT (tipologia e metodi)</param>
|
||||
public AdapterOsai(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
public Osai(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
{
|
||||
// !!!HARD CODED!!! aggiunto banco STATUS del 2 processo IN CODA... (4+1)DW=20byte x strobes...!!!
|
||||
Strobes = new byte[20];
|
||||
@@ -393,10 +393,14 @@ namespace SCMA
|
||||
procPathStrobes(1, currStrobe, currAck, 19126, 19021, ref UserAction);
|
||||
}
|
||||
|
||||
// 2017.01.16 INVIO vettore azioni (1 o +)... SE CE NE SONO!
|
||||
if (UserAction.Trim() != "")
|
||||
//2019.07.22 NON RIPORTO USER_ACTION x SOUR
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
currGateway.updateItemNodeValue("USER_ACTION", UserAction.Trim());
|
||||
// 2017.01.16 INVIO vettore azioni (1 o +)... SE CE NE SONO!
|
||||
if (UserAction.Trim() != "")
|
||||
{
|
||||
currGateway.updateItemNodeValue("USER_ACTION", UserAction.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
// verifico strobe dell'auto-test
|
||||
@@ -676,21 +680,30 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (maintData.Length > 0)
|
||||
if (maintData != null)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1000;
|
||||
uint[] tabDatiMtz = new uint[maintData.Length];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.GW_CODE, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime"))
|
||||
if (maintData.Length > 0)
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1000;
|
||||
// calcolo indice max scorrendo...
|
||||
uint[] tabDatiMtz = new uint[maintDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.GW_CODE, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processMaintData(tabDatiMtz, maintData);
|
||||
// se log verboso 10+ --> scrivo tutti!
|
||||
if (utils.CRI("loglevel") > 9)
|
||||
{
|
||||
lg.Info($" Lettura di {maintDataMaxNum} variabili maintData");
|
||||
}
|
||||
}
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processMaintData(tabDatiMtz, maintData);
|
||||
fatto = true;
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -710,9 +723,9 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 19434;
|
||||
uint[] tabDatiAnalog = new uint[analogData.Length];
|
||||
int[] tabDatiAnalog = new int[analogDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref tabDatiAnalog);
|
||||
OsaiMemRW_Integer(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref tabDatiAnalog);
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-DatiAnalog", tabDatiAnalog.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
@@ -736,11 +749,11 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (statusData.Length > 0)
|
||||
if (statusDataMaxNum > 0)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 19426;
|
||||
int numByte = 1 + (statusData.Length / 8);
|
||||
int numByte = 1 + (statusDataMaxNum / 8);
|
||||
byte[] tabDatiStatus = new byte[numByte];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref tabDatiStatus);
|
||||
@@ -815,7 +828,7 @@ namespace SCMA
|
||||
lg.Info(string.Format("Allarme CNC: {0}", alarmText));
|
||||
}
|
||||
// predispongo allarme
|
||||
allarme currAllarm = new allarme(item.Key, "CNC", "FAULT", alarmText);
|
||||
allarme currAllarm = new allarme(item.Key, currGateway.nCncConditions, "FAULT", alarmText);
|
||||
currGateway.addAlarm(currAllarm);
|
||||
// mostro in form!
|
||||
sb.AppendLine(alarmText);
|
||||
@@ -1012,11 +1025,14 @@ namespace SCMA
|
||||
}
|
||||
|
||||
currGateway.updateItemNodeValue(vettPath[i].gCodeAct_Key, GCodAttivi);
|
||||
// 2017.01.16 da rivedere
|
||||
currGateway.updateItemNodeValue(vettPath[i].currProgRowNumKey, "");
|
||||
currGateway.updateItemNodeValue(vettPath[i].activeAxesKey, "");
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
// 2017.01.16 da rivedere
|
||||
currGateway.updateItemNodeValue(vettPath[i].currProgRowNumKey, "");
|
||||
currGateway.updateItemNodeValue(vettPath[i].activeAxesKey, "");
|
||||
sb_2.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, currGateway.getItemNode(vettPath[i].currProgKey)));
|
||||
}
|
||||
|
||||
sb_2.AppendLine(string.Format("Path {0}, PROG: {1}", i + 1, currGateway.getItemNode(vettPath[i].currProgKey)));
|
||||
sb_3.AppendLine(string.Format("Path {0}, GCodes: {1}", i + 1, GCodAttivi));
|
||||
|
||||
parentForm.dataMonitor_2 += sb_2.ToString();
|
||||
@@ -1035,11 +1051,11 @@ namespace SCMA
|
||||
* 2018.01.16 modifica per gestione doppio processo e nome assi duplicato
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* E' risultato (marco.negri, amcchian OSAI con 2 processi in cui glia ssi di ogni processoa vevano lo stesso nome) ceh OSAI NON restituisce ID univoco asse ma nome etichetta asegnato
|
||||
* in questo modo glia ssi verso agent (e seguenti) si sovrappongono/sovrascrivono
|
||||
* E' risultato (Marco Negri, macchina OSAI con 2 processi in cui gli assi di ogni processo avevano lo stesso nome) che OSAI NON restituisce ID univoco asse ma nome etichetta asegnato
|
||||
* in questo modo gli assi verso agent (e seguenti) si sovrappongono/sovrascrivono
|
||||
*
|
||||
* E' quindi necessario procedere in + step
|
||||
* - verificare numero processia ttivi
|
||||
* - verificare numero processi attivi
|
||||
* - chiedere x ogni processo quali assi ci siano (AsixTable (con Id UNIVOCO e consistente e NOME)
|
||||
* - chiedere x ogni processo le posizioni assi in modo che processo + nome --> Id Univoco --> possiamo popolare la tabella da invaire poi all'agent
|
||||
*/
|
||||
@@ -1049,10 +1065,18 @@ namespace SCMA
|
||||
CMSCncLib.OPENcontrol.GETINTDATA[] tmpPosAssi = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
|
||||
CMSCncLib.OPENcontrol.GETINTDATA[] posAssiTgt = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
|
||||
CMSCncLib.OPENcontrol.GETINTDATA[] posAssi = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
|
||||
Dictionary<int, int> axisMap = new Dictionary<int, int>();
|
||||
|
||||
Dictionary<string, int> axisDict = new Dictionary<string, int>();
|
||||
char[] axisTable = new char[currAdpConf.nAxis];
|
||||
short[] axisIdTable = new short[currAdpConf.nAxis];
|
||||
int currId = 0;
|
||||
int axCounter = 0;
|
||||
// inizializzo TUTTI a path 0 così se sparissero risultano NON attestati su un path...
|
||||
for (int j = 0; j < currAdpConf.nAxis; j++)
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettAxis[j].mainProcKey, 0);
|
||||
}
|
||||
// verifico quanti path ho... e recupero le info sugli assi (se id > 0 è PRESENTE...)
|
||||
for (short i = 1; i <= currAdpConf.nPath; i++)
|
||||
{
|
||||
@@ -1079,9 +1103,9 @@ namespace SCMA
|
||||
try
|
||||
{
|
||||
// salvo (per ID) descr asse e processo corrente!
|
||||
|
||||
currGateway.updateItemNodeValue(vettAxis[currId - 1].descriptionKey, axisTable[j]);
|
||||
currGateway.updateItemNodeValue(vettAxis[currId - 1].mainProcKey, i);
|
||||
currGateway.updateItemNodeValue(vettAxis[axCounter].descriptionKey, axisTable[j]);
|
||||
currGateway.updateItemNodeValue(vettAxis[axCounter].mainProcKey, i);
|
||||
axCounter++;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -1095,6 +1119,7 @@ namespace SCMA
|
||||
|
||||
char axName;
|
||||
int reIdx = 0;
|
||||
axCounter = 0;
|
||||
// ora processo i dati PER PATH delle posizioni assi...
|
||||
for (short i = 1; i <= currAdpConf.nPath; i++)
|
||||
{
|
||||
@@ -1120,14 +1145,22 @@ namespace SCMA
|
||||
// salvo nella posizione DECODIFICATA da dictionary x path/nome...
|
||||
if (axName != '\0' && axName != '-')
|
||||
{
|
||||
// problema: ho 6° asse con ID INTERNO 7
|
||||
// calcolo ID REALE
|
||||
reIdx = axisDict[string.Format("{0}#{1}", i, axName)];
|
||||
posAssiTgt[reIdx - 1] = tmpPosAssiTgt[j];
|
||||
posAssi[reIdx - 1] = tmpPosAssi[j];
|
||||
// salvo la mappatura tra id univoco asse e indice interno
|
||||
axisMap.Add(reIdx, axCounter);
|
||||
// salvo comunque dati completi
|
||||
posAssiTgt[axCounter] = tmpPosAssiTgt[j];
|
||||
posAssi[axCounter] = tmpPosAssi[j];
|
||||
// incremento
|
||||
axCounter++;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, $"Eccezione in processing dati PER PATH delel posizioni assi: j:{j}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1136,7 +1169,6 @@ namespace SCMA
|
||||
double newPosTgt = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
// ORA ho tutto in posizione corretta, PROCESSO!!!
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
@@ -1145,7 +1177,7 @@ namespace SCMA
|
||||
try
|
||||
{
|
||||
//string axName = System.Text.Encoding.ASCII.GetString(posAssi[i].AxisName);
|
||||
if (posAssiTgt[i].AxisName == 0)
|
||||
if (posAssiTgt[i] == null || posAssiTgt[i].AxisName == 0)
|
||||
{
|
||||
axName = '-';
|
||||
}
|
||||
@@ -1166,7 +1198,9 @@ namespace SCMA
|
||||
newPosTgt = 0;
|
||||
}
|
||||
// popolo valori... LOAD gestito da vettore letto con area memoria AnalogData.map
|
||||
currGateway.updateItemNodeValue(vettAxis[i].loadKey, Convert.ToUInt32(istLoadAssi[i].vcMedian));
|
||||
#if false
|
||||
currGateway.updateItemNodeValue(vettAxis[i].loadKey, Convert.ToUInt32(istLoadAssi[i].vcMedian));
|
||||
#endif
|
||||
currGateway.updateItemNodeValue(vettAxis[i].posActKey, newPos);
|
||||
currGateway.updateItemNodeValue(vettAxis[i].posTgtKey, newPosTgt);
|
||||
currGateway.updateItemNodeValue(vettAxis[i].feedrateKey, FeedRate);
|
||||
@@ -1182,19 +1216,9 @@ namespace SCMA
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
|
||||
// verifico tipo direzione da tipo asse...
|
||||
tipoAsse = currGateway.getItemNode(vettAxis[i].typeKey).ToString();
|
||||
if (tipoAsse == "LINEAR")
|
||||
{
|
||||
// ?: conditional operator.
|
||||
direzione = (newDir > 0) ? "POSITIVE" : "NEGATIVE";
|
||||
}
|
||||
else if (tipoAsse == "ROTARY")
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
|
||||
// calcolo direzione
|
||||
direzione = calculateDirection(newDir, i);
|
||||
// imposto direzione
|
||||
currGateway.updateItemNodeValue(vettAxis[i].directionKey, direzione);
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
@@ -1222,5 +1246,7 @@ namespace SCMA
|
||||
parentForm.commPlcActive = false;
|
||||
parentForm.dataMonitor_3 += sb.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ using MTC;
|
||||
using SCMA.AdapterCom;
|
||||
using Siemens.Sinumerik.Operate.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SCMA
|
||||
namespace SCMA.AdapterPLC.CMS
|
||||
{
|
||||
public class AdapterSiemens : AdapterGeneric
|
||||
public class Siemens : Generic
|
||||
{
|
||||
/// <summary>
|
||||
/// Oggetto MAIN x connessione SIEMENS
|
||||
@@ -188,7 +189,7 @@ namespace SCMA
|
||||
/// <param name="caller">FORM chaimante</param>
|
||||
/// <param name="adpConf">CONFIGURAZIONE adapter</param>
|
||||
/// <param name="gatewayObj">OGGETTO gestione comunicazione OUT (tipologia e metodi)</param>
|
||||
public AdapterSiemens(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
public Siemens(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
{
|
||||
// !!!HARD CODED!!! aggiunto banco STATUS del 2 processo IN CODA... (4+1)DW=20byte x strobes...!!!
|
||||
Strobes = new byte[20];
|
||||
@@ -376,10 +377,14 @@ namespace SCMA
|
||||
procPathStrobes(1, currStrobe, currAck, 210, 6, ref UserAction);
|
||||
}
|
||||
|
||||
// 2017.01.16 INVIO vettore azioni (1 o +)... SE CE NE SONO!
|
||||
if (UserAction.Trim() != "")
|
||||
//2019.07.22 NON RIPORTO USER_ACTION x SOUR
|
||||
if (currGateway.protocollo != gwProtocol.SOURS)
|
||||
{
|
||||
currGateway.updateItemNodeValue("USER_ACTION", UserAction.Trim());
|
||||
// 2017.01.16 INVIO vettore azioni (1 o +)... SE CE NE SONO!
|
||||
if (UserAction.Trim() != "")
|
||||
{
|
||||
currGateway.updateItemNodeValue("USER_ACTION", UserAction.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
// verifico strobe dell'auto-test
|
||||
@@ -672,21 +677,24 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (maintData.Length > 0)
|
||||
if (maintData != null)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 536;
|
||||
uint[] tabDatiMtz = new uint[maintData.Length];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime"))
|
||||
if (maintData.Length > 0)
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 536;
|
||||
uint[] tabDatiMtz = new uint[maintDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime"))
|
||||
{
|
||||
TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processMaintData(tabDatiMtz, maintData);
|
||||
}
|
||||
// decodifico aree memoria secondo tab configurazione
|
||||
processMaintData(tabDatiMtz, maintData);
|
||||
fatto = true;
|
||||
}
|
||||
fatto = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -700,11 +708,11 @@ namespace SCMA
|
||||
bool fatto = false;
|
||||
try
|
||||
{
|
||||
if (statusData.Length > 0)
|
||||
if (statusDataMaxNum > 0)
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1048;
|
||||
int numByte = 1 + (statusData.Length / 8);
|
||||
int numByte = 1 + (statusDataMaxNum / 8);
|
||||
byte[] tabDatiStatus = new byte[numByte];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemDb, memIndex, ref tabDatiStatus);
|
||||
@@ -733,7 +741,7 @@ namespace SCMA
|
||||
{
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 1064;
|
||||
uint[] tabDatiAnalog = new uint[analogData.Length];
|
||||
uint[] tabDatiAnalog = new uint[analogDataMaxNum];
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiAnalog);
|
||||
if (utils.CRB("recTime"))
|
||||
@@ -819,7 +827,7 @@ namespace SCMA
|
||||
parentForm.dataMonitor_1 += sb.ToString();
|
||||
}
|
||||
// predispongo allarme
|
||||
allarme currAllarm = new allarme(codAllarme, "CNC", "FAULT", allarmeSiemens.Message);
|
||||
allarme currAllarm = new allarme(codAllarme, currGateway.nCncConditions, "FAULT", allarmeSiemens.Message);
|
||||
currGateway.addAlarm(currAllarm);
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -986,7 +994,6 @@ namespace SCMA
|
||||
double newPos = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
|
||||
// recupero in blocco dati assi...
|
||||
@@ -1023,18 +1030,8 @@ namespace SCMA
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
|
||||
// verifico tipo direzione da tipo asse...
|
||||
tipoAsse = currGateway.getItemNode(vettAxis[i].typeKey).ToString();
|
||||
if (tipoAsse == "LINEAR")
|
||||
{
|
||||
// ?: conditional operator.
|
||||
direzione = (newDir > 0) ? "POSITIVE" : "NEGATIVE";
|
||||
}
|
||||
else if (tipoAsse == "ROTARY")
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
// calcolo direzione
|
||||
direzione = calculateDirection(newDir, i);
|
||||
// imposto direzione
|
||||
currGateway.updateItemNodeValue(vettAxis[i].directionKey, direzione);
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
using MTC;
|
||||
using MTConnect;
|
||||
using SCMA.AdapterCom;
|
||||
using System;
|
||||
|
||||
namespace SCMA.AdapterPLC
|
||||
{
|
||||
public class Demo : Generic
|
||||
{
|
||||
DateTime nextChange;
|
||||
/// <summary>
|
||||
/// estende l'init della classe base...
|
||||
/// </summary>
|
||||
/// <param name="caller">FORM chaimante</param>
|
||||
/// <param name="adpConf">CONFIGURAZIONE adapter</param>
|
||||
/// <param name="gatewayObj">OGGETTO gestione comunicazione OUT (tipologia e metodi)</param>
|
||||
public Demo(MainForm caller, AdapterConf adpConf, Gateway gatewayObj) : base(caller, adpConf, gatewayObj)
|
||||
{
|
||||
// !!!HARD CODED!!! aggiunto banco STATUS del 2 processo IN CODA... (4+1)DW=20byte x strobes...!!!
|
||||
Strobes = new byte[20];
|
||||
// fix dimensione memorie MST: 52 Byte = 26 short(16bit) x (12+7+7) aree (attenzione: secondo set di 2 bit è VUOTO...)
|
||||
MemBlock_MST = new byte[52];
|
||||
saltoMST = 0;
|
||||
|
||||
// è little endian (NON serve conversione)
|
||||
hasBigEndian = false;
|
||||
|
||||
lg.Info("Start init Adapter DEMO all'IP {0}", utils.CRS("ipPLC"));
|
||||
|
||||
// inizializzo posizioni assi...
|
||||
prevPosAxis = new double[adpConf.nAxis];
|
||||
prevDirAxis = new int[adpConf.nAxis];
|
||||
nextChange = DateTime.Now.AddSeconds(10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Connessione sempre OK...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool connectionOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void startAdapter()
|
||||
{
|
||||
lg.Info("Start DEMO adapter");
|
||||
base.startAdapter();
|
||||
}
|
||||
|
||||
public override void getSlowChangingData()
|
||||
{
|
||||
// recupero SEMPRE dati ulteriori: status ON/OFF, clock, ...
|
||||
currGateway.updateItemNodeValue("STATUS", parentForm.datiProd.Status);
|
||||
currGateway.updateItemNodeValue("ACC_TIME", parentForm.datiProd.AccTime);
|
||||
currGateway.updateItemNodeValue("OperatorId", parentForm.datiProd.Operator);
|
||||
currGateway.updateItemNodeValue("POWER", parentForm.datiProd.Power);
|
||||
currGateway.updateItemNodeValue("CLOCK", DateTime.Now.Date.ToFileTimeUtc());
|
||||
}
|
||||
|
||||
public override void getStrobeAndAckStatus()
|
||||
{
|
||||
base.getStrobeAndAckStatus();
|
||||
|
||||
byte[] newStrobes = new byte[20];
|
||||
// per 50 sec/min (circa) simulo LAVORO...
|
||||
if (nextChange > DateTime.Now)
|
||||
{
|
||||
newStrobes[4] = 8;
|
||||
newStrobes[8] = 16;
|
||||
newStrobes[9] = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// imposto cambio
|
||||
newStrobes[4] = 4;
|
||||
newStrobes[8] = 8;
|
||||
newStrobes[9] = 4;
|
||||
|
||||
Random rand = new Random();
|
||||
int numSec = rand.Next(7, 16);
|
||||
nextChange = DateTime.Now.AddSeconds(numSec);
|
||||
}
|
||||
Buffer.BlockCopy(newStrobes, 0, Strobes, 0, 20);
|
||||
|
||||
// controllo bool allarmi...
|
||||
if (parentForm.datiProd.EmrStop)
|
||||
{
|
||||
currGateway.updateItemNodeValue("E_STOP", emStatus.TRIGGERED.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
currGateway.updateItemNodeValue("E_STOP", emStatus.ARMED.ToString());
|
||||
}
|
||||
|
||||
// imposto func mode...
|
||||
currGateway.updateItemNodeValue("FUNCT_MODE", parentForm.datiProd.FuncMode);
|
||||
|
||||
// se ho un messaggio...
|
||||
if (parentForm.datiProd.MessageText.Length > 0)
|
||||
{
|
||||
currGateway.updateItemNodeCodeValue("MESSAGE", parentForm.datiProd.MessageCode, parentForm.datiProd.MessageText);
|
||||
}
|
||||
}
|
||||
|
||||
public override void getConfigParam()
|
||||
{
|
||||
base.getConfigParam();
|
||||
}
|
||||
|
||||
|
||||
public override void processStrobe()
|
||||
{
|
||||
// qui forzo la gestione di update dei path & co...
|
||||
getPath();
|
||||
getUnOp();
|
||||
getAxis();
|
||||
}
|
||||
/// <summary>
|
||||
/// non fa nulla perché recupera allarmi in vettore al singolo cambio...
|
||||
/// </summary>
|
||||
/// <param name="Alarm2Refresh"></param>
|
||||
/// <param name="giveAck"></param>
|
||||
public override void refreshAlarmState(StFlag32 Alarm2Refresh, bool giveAck)
|
||||
{
|
||||
base.refreshAlarmState(Alarm2Refresh, giveAck);
|
||||
}
|
||||
|
||||
public override void getPath()
|
||||
{
|
||||
base.getPath();
|
||||
|
||||
PathData PtData = parentForm.CurrPath;
|
||||
}
|
||||
|
||||
public override void getUnOp()
|
||||
{
|
||||
base.getUnOp();
|
||||
|
||||
UnOpData uoData = parentForm.CurrUnOp;
|
||||
if (uoData.UnOpSel >= 0)
|
||||
{
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].toolIdKey, uoData.UnOpToolId);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].numCUKey, uoData.UnOpNumCU);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].statusKey, uoData.UnOpStatus);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].vitaResKey, uoData.UnOpVitaRes);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].speedKey, uoData.UnOpSpeed);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].loadKey, uoData.UnOpLoad);
|
||||
currGateway.updateItemNodeValue(vettUnOp[uoData.UnOpSel].accTimeKey, uoData.UnOpAccTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override void getAxis()
|
||||
{
|
||||
base.getAxis();
|
||||
AxisData AxData = parentForm.CurrAxis;
|
||||
if (AxData.AxisSel >= 0)
|
||||
{
|
||||
// USO asse selezionato + dati visualizzati e di conseguenza aggiorno...
|
||||
currGateway.updateItemNodeValue(vettAxis[AxData.AxisSel].mainProcKey, AxData.AxisMainProc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<appSettings>
|
||||
<!--clock di base update...-->
|
||||
<add key="timerIntMs" value="5" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="fastCount" value="20" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="normCount" value="50" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="slowCount" value="500" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="alarmSyncCount" value="6000" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="waitEndCycle" value="0" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="loglevel" value="5" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="mode" value="prod" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="autoLoadConf" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="openDumpOnStart" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="procIotMem" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="cycleWatchDog" value="2" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<!--COMMENTATO IN DEBUG LOCALE-->
|
||||
<add key="startMinimized" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="windowCanMax" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="trayClose" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="recTime" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="ipPLC" value="127.0.0.1" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -2,7 +2,9 @@
|
||||
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<appSettings>
|
||||
<add key="autoLoadConf" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="defaultConfFile" value="Adapter_ItemList.xml" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<!--<add key="autoLoadConf" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="procIotMem" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>-->
|
||||
<add key="autoLoadConf" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="procIotMem" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -14,7 +14,7 @@
|
||||
<add key="autoLoadConf" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="openDumpOnStart" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="procIotMem" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="cycleWatchDog" value="2" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
x <add key="cycleWatchDog" value="2" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<!--COMMENTATO IN DEBUG LOCALE-->
|
||||
<add key="startMinimized" value="true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
<add key="windowCanMax" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
|
||||
|
||||
+188
-134
@@ -1,144 +1,198 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
||||
</startup>
|
||||
<appSettings>
|
||||
<!--MAIN CONF-->
|
||||
<add key="appName" value="MTConnect Adapter"/>
|
||||
<!--parametri protocollo comunicazione-->
|
||||
<add key="adpProto" value="MTC"/>
|
||||
<add key="MTC_port" value="7878"/>
|
||||
<add key="SOURS_IP" value="localhost"/>
|
||||
<add key="SOURS_port" value="6379"/>
|
||||
<!--gestione TIMERS e periodi multipli x thread lenti-->
|
||||
<add key="startTimerMs" value="250"/>
|
||||
<add key="timerIntMs" value="5"/><!--invio da adapter ad agent: 5ms-->
|
||||
<add key="fastCount" value="20"/><!--100ms-->
|
||||
<add key="normCount" value="100"/><!--500ms-->
|
||||
<add key="slowCount" value="1000"/><!--5 sec-->
|
||||
<add key="alarmSyncCount" value="6000"/><!--30 sec-->
|
||||
<add key="waitEndCycle" value="0"/><!--ms attesa dopo ogni ciclo lettura...--><!--30 sec-->
|
||||
<!--num cicli PRIMA di leggere davvero GCode x rallentare-->
|
||||
<add key="contChkGCod" value="2"/>
|
||||
<!--gestione FINESTRA campionamento x counter in secondi (dati validi dati DOPO che è piena la coda x la finestra richiesta, mantenuta a quella durata...)-->
|
||||
<add key="countWindSize" value="30"/>
|
||||
<!--parametri gestione watchdog-->
|
||||
<add key="maxAdapterLockSec" value="5"/>
|
||||
<!--disabilito letture avanzate che UCCIDONO il programma (x ora SOLO allarmi CNC x FANUC-->
|
||||
<add key="disableAdvRead" value="true"/>
|
||||
<!--gestione x abilitare/disabilitare lettura nome asse e path di controllo (OSAI)-->
|
||||
<add key="enableAxNamePath" value="true"/>
|
||||
<!--AREA CONF IP FANUC-->
|
||||
<!--SIMULATORE LOCALE
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
</startup>
|
||||
<appSettings>
|
||||
<!--MAIN CONF-->
|
||||
<add key="appName" value="SCMA" />
|
||||
<!--parametri protocollo comunicazione-->
|
||||
<!--<add key="adpProto" value="MTC" />-->
|
||||
<!--<add key="adpProto" value="SOURS" />-->
|
||||
<add key="adpProto" value="SOURS" />
|
||||
<add key="MTC_port" value="7878" />
|
||||
<add key="SOURS_IP" value="localhost" />
|
||||
<add key="SOURS_port" value="6379" />
|
||||
<add key="SOURS_baseHash" value="SOUR" />
|
||||
<add key="stChkEnabled" value="true" />
|
||||
<add key="logRedConnWaitTime" value="5" />
|
||||
<add key="fullReset" value="false" />
|
||||
<!--gestione TIMERS e periodi multipli x thread lenti-->
|
||||
<add key="startTimerMs" value="250" />
|
||||
<add key="timerIntMs" value="5" />
|
||||
<!--invio da adapter ad agent: 5ms-->
|
||||
<add key="fastCount" value="20" />
|
||||
<!--100ms-->
|
||||
<add key="normCount" value="100" />
|
||||
<!--500ms-->
|
||||
<add key="slowCount" value="1000" />
|
||||
<!--5 sec-->
|
||||
<add key="alarmSyncCount" value="6000" />
|
||||
<!--30 sec-->
|
||||
<add key="waitEndCycle" value="0" />
|
||||
<!--ms attesa dopo ogni ciclo lettura...-->
|
||||
<!--30 sec-->
|
||||
<!--num cicli PRIMA di leggere davvero GCode x rallentare-->
|
||||
<add key="contChkGCod" value="2" />
|
||||
<!--gestione FINESTRA campionamento x counter in secondi (dati validi dati DOPO che è piena la coda x la finestra richiesta, mantenuta a quella durata...)-->
|
||||
<add key="countWindSize" value="10" />
|
||||
<!--parametri gestione watchdog-->
|
||||
<add key="maxAdapterLockSec" value="5" />
|
||||
<!--disabilito letture avanzate che UCCIDONO il programma (x ora SOLO allarmi CNC x FANUC-->
|
||||
<add key="disableAdvRead" value="true" />
|
||||
<!--gestione x abilitare/disabilitare lettura nome asse e path di controllo (OSAI)-->
|
||||
<add key="enableAxNamePath" value="true" />
|
||||
<!--AREA CONF IP FANUC-->
|
||||
<!--SIMULATORE LOCALE
|
||||
IP LOOPBACK: 192.168.211.5/255.255.255.0
|
||||
ipPLC = "192.168.211.5"-->
|
||||
<!--<add key ="ipPLC" value="192.168.211.5" />-->
|
||||
<!--SIM PC
|
||||
<!--<add key="ipPLC" value="192.168.211.5" />-->
|
||||
<!--SIM PC
|
||||
IP ETH: 192.168.139.201/255.255.255.0
|
||||
ipPLC = "192.168.139.100"-->
|
||||
<!--<add key="ipPLC" value="192.168.139.100" />-->
|
||||
<!--<add key="ipPLC" value="192.168.139.1" />-->
|
||||
<!--<add key="ipPLC" value="192.168.157.2"/>-->
|
||||
<!--Sviluppo Steamware
|
||||
<!--<add key="ipPLC" value="192.168.139.100" />-->
|
||||
<!--<add key="ipPLC" value="192.168.139.1" />-->
|
||||
<!--<add key="ipPLC" value="192.168.157.2"/>-->
|
||||
<!--Sviluppo Steamware
|
||||
IP ETH: 10.74.82.110/255.255.255.0
|
||||
ipPLC = "10.74.82.110"-->
|
||||
<!--PRODUZIONE
|
||||
<!--PRODUZIONE
|
||||
IP ETH: 192.168.139.201/255.255.255.0
|
||||
ipPLC = "192.168.139.1"-->
|
||||
<!--<add key="ipPLC" value="192.168.157.2"/>-->
|
||||
<!--OSAI DEV-->
|
||||
<!--<add key ="ipPLC" value="192.168.157.2" />-->
|
||||
<!--SIEMENS DEV-->
|
||||
<!--<add key ="ipPLC" value="192.168.214.1" />-->
|
||||
<!--CMS PROD-->
|
||||
<!--<add key ="ipPLC" value="192.168.139.1" />-->
|
||||
<add key ="ipPLC" value="192.168.157.2" />
|
||||
|
||||
<add key="recTime" value="true"/>
|
||||
<add key="verbose" value="true"/>
|
||||
<add key="loglevel" value="5"/>
|
||||
<add key="mode" value="prod"/>
|
||||
<!--Definizione avvio Adapter-->
|
||||
<add key="autoLoadConf" value="false"/>
|
||||
<add key="autoStartOnLoad" value="true"/>
|
||||
<add key="openDumpOnStart" value="true"/>
|
||||
<add key="startMinimized" value="false"/>
|
||||
<add key="windowCanMax" value="true"/>
|
||||
<add key="trayClose" value="true"/>
|
||||
<add key="autoSaveSec" value="60"/>
|
||||
<add key="waitRecMSec" value="5000"/>
|
||||
<add key="testCharSep" value="|"/>
|
||||
<add key="fattdecimale" value="1000"/>
|
||||
<add key="fattConvDistAssi" value="1000"/>
|
||||
<add key="fattDecVA" value="1000"/>
|
||||
<!--conf file-->
|
||||
<add key="dataPath" value="DATA"/>
|
||||
<add key="dataConfPath" value="DATA\CONF"/>
|
||||
<add key="dataDatPath" value="DATA\DAT"/>
|
||||
<add key="resxPath" value="Resources"/>
|
||||
<add key="AlarmList" value="AlarmList.map"/>
|
||||
<add key="AlarmListCNC" value="AlarmListCNC.map"/>
|
||||
<add key="defaultConfFile" value="Adapter_ItemList.xml"/>
|
||||
<add key="defaultPersLayerFile" value="PersistData.dat"/>
|
||||
<add key="maxNumDD" value="30"/>
|
||||
<add key="defaultEsaFile" value="EsaKvara.ini"/>
|
||||
<add key="CounterListFilePath" value="CounterList.map"/>
|
||||
<add key="AnalogDataFilePath" value="AnalogData.map"/>
|
||||
<add key="StatusListFilePath" value="StatusList.map"/>
|
||||
<add key="SubModeListFilePath" value="SubModeList.map"/>
|
||||
<!--Gestione path siemens-->
|
||||
<add key="SiemensBaseCountPath" value="0"/>
|
||||
<!--gestione FANUC con assi limitati-->
|
||||
<add key="FanucLimit3D" value="false"/>
|
||||
<!--conf gestione "semplificata" accesso a tutta la memoria ogni volta-->
|
||||
<!--conf x CMS-->
|
||||
<add key="procIotMem" value="false"/>
|
||||
<!--conf x ESA-KVARA-->
|
||||
<!--<add key="procIotMem" value="true"/>-->
|
||||
<!--file configurazione IotMem (ESA KVARA)-->
|
||||
<add key="IOTByteFilePath" value="IOT_ByteList.map"/>
|
||||
<add key="IOTWordFilePath" value="IOT_WordList.map"/>
|
||||
<add key="IOTDWordFilePath" value="IOT_DWordList.map"/>
|
||||
<add key="IOTStringFilePath" value="IOT_StringList.map"/>
|
||||
<!--percorso file scambio dati "lenti" e conf MaintData memory area -->
|
||||
<add key="GeneralStatusFilePath" value="CmsGeneralStatus.mtc"/>
|
||||
<!--gestione trigger eventi da allarmi-->
|
||||
<add key="eStopCode" value="152"/>
|
||||
<!--gestione watchdog CMS-->
|
||||
<add key="sendWatchDog" value="true"/>
|
||||
<add key="cycleWatchDog" value="3"/>
|
||||
<add key="readAllTop" value="true"/>
|
||||
<add key="fastCopy" value="true"/>
|
||||
<add key="ClientSettingsProvider.ServiceUri" value=""/>
|
||||
<!--gestione spindle override gobale forzato da max valori letti...-->
|
||||
<add key="getMaxSpOver" value="true"/>
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<system.serviceModel>
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="OPENcontrol"/>
|
||||
</basicHttpBinding>
|
||||
</bindings>
|
||||
<client>
|
||||
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType" name="OPENcontrol"/>
|
||||
</client>
|
||||
</system.serviceModel>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="lib;libs"/>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<!--<add key="ipPLC" value="192.168.157.2"/>-->
|
||||
<!--OSAI DEV-->
|
||||
<!--<add key="ipPLC" value="192.168.157.2" />-->
|
||||
<!--SIEMENS DEV-->
|
||||
<!--<add key="ipPLC" value="192.168.214.1" />-->
|
||||
<!--CMS PROD-->
|
||||
<!--<add key="ipPLC" value="192.168.139.1" />-->
|
||||
<add key="ipPLC" value="192.168.139.1" />
|
||||
<add key="recTime" value="true" />
|
||||
<add key="verbose" value="true" />
|
||||
<add key="loglevel" value="5" />
|
||||
<add key="mode" value="prod" />
|
||||
<!--Definizione avvio Adapter-->
|
||||
<add key="autoLoadConf" value="false" />
|
||||
<add key="autoStartOnLoad" value="true" />
|
||||
<add key="openDumpOnStart" value="true" />
|
||||
<add key="startMinimized" value="false" />
|
||||
<add key="windowCanMax" value="true" />
|
||||
<add key="trayClose" value="true" />
|
||||
<add key="autoSaveSec" value="60" />
|
||||
<add key="waitRecMSec" value="5000" />
|
||||
<add key="testCharSep" value="|" />
|
||||
<add key="fattdecimale" value="1000" />
|
||||
<add key="fattConvDistAssi" value="1000" />
|
||||
<add key="fattDecVA" value="1" />
|
||||
<!--<add key="fattDecVA" value="1000" />-->
|
||||
<add key="fattFeedFanuc" value="10" />
|
||||
<!--pre-filtraggio XML-->
|
||||
<add key="xmlSanitize" value="true" />
|
||||
<!--conf file-->
|
||||
<add key="dataPath" value="DATA" />
|
||||
<add key="dataConfPath" value="DATA\CONF" />
|
||||
<add key="dataDatPath" value="DATA\DAT" />
|
||||
<add key="resxPath" value="Resources" />
|
||||
<add key="AlarmList" value="AlarmList.map" />
|
||||
<add key="NameRepRolesList" value="NameRepRolesList.map" />
|
||||
<add key="MemCopyList" value="MemCopyList.map" />
|
||||
<add key="DataModel" value="DataModel.xml" />
|
||||
<add key="AlarmListCNC" value="AlarmListCNC.map" />
|
||||
<add key="defaultConfFile" value="DataModel.xml" />
|
||||
<!--<add key="defaultConfFile" value="Adapter_ItemList.xml" />-->
|
||||
<add key="defaultPersLayerFile" value="PersistData.dat" />
|
||||
<add key="maxNumDD" value="30" />
|
||||
<add key="defaultEsaFile" value="EsaKvara.ini" />
|
||||
<add key="CounterListFilePath" value="CounterList.map" />
|
||||
<add key="AnalogDataFilePath" value="AnalogData.map" />
|
||||
<add key="StatusListFilePath" value="StatusList.map" />
|
||||
<add key="StringDataFilePath" value="StringData.map" />
|
||||
<add key="SubModeListFilePath" value="SubModeList.map" />
|
||||
<!--Gestione pathFanuc-->
|
||||
<add key="FanucPathComb" value="true" />
|
||||
<add key="FanucAxPathAssign" value="1,1,1,2,2,2" />
|
||||
<!--Gestione path siemens-->
|
||||
<add key="SiemensBaseCountPath" value="0" />
|
||||
<!--gestione FANUC con assi limitati-->
|
||||
<add key="FanucLimit3D" value="true" />
|
||||
<!--conf gestione "semplificata" accesso a tutta la memoria ogni volta-->
|
||||
<!--conf x CMS-->
|
||||
<add key="procIotMem" value="false" />
|
||||
<!--conf x ESA-KVARA-->
|
||||
<!--<add key="procIotMem" value="true"/>-->
|
||||
<!--file configurazione IotMem (ESA KVARA)-->
|
||||
<add key="IOTByteFilePath" value="IOT_ByteList.map" />
|
||||
<add key="IOTWordFilePath" value="IOT_WordList.map" />
|
||||
<add key="IOTDWordFilePath" value="IOT_DWordList.map" />
|
||||
<add key="IOTStringFilePath" value="IOT_StringList.map" />
|
||||
<!--percorso file scambio dati "lenti" e conf MaintData memory area -->
|
||||
<add key="GeneralStatusFilePath" value="CmsGeneralStatus.mtc" />
|
||||
<!--gestione trigger eventi da allarmi-->
|
||||
<add key="eStopCode" value="152" />
|
||||
<!--gestione watchdog CMS-->
|
||||
<add key="sendWatchDog" value="true" />
|
||||
<add key="cycleWatchDog" value="3" />
|
||||
<add key="readAllTop" value="true" />
|
||||
<add key="fastCopy" value="true" />
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
<!--gestione spindle override gobale forzato da max valori letti...-->
|
||||
<add key="getMaxSpOver" value="true" />
|
||||
<!--gestione decodifica status-->
|
||||
<add key="ouStatusByPlc" value="true" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<system.serviceModel>
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="OPENcontrol" />
|
||||
</basicHttpBinding>
|
||||
</bindings>
|
||||
<client>
|
||||
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType" name="OPENcontrol" />
|
||||
</client>
|
||||
</system.serviceModel>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="lib;libs" />
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AdapterConf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Version>1</Version>
|
||||
<NomeAdapt>ADAPTER_SIM</NomeAdapt>
|
||||
<TipoAdapt>DEMO</TipoAdapt>
|
||||
<ContOreMaccOn>0</ContOreMaccOn>
|
||||
<ContOreMaccLav>0</ContOreMaccLav>
|
||||
<ContSlittaTast>0</ContSlittaTast>
|
||||
<VacuumPump>
|
||||
<element>
|
||||
<ident>VacPump_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>VacPump_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</VacuumPump>
|
||||
<VacuumAct>
|
||||
<element>
|
||||
<ident>VacAct_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>VacAct_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</VacuumAct>
|
||||
<Lubro>
|
||||
<element>
|
||||
<ident>Lubro_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>Lubro_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</Lubro>
|
||||
<SlittaMag>
|
||||
<element>
|
||||
<ident>SlittaMagazzino_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</SlittaMag>
|
||||
<ProtMag>
|
||||
<element>
|
||||
<ident>ProtMagazzino_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</ProtMag>
|
||||
<Cooler>
|
||||
<element>
|
||||
<ident>Cooler_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>Cooler_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</Cooler>
|
||||
<Press>
|
||||
<element>
|
||||
<ident>Press_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>Press_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</Press>
|
||||
<Temp>
|
||||
<element>
|
||||
<ident>Temp_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>Temp_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</Temp>
|
||||
<Path>
|
||||
<element>
|
||||
<ident>Path_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>Path_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</Path>
|
||||
<UnOp>
|
||||
<element>
|
||||
<ident>UnOp_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<element>
|
||||
<ident>UnOp_02</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
</UnOp>
|
||||
<Axis>
|
||||
<element>
|
||||
<ident>Axis_01</ident>
|
||||
<dataRefList>
|
||||
<dataRef>
|
||||
<Key>Axis_01_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_01_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
<ident>Axis_02</ident>
|
||||
<dataRefList>
|
||||
<dataRef>
|
||||
<Key>Axis_02_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_02_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
<ident>Axis_03</ident>
|
||||
<dataRefList>
|
||||
<dataRef>
|
||||
<Key>Axis_03_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_03_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
<ident>Axis_04</ident>
|
||||
<dataRefList>
|
||||
<dataRef>
|
||||
<Key>Axis_04_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_04_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
<ident>Axis_05</ident>
|
||||
<dataRefList>
|
||||
<dataRef>
|
||||
<Key>Axis_05_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_05_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
<element>
|
||||
<ident>Axis_06</ident>
|
||||
<dataRefList>
|
||||
<dataRef>
|
||||
<Key>Axis_06_Type</Key>
|
||||
<Value>LINEAR</Value>
|
||||
</dataRef>
|
||||
<dataRef>
|
||||
<Key>Axis_06_Grp</Key>
|
||||
<Value>00</Value>
|
||||
</dataRef>
|
||||
</dataRefList>
|
||||
</element>
|
||||
</Axis>
|
||||
</AdapterConf>
|
||||
@@ -83,10 +83,10 @@
|
||||
<ident>Path_01</ident>
|
||||
<dataRefList />
|
||||
</element>
|
||||
<!--<element>
|
||||
<element>
|
||||
<ident>Path_02</ident>
|
||||
<dataRefList />
|
||||
</element>-->
|
||||
</element>
|
||||
</Path>
|
||||
<UnOp>
|
||||
<element>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,2 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "testCharSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
001|Axis_01_Load |NUM
|
||||
002|Axis_02_Load |NUM
|
||||
003|Axis_03_Load |NUM
|
||||
004|Axis_04_Load |NUM
|
||||
005|Axis_05_Load |NUM
|
||||
006|Axis_06_Load |NUM
|
||||
001|Spindle_Load |NUM
|
||||
@@ -1,35 +1,24 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "testCharSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
001|ACC_TIME |HOURS
|
||||
002|ACC_TIME_WORK |HOURS
|
||||
003|Path_01_PZ_TOT |COUNT
|
||||
004|Axis_01_DistDone |METER
|
||||
005|Axis_01_Invers |COUNT
|
||||
006|Axis_02_DistDone |METER
|
||||
007|Axis_02_Invers |COUNT
|
||||
008|Axis_03_DistDone |METER
|
||||
009|Axis_03_Invers |COUNT
|
||||
010|Axis_04_DistDone |COUNT
|
||||
011|Axis_04_Invers |COUNT
|
||||
012|Axis_05_DistDone |COUNT
|
||||
013|Axis_05_Invers |COUNT
|
||||
014|Axis_06_DistDone |METER
|
||||
015|Axis_06_Invers |COUNT
|
||||
016|UnOp_01_AccTime |COUNT
|
||||
017|VacPump_01_WrkTime |HOURS
|
||||
018|VacPump_02_WrkTime |HOURS
|
||||
019|VacAct_01_Count |COUNT
|
||||
020|VacAct_02_Count |COUNT
|
||||
021|Lubro_01_Num |COUNT
|
||||
022|SlittaTastatore_Count |COUNT
|
||||
023|ProtMagazzino_01_Count |COUNT
|
||||
024|ProtMagazzino_02_Count |COUNT
|
||||
025|UnOp_01_NumCambiUT |COUNT
|
||||
026|Axis_01_AccTime |COUNT
|
||||
027|Axis_02_AccTime |COUNT
|
||||
028|Axis_03_AccTime |COUNT
|
||||
029|Axis_04_AccTime |COUNT
|
||||
030|Axis_05_AccTime |COUNT
|
||||
031|Axis_06_AccTime |COUNT
|
||||
032|Counter_001 |COUNT
|
||||
033|Counter_002 |COUNT
|
||||
034|Counter_003 |COUNT
|
||||
#indice | NOME |UM |scala
|
||||
001|ACC_TIME |HOURS |1
|
||||
002|ACC_TIME_WORK |HOURS |1
|
||||
003|Counter_00 |COUNT |1
|
||||
004|Axis_01_DistDone |METER |1000000
|
||||
005|Axis_01_Invers |COUNT |1
|
||||
006|Axis_02_DistDone |METER |1000000
|
||||
007|Axis_02_Invers |COUNT |1
|
||||
008|Axis_03_DistDone |METER |1000000
|
||||
009|Axis_03_Invers |COUNT |1
|
||||
010|Axis_04_DistDone |COUNT |360000000
|
||||
011|Axis_04_Invers |COUNT |1
|
||||
012|Axis_05_DistDone |COUNT |360000000
|
||||
013|Axis_05_Invers |COUNT |1
|
||||
014|TIME_WORK_NO_WATER |HOURS |1
|
||||
015|Counter_01 |COUNT |1
|
||||
016|UnOp_01_KRev |COUNT |1000
|
||||
017|Counter_02 |COUNT |1
|
||||
018|Counter_03 |COUNT |1
|
||||
019|VacAct_01_Count |COUNT |1
|
||||
020|Manip_Pistons |COUNT |1
|
||||
021|Lubro_01_Num |COUNT |1
|
||||
022|SlittaTastatore_Count |COUNT |1
|
||||
@@ -0,0 +1,199 @@
|
||||
<ModelDesign>
|
||||
<Machine>
|
||||
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="ANTARES26/15-PX5" />
|
||||
<Property SymbolicName="Manufacturer" BrowseName="Manufacturer" DataType="ua:String" ValueRank="Scalar" Value="CMS Industries" />
|
||||
<Property SymbolicName="Serial" BrowseName="Serial" DataType="ua:String" ValueRank="Scalar" Value="9206" />
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="CNC_MACHINE" />
|
||||
<Property SymbolicName="BuildYear" BrowseName="BuildYear" DataType="ua:String" ValueRank="Scalar" Value="2019" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Alarm" BrowseName="Alarm" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
|
||||
<Variable SymbolicName="Emergency" BrowseName="Emergency" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
|
||||
<Variable SymbolicName="Power" BrowseName="Power" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="001" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="ActiveWorkingTime" BrowseName="ActiveWorkingTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="002" CmsDataOpt="HOURS" />
|
||||
|
||||
<Component Name="Cnc">
|
||||
<!--<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="SIEMENS" />-->
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="OSAI" />
|
||||
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2019" />
|
||||
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
|
||||
<Component Name="CncProcesses">
|
||||
<Component Name="01">
|
||||
<Variable SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="CodG" BrowseName="CodG" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CodM" BrowseName="CodM" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CodS" BrowseName="CodS" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CodT" BrowseName="CodT" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:String" ValueRank="Scalar" Units="m/min" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="SubMode" BrowseName="SubMode" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="Plc">
|
||||
<!--<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="SIEMENS" />-->
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="OSAI" />
|
||||
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2019" />
|
||||
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
|
||||
</Component>
|
||||
<Component Name="Hmi">
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="CMS Active" />
|
||||
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="1.00.02" />
|
||||
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
|
||||
<Variable SymbolicName="User" BrowseName="User" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="Language" BrowseName="Language" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="ActiveSection" BrowseName="ActiveSection" DataType="ua:String" ValueRank="Scalar" Units="h" />
|
||||
<Variable SymbolicName="ActiveTimeSession" BrowseName="ActiveTimeSession" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
</Component>
|
||||
<Component Name="Axes">
|
||||
<Component Name="01">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="X" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="026" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="001" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="005" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="004" CmsDataOpt="METER"/>
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="02">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="Y" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="027" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="002" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="007" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" CmsDataType="CounterList" CmsDataIndex="006" CmsDataOpt="METER" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="03">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="Z" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="028" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="003" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="009" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="008" CmsDataOpt="METER" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="04">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="B" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="029" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="004" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="011" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="KRev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="010" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="rpm/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="05">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="C" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="030" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="005" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="013" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="KRev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="012" CmsDataOpt="NUM"/>
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="rpm/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="06">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="V" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="SLAVE" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="031" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="006" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="015" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="014" CmsDataOpt="METER"/>
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="OperatingGroups">
|
||||
<Component Name="01">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SPINDLE" />
|
||||
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="CMS-SPINDLE-01" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="006" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Krev" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="SpeedRate" BrowseName="SpeedRate" DataType="ua:UInt32" ValueRank="Scalar" Units="rpm" />
|
||||
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="025" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="ToolId" BrowseName="ToolId" DataType="ua:Float" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="AuxiliaryGroups">
|
||||
<Component Name="01">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LUBRO" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="021" CmsDataOpt="NUM" />
|
||||
</Component>
|
||||
<Component Name="02">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="VACUUM_PUMP" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="002" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="017" CmsDataOpt="HOURS" />
|
||||
</Component>
|
||||
<Component Name="03">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="VACUUM_ACT" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="019" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="TestData" BrowseName="TestData" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="017" CmsDataOpt="RTV" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="ProductionProcesses">
|
||||
<Component Name="01">
|
||||
<Component Name="Programs">
|
||||
<Component Name="01">
|
||||
<Variable SymbolicName="RepsDone" BrowseName="RepsDone" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="003" CmsDataOpt="NUM" />
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
</Machine>
|
||||
</ModelDesign>
|
||||
@@ -0,0 +1,271 @@
|
||||
<ModelDesign>
|
||||
<Machine>
|
||||
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="KOSMOS" />
|
||||
<Property SymbolicName="Manufacturer" BrowseName="Manufacturer" DataType="ua:String" ValueRank="Scalar" Value="CMS Industries" />
|
||||
<Property SymbolicName="Serial" BrowseName="Serial" DataType="ua:String" ValueRank="Scalar" Value="B921" />
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="CNC_MACHINE" />
|
||||
<Property SymbolicName="BuildYear" BrowseName="BuildYear" DataType="ua:String" ValueRank="Scalar" Value="2021" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Alarm" BrowseName="Alarm" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
|
||||
<Variable SymbolicName="Emergency" BrowseName="Emergency" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
|
||||
<Variable SymbolicName="Power" BrowseName="Power" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="001" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="ActiveWorkingTime" BrowseName="ActiveWorkingTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="002" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Counter_001" BrowseName="ActiveWorkingTimeNoWater" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="014" CmsDataOpt="HOURS" />
|
||||
<!--<Variable SymbolicName="RTCounter_001" BrowseName="ContaPzTav1" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="060" CmsDataOpt="NUM" />-->
|
||||
<Component Name="Cnc">
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="ESAGVCMS" />
|
||||
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2020" />
|
||||
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
|
||||
<Component Name="CncProcesses">
|
||||
<Component Name="01">
|
||||
<Variable SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="CodG" BrowseName="CodG" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CodM" BrowseName="CodM" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CodS" BrowseName="CodS" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CodT" BrowseName="CodT" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:String" ValueRank="Scalar" Units="m/min" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<!--<Variable SymbolicName="SubMode" BrowseName="SubMode" DataType="ua:String" ValueRank="Scalar" Units="" />-->
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="Plc">
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="ESA" />
|
||||
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2020" />
|
||||
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
|
||||
</Component>
|
||||
<Component Name="Hmi">
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="CMS Active Saw" />
|
||||
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="8.00" />
|
||||
<Property SymbolicName="SerialNum" BrowseName="SerialNum" DataType="ua:String" ValueRank="Scalar" Value="B921" />
|
||||
<!--<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
|
||||
<Variable SymbolicName="User" BrowseName="User" DataType="ua:String" ValueRank="Scalar" Units="" />
|
||||
<Variable SymbolicName="Language" BrowseName="Language" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="ActiveSection" BrowseName="ActiveSection" DataType="ua:String" ValueRank="Scalar" Units="h" />
|
||||
<Variable SymbolicName="ActiveTimeSession" BrowseName="ActiveTimeSession" DataType="ua:String" ValueRank="Scalar" Units="" />-->
|
||||
</Component>
|
||||
<Component Name="Axes">
|
||||
<Component Name="01">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="X" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="030" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Amp" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="005" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="004" CmsDataOpt="METER" CmsDataScale="1000000" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="02">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="Y" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="031" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Amp" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="007" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" CmsDataType="CounterList" CmsDataIndex="006" CmsDataOpt="METER" CmsDataScale="1000000" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="03">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="Z" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="032" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Amp" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="009" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="008" CmsDataOpt="METER" CmsDataScale="1000000" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="04">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="A" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="033" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<!--<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Amp" />-->
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="Deg" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="Deg" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="011" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Rev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="010" CmsDataOpt="COUNT" CmsDataScale="360000"/>
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="Rpm/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
<Component Name="05">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
|
||||
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="C" />
|
||||
<Property SymbolicName="Role" BrowseName="Role" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
|
||||
<Property SymbolicName="MasterId" BrowseName="MasterId" DataType="ua:String" ValueRank="Scalar" Value="0" />
|
||||
<Property SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Value="1" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="034" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Amp" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="Deg" SGroup="2" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="Deg" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="013" CmsDataOpt="COUNT"/>
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Rev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="012" CmsDataOpt="COUNT" CmsDataScale="360000" />
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="Rpm/min" SGroup="4" DBand="1" VGroup="P" />
|
||||
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="OperatingGroups">
|
||||
<Component Name="01">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SPINDLE" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Head 1" />
|
||||
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="ND" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="015" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="Krev" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="COUNT" CmsDataScale="1000" />
|
||||
<Variable SymbolicName="SpeedRate" BrowseName="SpeedRate" DataType="ua:UInt32" ValueRank="Scalar" Units="rpm" />
|
||||
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="001" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="ToolId" BrowseName="ToolId" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="036" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="060" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="AuxiliaryGroups">
|
||||
<Component Name="01">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="PROTECTION" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Machine" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="001" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="02">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_R_Dwn" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_R" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="002" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="03">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_R_High" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_R" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="003" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="04">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_L_Dwn" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_L" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="004" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="05">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_L_High" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Manip_Piston_L" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="005" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="06">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Manip_Slab_Present" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Manip_Slab" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="006" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="07">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="CamClosed" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Camera" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="007" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="08">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Vacuum" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Machine" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="008" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="019" CmsDataOpt="COUNT" />
|
||||
</Component>
|
||||
<Component Name="09">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Water_Disab" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Machine" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="009" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="10">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Zcollision_Disab" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Machine" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="010" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
<Component Name="11">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="Manip_Pistons" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="020" CmsDataOpt="COUNT" />
|
||||
</Component>
|
||||
<Component Name="12">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LUBRO" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="021" CmsDataOpt="COUNT" />
|
||||
</Component>
|
||||
<Component Name="13">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SlittaTastatore" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="022" CmsDataOpt="COUNT" />
|
||||
</Component>
|
||||
<Component Name="14">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="WJ_HEAD" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="WJ_Head" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="016" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="024" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="OrificeTime" BrowseName="OrificeTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="023" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="FocuserTime" BrowseName="FocuserTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="029" CmsDataOpt="HOURS" />
|
||||
<Variable SymbolicName="InsertTime" BrowseName="InsertTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="028" CmsDataOpt="HOURS" />
|
||||
</Component>
|
||||
<Component Name="15">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="HOPPER" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Hopper" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="017" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="Amount" BrowseName="Amount" DataType="ua:Float" ValueRank="Scalar" Units="Kg" CmsDataType="CounterList" CmsDataIndex="026" CmsDataOpt="COUNT" CmsDataScale="1000" />
|
||||
<Variable SymbolicName="HopperSpeed" BrowseName="HopperSpeed" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="038" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="HopperTime" BrowseName="HopperTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="025" CmsDataOpt="HOURS" />
|
||||
</Component>
|
||||
<Component Name="16">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="INTENSIFIER" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="Intensifier" />
|
||||
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="018" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="Pressure" BrowseName="Pressure" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="037" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="IntensTime" BrowseName="IntensTime" DataType="ua:UInt32" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="027" CmsDataOpt="HOURS" />
|
||||
</Component>
|
||||
|
||||
<Component Name="17">
|
||||
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="TOOL" />
|
||||
<Property SymbolicName="Location" BrowseName="Location" DataType="ua:String" ValueRank="Scalar" Value="ToolInfo" />
|
||||
<Variable SymbolicName="ToolNumber" BrowseName="ToolNumber" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="036" CmsDataOpt="NUM" />
|
||||
<Variable SymbolicName="DiskTool" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="011" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="DrillTool" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="012" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="RouterTool" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="013" CmsDataOpt="BIT" />
|
||||
<Variable SymbolicName="WaterJet" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="014" CmsDataOpt="BIT" />
|
||||
</Component>
|
||||
</Component>
|
||||
<!-- G480 C(0/1/-1) da mettere nei programmi ISO -->
|
||||
<Component Name="ProductionProcesses">
|
||||
<Component Name="01">
|
||||
<Variable SymbolicName="Notification" BrowseName="Notification" DataType="ua:String" ValueRank="Scalar" Units="" CmsDataType="StringData" CmsDataIndex="02" />
|
||||
<Component Name="Programs">
|
||||
<Component Name="01">
|
||||
<Variable SymbolicName="RepsDone" BrowseName="RepsDone" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="003" CmsDataOpt="RTV" />
|
||||
<Variable SymbolicName="RepsTarget" BrowseName="RepsTarget" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="035" CmsDataOpt="COUNT" />
|
||||
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="" CmsDataType="StringData" CmsDataIndex="01" />
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
<!-- </Component> -->
|
||||
<!-- </Component> -->
|
||||
</Machine>
|
||||
</ModelDesign>
|
||||
@@ -52,11 +52,13 @@ CollisionIndex=6.L
|
||||
PlcDelay=50
|
||||
|
||||
; <-- deve essere produzione?!? o che valore?
|
||||
SysLink=SIMULATO ; in versione test/simulazione/sviluppo
|
||||
;SysLink=NETWORK ; in versione reale/produzione
|
||||
; in versione test/simulazione/sviluppo
|
||||
SysLink=SIMULATO
|
||||
; in versione reale/produzione
|
||||
;SysLink=NETWORK
|
||||
|
||||
; modificato
|
||||
SysDefCn=C:\KVARA\DISCOI
|
||||
SysDefCn=C:\KVARA\CNC\C
|
||||
;SysDefCn=I:
|
||||
|
||||
|
||||
@@ -65,14 +67,24 @@ SysDefCn=C:\KVARA\DISCOI
|
||||
; modo sincronizzato con il plc
|
||||
;PlcSyncAddress=2103
|
||||
|
||||
;CONFIGURAZIONE DELLE AREE DI MEMORIA IOT (dimensioni vari array...)
|
||||
IOT_AreaAddressByte=IOT.BYTE
|
||||
IOT_AreaAddressWord=IOT.WORD
|
||||
IOT_AreaAddressDWord=IOT.DWORD
|
||||
IOT_AreaAddressStringA=IOT.ProgramNameAreaA
|
||||
IOT_AreaAddressStringB=IOT.ProgramNameAreaB
|
||||
IOT_AreaAddressStringC=IOT.ProgramNameAreaC
|
||||
IOT_AreaAddressStringD=IOT.ProgramNameAreaD
|
||||
; CONF aree di memoria SCMA
|
||||
SCMA_AreaAddress_ACK=scma.ACK
|
||||
SCMA_AreaAddress_STROBE=scma.STROBE
|
||||
SCMA_AreaAddress_ST=scma.ST
|
||||
SCMA_AreaAddress_MS=scma.MS
|
||||
SCMA_AreaAddress_ALM=scma.ALM
|
||||
SCMA_AreaAddress_MNT=scma.MNT
|
||||
SCMA_AreaAddress_CNT=scma.CNT
|
||||
SCMA_AreaAddress_SM=scma.SM
|
||||
SCMA_AreaAddress_WD=scma.WD
|
||||
SCMA_AreaAddress_MF=scma.MF
|
||||
SCMA_AreaAddress_SF=scma.SF
|
||||
SCMA_AreaAddress_TF=scma.TF
|
||||
SCMA_AreaAddress_MNUM=scma.MNUM
|
||||
SCMA_AreaAddress_SNUM=scma.SNUM
|
||||
SCMA_AreaAddress_TNUM=scma.TNUM
|
||||
SCMA_AreaAddress_OVR=scma.OVR
|
||||
SCMA_AreaAddress_status=scma.status
|
||||
|
||||
[XILOG]
|
||||
Enable=1
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
004:[COD 004] - MANUTENZIONE
|
||||
005:[COD 005] - PULIZIA
|
||||
006:[COD 006] - REGOLAZIONI
|
||||
007:[COD 007] - PIPPO
|
||||
007:[COD 007] - PIPPO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "testCharSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
001|IOT_PGMID_A1 |STRING
|
||||
002|IOT_PGMID_A2 |STRING
|
||||
003|IOT_PGMID_A3 |STRING
|
||||
004|IOT_PGMID_A4 |STRING
|
||||
1 001|IOT_PGMID_A1 |STRING
|
||||
2 002|IOT_PGMID_A2 |STRING
|
||||
3 003|IOT_PGMID_A3 |STRING
|
||||
4 004|IOT_PGMID_A4 |STRING
|
||||
@@ -0,0 +1,15 @@
|
||||
#------------------------------------------------------------
|
||||
# CONFIGURAZIONE per funzionalità di copia dati tra are di memoria REDIS
|
||||
#------------------------------------------------------------
|
||||
# - commenti con "#"
|
||||
# - elenco tipo NOME_ORIGINALE | NomeReplaced
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Elenco
|
||||
#------------------------------------------------------------
|
||||
ACTIVE:ProductionProcesses:01:Name|SOUR:ProductionProcesses:01:Name
|
||||
ACTIVE:ProductionProcesses:01:RepsTarget|SOUR:ProductionProcesses:01:RepsTarget
|
||||
ACTIVE:ProductionProcesses:01:RepsDone|SOUR:ProductionProcesses:01:RepsDone
|
||||
ACTIVE:ProductionProcesses:01:ProgramName|SOUR:ProductionProcesses:01:Programs:01:Name
|
||||
ACTIVE:ProductionProcesses:01:Notification|SOUR:ProductionProcesses:01:Notification
|
||||
@@ -0,0 +1,75 @@
|
||||
#------------------------------------------------------------
|
||||
# CONFIGURAZIONE SOSTITUZIONE CHIAVI per OPC-UA-REDIS
|
||||
#------------------------------------------------------------
|
||||
# - commenti con "#"
|
||||
# - elenco tipo MODO | RICERCA | NOME_ORIGINALE | NomeReplaced
|
||||
# - se MODO = A --> INCLUDO
|
||||
# - se MODO = X --> ESCLUDO
|
||||
# - se RICERCA= I --> cerco INTERA STRINGA (regexp: VAR)
|
||||
# - se RICERCA= B --> cerco INIZIO (regexp: ^VAR)
|
||||
# - se RICERCA= E --> cerco FINE (regexp: VAR$)
|
||||
# - se RICERCA= C --> cerco NELLA STRINGA(regexp: %VAR%)
|
||||
|
||||
#------------------------------------------------------------
|
||||
# I: Ricerca stringa COMPLETA (IDENTICAL, regexp: VAR)
|
||||
#------------------------------------------------------------
|
||||
A|I|STATUS|Status
|
||||
A|I|E_STOP|Emergency
|
||||
A|I|POWER|Power
|
||||
A|I|ACC_TIME|ActiveTime
|
||||
A|I|ACC_TIME_WORK|ActiveWorkingTime
|
||||
|
||||
A|I|PROC_SEL|ProcSel
|
||||
A|I|CodG_ACT|CodGAct
|
||||
A|I|USER_ACTION|UserAction
|
||||
|
||||
#------------------------------------------------------------
|
||||
# B: Ricerca dall'INIZIO stringa (BEGIN, regexp: ^VAR)
|
||||
#------------------------------------------------------------
|
||||
A|B|AV_|
|
||||
A|B|ST_|
|
||||
A|B|UNK_|Unk
|
||||
A|B|Path|Cnc:CncProcesses
|
||||
A|B|Axis|Axes
|
||||
|
||||
#------------------------------------------------------------
|
||||
# E: Ricerca dalla FINE stringa (END, regexp: VAR$)
|
||||
#------------------------------------------------------------
|
||||
A|E|RUN_MODE|RunMode
|
||||
A|E|EXE_MODE|ExeMode
|
||||
A|E|COD_M|CodM
|
||||
A|E|COD_S|CodS
|
||||
A|E|COD_T|CodT
|
||||
A|E|Cod_M|CodM
|
||||
A|E|Cod_S|CodS
|
||||
A|E|Cod_T|CodT
|
||||
A|E|CodG_Act|CodGAct
|
||||
A|E|PZ_TOT|PzTot
|
||||
A|E|CurrProg_RowNum|CurrProgRowNum
|
||||
|
||||
#------------------------------------------------------------
|
||||
# C: Ricerca NELLA stringa (CONTAINS, regexp: %VAR%)
|
||||
#------------------------------------------------------------
|
||||
A|C|SpindleOver_|SpindleOver
|
||||
|
||||
#------------------------------------------------------------
|
||||
# X: Rimuovo valori NON OPC/UA
|
||||
#------------------------------------------------------------
|
||||
X|B|UNK_|Unk
|
||||
X|B|MTC_asset|MTCAsset
|
||||
X|B|TESTING|TESTING
|
||||
X|E|VitaRes|VitaRes
|
||||
X|E|VitaResType|VitaResType
|
||||
X|E|PosActX|PosActX
|
||||
X|E|PosActY|PosActY
|
||||
X|E|PosActZ|PosActZ
|
||||
X|E|PosActI|PosActI
|
||||
X|E|PosActJ|PosActJ
|
||||
X|E|PosActK|PosActK
|
||||
X|E|PartId|PartId
|
||||
X|E|PZ_TOT|PZ_TOT
|
||||
X|E|CurrArea|CurrArea
|
||||
|
||||
# elimino counter/RTCounter di cui ignoro impiego...
|
||||
#X|B|RTCounter|RTCounter
|
||||
#X|B|Counter|Counter
|
||||
@@ -1,7 +1,15 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "testCharSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
001|PROTECTION_STATUS |BIT
|
||||
002|VacPump_01_Status |BIT
|
||||
003|VacPump_02_Status |BIT
|
||||
004|Cooler_01_Status |BIT
|
||||
005|Cooler_02_Status |BIT
|
||||
006|UnOp_01_Status |BIT
|
||||
002|Manip_Piston_R_Dwn |BIT
|
||||
003|Manip_Piston_R_High |BIT
|
||||
004|Manip_Piston_L_Dwn |BIT
|
||||
005|Manip_Piston_L_High |BIT
|
||||
006|Manip_Slab_Present |BIT
|
||||
007|CamClosed |BIT
|
||||
008|Vacuum_On |BIT
|
||||
009|Water_Disab |BIT
|
||||
010|Zcollision_Disab |BIT
|
||||
011|CurrTool_Disk |BIT
|
||||
012|CurrTool_Drill |BIT
|
||||
013|CurrTool_Router |BIT
|
||||
014|CurrTool_WJ |BIT
|
||||
@@ -0,0 +1,5 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "testCharSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
1 001|scma_scmastring_tag |STRING
|
||||
2 002|scma_scmastring_tag |STRING
|
||||
3 003|scma_scmastring_tag |STRING
|
||||
4 004|scma_scmastring_tag |STRING
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user