Merge branch 'release/ModBusMinMaxDisconnect'
This commit is contained in:
+165
@@ -0,0 +1,165 @@
|
||||
variables:
|
||||
NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
||||
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
||||
DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
||||
NEXUS_PATH: 'MAPO/IOB-WIN-NEXT'
|
||||
APP_NAME: 'IOB-WIN-NEXT'
|
||||
VERS_MAIN: '3.5'
|
||||
NEW_REL: ''
|
||||
OUTPUT_DIR: ''
|
||||
|
||||
# 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)
|
||||
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
|
||||
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
|
||||
$newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
|
||||
echo "Set vers: $env:NEW_REL"
|
||||
|
||||
# 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"
|
||||
$Source = "$env:APP_NAME\bin\*"
|
||||
7zip a -tzip $Target $Source
|
||||
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"
|
||||
|
||||
# helper x send su NEXUS
|
||||
# $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
|
||||
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
||||
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".md5" https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".md5"
|
||||
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".sha1" https://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".sha1"
|
||||
.nexusUpload: &nexusUpload
|
||||
- |
|
||||
Set-Alias mCurl C:\Windows\system32\curl.exe
|
||||
if($CI_COMMIT_BRANCH -eq "master")
|
||||
{
|
||||
$version = "stable"
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = "unstable"
|
||||
}
|
||||
$File2Send = "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
|
||||
}
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
|
||||
|
||||
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
||||
|
||||
stages:
|
||||
- build
|
||||
# - deploy
|
||||
|
||||
# IOB:build:
|
||||
# stage: build
|
||||
# tags:
|
||||
# - win
|
||||
# variables:
|
||||
# APP_NAME: IOB-WIN
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'
|
||||
# - *version-fix
|
||||
# script:
|
||||
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
|
||||
IOB-NEXT:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: IOB-WIN-NEXT
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- echo "Chiamata comando nuget-restore"
|
||||
- echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'"
|
||||
# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"'
|
||||
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
|
||||
- *version-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
|
||||
# IOB:deploy:
|
||||
# stage: deploy
|
||||
# tags:
|
||||
# - win
|
||||
# variables:
|
||||
# APP_NAME: IOB-WIN
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'
|
||||
# - *version-fix
|
||||
# - *cleanup-zip
|
||||
# script:
|
||||
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
# - *zipper
|
||||
# - *hashBuild
|
||||
# - *nexusUpload
|
||||
# needs: ["IOB:build"]
|
||||
|
||||
# IOB-NEXT:deploy:
|
||||
# stage: deploy
|
||||
# tags:
|
||||
# - win
|
||||
# variables:
|
||||
# APP_NAME: IOB-WIN-NEXT
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - echo "Chiamata comando nuget-restore"
|
||||
# - echo "'& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'"
|
||||
# - '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'
|
||||
# - *version-fix
|
||||
# - *cleanup-zip
|
||||
# script:
|
||||
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=Release /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
# - *zipper
|
||||
# - *hashBuild
|
||||
# - *nexusUpload
|
||||
# needs: ["IOB-NEXT:build"]
|
||||
Binary file not shown.
@@ -55,6 +55,8 @@ MAX_SEND_PZC_BLOCK=100
|
||||
; GEST DATI DYN
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
; gestione delta minimo accettabile tra min/MAX
|
||||
DELTA_VAL=0.1
|
||||
|
||||
; clock base (da 10ms)
|
||||
timerIntMs=100
|
||||
|
||||
@@ -55,6 +55,8 @@ MAX_SEND_PZC_BLOCK=100
|
||||
; GEST DATI DYN
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
; gestione delta minimo accettabile tra min/MAX
|
||||
DELTA_VAL=0.1
|
||||
|
||||
; clock base (da 10ms)
|
||||
timerIntMs=100
|
||||
|
||||
@@ -21,6 +21,15 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
public class IobModbusTCP : IobGeneric
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Valore delta x gestione min/MAX e valore rilevato
|
||||
/// </summary>
|
||||
private double deltaVal = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected ModbusClient currPLC;
|
||||
@@ -222,8 +231,8 @@ namespace IOB_WIN_NEXT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// verifica limite...
|
||||
dataOk = (valore > item.Value.minVal && valore < item.Value.maxVal);
|
||||
// verifica limite... con delta da impianto
|
||||
dataOk = (valore > (item.Value.minVal + deltaVal) && valore < (item.Value.maxVal - deltaVal));
|
||||
if (dataOk)
|
||||
{
|
||||
// moltiplico x fattore conversione...
|
||||
@@ -496,6 +505,12 @@ namespace IOB_WIN_NEXT
|
||||
parentForm.commPlcActive = false;
|
||||
// carico conf vettore memoria...
|
||||
loadMemConf();
|
||||
// aggiungo DELTA x calcolo min/MAX...
|
||||
string deltaValStr = getOptPar("DELTA_VAL");
|
||||
if (!string.IsNullOrEmpty(deltaValStr))
|
||||
{
|
||||
double.TryParse(deltaValStr, out deltaVal);
|
||||
}
|
||||
bool enableByApp = utils.CRB("enableContapezzi");
|
||||
bool enableByIob = (getOptPar("ENABLE_PZCOUNT") == "TRUE");
|
||||
bool disableByIob = (getOptPar("DISABLE_PZCOUNT") == "TRUE");
|
||||
@@ -686,6 +701,11 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
readErrorList = getDataDictionary(readErrorList, false, ref outVal);
|
||||
}
|
||||
// se avessi acnora errori --> disconnetto
|
||||
if (readErrorList.Count > 0)
|
||||
{
|
||||
tryDisconnect();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user