met 80% HP07 alarm

This commit is contained in:
Luc 2021-06-14 09:09:15 +02:00
parent 5ef70f2e8a
commit af6a9d5836
8 changed files with 247 additions and 23 deletions

View file

@ -74,7 +74,9 @@ Epd3Base::Epd3U::Epd3U(int _comport)
Hp10Peak = Hp07Peak = 0;
Hp10Time = Hp07Time = 0;
Hp10FTime = Hp07FTime = 0;
Hp07THDose = 0; Hp07RateOn = 0; Hp07RateOff = 0;
Hp07THDoseA = 0; Hp07RateAOn = 0; Hp07RateAOff = 0;
Hp10THDose1 = 0; Hp10Rate1On = 0; Hp10Rate1Off = 0;
Hp10THDose2 = 0; Hp10Rate2On = 0; Hp10Rate2Off = 0;
@ -233,7 +235,6 @@ BYTE checkStatus(FaultStatusFlags status, FaultStatusFlags flag)
{
if (((uint32_t)status & (uint32_t)flag) == (uint32_t)flag) return 1; else return 0;
}
BYTE checkStatus(AlarmStatusFlags status, AlarmStatusFlags flag)
{
uint32_t ustatus = (uint32_t)status;
@ -566,7 +567,8 @@ void Epd3Base::Epd3U::decodeTreshold(Mk3AlarmThresholds_t* th)
Hp07THDose = 0; Hp07RateOn = 0; Hp07RateOff = 0;
pThDose = &Hp07THDose;
pThRate = &Hp07RateOn;
pTHDoseWarning = pTHRateWarning = nullptr;
pTHDoseWarning = &Hp07THDoseA;
pTHRateWarning = &Hp07RateAOn;
break;
case MeasurementId::Meas_Hp10:
Hp10THDose1 = 0; Hp10THDose2 = 0;
@ -592,15 +594,18 @@ void Epd3Base::Epd3U::encodeTreshold(Mk3AlarmThresholds_t* th)
{
//th.MeasId
float* pThDose, * pThRate, * pTHDoseWarning, * pTHRateWarning;
//Voorlopig
Hp07THDoseA = Hp07THDose * 0.8;
Hp07RateAOn = Hp07RateOn * 0.8;
// einde voorlopig
th->NumberThresholds = 4;
switch ((MeasurementId)th->MeasId) {
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
pThDose = &Hp07THDose;
pTHDoseWarning = &Hp07THDose;
pTHDoseWarning = &Hp07THDoseA;
pThRate = &Hp07RateOn;
pTHRateWarning = &Hp07RateOff;
pTHRateWarning = &Hp07RateAOn;
RatePct[0].MeasId = th->MeasId;
RatePct[0].Value = 85; // (int)(Hp07RateOff * 100.0 / Hp07RateOn);
break;
@ -615,9 +620,9 @@ void Epd3Base::Epd3U::encodeTreshold(Mk3AlarmThresholds_t* th)
break;
default:
pThDose = &Hp07THDose;
pTHDoseWarning = &Hp07THDose;
pTHDoseWarning = &Hp07THDoseA;
pThRate = &Hp07RateOn;
pTHRateWarning = &Hp07RateOff;
pTHRateWarning = &Hp07RateAOn;
}
th->Thresholds[0].Id = (uint16_t)ThresholdId::Thres_DoseAlarm;
@ -925,7 +930,7 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07;
hp07tresholds.MeasId = measID;
encodeTreshold(&hp07tresholds);
hp07tresholds.NumberThresholds = 2;
hp07tresholds.NumberThresholds = 4;
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, (uint8_t)hp07tresholds.NumberThresholds, hp07tresholds.Thresholds, nullptr);
r = Commit3(epdComsHandle);
if (r != 0)
@ -934,7 +939,6 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
if (r != 0)
goto error;
token = BeginWriteRateOffPercentage(epdComsHandle, RatePct, 2, nullptr);
r = Commit3(epdComsHandle);
if (r != 0)

View file

@ -138,14 +138,17 @@ namespace Epd3Base {
//AlarmDoseTreshold
float Hp10THDose1;
float Hp10THDose2;
float Hp07THDoseA; //Alarm
float Hp07THDose;
float Hp10Rate1On;
float Hp10Rate2On;
float Hp07RateOn;
float Hp07RateAOn;
float Hp10Rate1Off;
float Hp10Rate2Off;
float Hp07RateOff;
float Hp07RateAOff;
float K1;

39
eDosPrep/eDosPrep.cpp Normal file
View file

@ -0,0 +1,39 @@
// eDosPrep.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <Windows.h>
#include <lmaccess.h>
#include <iostream>
#pragma comment(lib, "netapi32.lib")
USER_INFO_1 ui;
DWORD parm_err;
const wchar_t *n = L"eDosStation";
const wchar_t* p = L"HPHEdos123";
int CreateUser()
{
memset(&ui, 0, sizeof(ui));
ui.usri1_name = (LPWSTR)n;
ui.usri1_password = (LPWSTR)p;
ui.usri1_priv = USER_PRIV_USER;
ui.usri1_flags = UF_DONT_EXPIRE_PASSWD;
DWORD rv = NetUserAdd(NULL,1,(LPBYTE)&ui,&parm_err );
return rv;
}
int main()
{
CreateUser();
std::cout << "Hello World!\n";
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file

147
eDosPrep/eDosPrep.vcxproj Normal file
View file

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{294068af-ea7b-4851-97b2-2ab5f64167d9}</ProjectGuid>
<RootNamespace>eDosPrep</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="eDosPrep.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="eDosPrep.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestEPD3Dll", "TestEPD3Dll\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Epd3Base", "EpdBase3\EpdBase3.vcxproj", "{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eDosPrep", "eDosPrep\eDosPrep.vcxproj", "{294068AF-EA7B-4851-97B2-2AB5F64167D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -245,6 +247,20 @@ Global
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x64.Build.0 = Release|x64
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x86.ActiveCfg = Release|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x86.Build.0 = Release|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|Any CPU.ActiveCfg = Debug|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|ARM.ActiveCfg = Debug|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|ARM64.ActiveCfg = Debug|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|x64.ActiveCfg = Debug|x64
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|x64.Build.0 = Debug|x64
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|x86.ActiveCfg = Debug|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Debug|x86.Build.0 = Debug|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|Any CPU.ActiveCfg = Release|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|ARM.ActiveCfg = Release|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|ARM64.ActiveCfg = Release|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x64.ActiveCfg = Release|x64
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x64.Build.0 = Release|x64
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x86.ActiveCfg = Release|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -357,7 +357,7 @@ namespace eDosStation
u.VisitIDLocked = 0;
u.ReasonNoAccess = "Not found";
u.UserComment = "";
u.AllOk = !CheckUser || (u.AccessAllow == true & u.VisitIDLocked == 0);
u.AllOk = !CheckUser || (u.AccessAllow == true && u.VisitIDLocked == 0);
}
rs.Close();
}

View file

@ -24,17 +24,9 @@ namespace eDosStation
private System.Threading.Tasks.Task ReaderTask = null;
private DataInterface dataInterface;
public LSWDesfirePublic.CCard dfReader = null;
//System.Threading.Thread t;
//bool nextCSN = false;
//bool nextSite = false;
//bool nextCode = false;
//bool nextFinish = false;
//string csn, site, code;
static User _User;
DataSet1.GetTaskInfoRow CurTaskRow;
private DateTime ResultTime;
enum eCOE { quiz = 1 };
#if SimulateEPD
@ -415,15 +407,16 @@ namespace eDosStation
else
boxComment.Visibility = Visibility.Hidden;
if (!string.IsNullOrWhiteSpace(ReasonNoAccess)) UserAccess.Text = ReasonNoAccess;
else UserAccess.Text = "Welcome to eDOS";
if (!string.IsNullOrWhiteSpace(ReasonNoAccess))
UserAccess.Text = ReasonNoAccess;
else
//UserAccess.Text = "Welcome to eDOS";
Username.Text = string.Concat(_User.FirstName, " ", _User.LastName);
pUserSeconds.Maximum = UserSeconds; pUserSeconds.Value = UserSeconds;
tReasonNoAccess.Text = ReasonNoAccess;
dispatcherTimer = new DispatcherTimer(DispatcherPriority.Background);
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Tick += SwitchToTask;
dispatcherTimer.Start();
}
return doCancel;
@ -440,7 +433,7 @@ namespace eDosStation
{
dispatcherTimer.Stop();
dispatcherTimer.Tick -= SwitchToTask;
if (_User.AccessAllow == true)
if (_User.AllOk == true)
AskTask();
else Close();
}
@ -602,7 +595,7 @@ namespace eDosStation
{
dispatcherTimer.Stop();
dispatcherTimer.Tick -= SwitchToTask;
if (_User.AccessAllow == true)
if (_User.AllOk == true)
AskTask();
else Close();
}