0822 Does not work
commit
a1981564a3
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?ccsproject version="1.0"?>
|
||||
<projectOptions>
|
||||
<deviceVariant value="TMS320C28XX.TMS320F28335"/>
|
||||
<deviceFamily value="C2000"/>
|
||||
<codegenToolVersion value="6.2.0"/>
|
||||
<isElfFormat value="false"/>
|
||||
<linkerCommandFile value="28335_RAM_lnk.cmd"/>
|
||||
<rts value="libc.a"/>
|
||||
<templateProperties value="id=com.ti.common.project.core.emptyProjectTemplate,"/>
|
||||
<isTargetManual value="false"/>
|
||||
<origin value="C:/CCSWorkSpaces/temp/DVRFramework"/>
|
||||
<connection value="common/targetdb/connections/TIXDS100v3_Dot7_Connection.xml"/>
|
||||
</projectOptions>
|
||||
@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="com.ti.ccstudio.buildDefinitions.C2000.Debug.2040603795">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.C2000.Debug.2040603795" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="out" artifactName="${SRC_ROOT}/sys/build/Debug/framework" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.C2000.Debug.2040603795" name="Debug" parent="com.ti.ccstudio.buildDefinitions.C2000.Debug">
|
||||
<folderInfo id="com.ti.ccstudio.buildDefinitions.C2000.Debug.2040603795." name="/" resourcePath="">
|
||||
<toolChain id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.DebugToolchain.830787211" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.linkerDebug.1778512584">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1197154302" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=TMS320C28XX.TMS320F28335"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_CORE_ID=C2800"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
|
||||
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=COFF"/>
|
||||
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||
<listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.5.0"/>
|
||||
<listOptionValue builtIn="false" value="LINK_ORDER=F28335.cmd;-lrts2800_fpu32.lib;"/>
|
||||
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=28335_RAM_lnk.cmd"/>
|
||||
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||
<listOptionValue builtIn="false" value="PRODUCTS="/>
|
||||
<listOptionValue builtIn="false" value="PRODUCT_MACRO_IMPORTS={}"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.624589266" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="21.6.0.LTS" valueType="string"/>
|
||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.targetPlatformDebug.1195867980" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.targetPlatformDebug"/>
|
||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.builderDebug.1484000353" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.builderDebug"/>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.compilerDebug.1731246565" name="C2000 Compiler" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.compilerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.LARGE_MEMORY_MODEL.2072485324" name="Option deprecated, set by default (--large_memory_model, -ml)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.LARGE_MEMORY_MODEL" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.UNIFIED_MEMORY.2020368090" name="Unified memory (--unified_memory, -mt)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.UNIFIED_MEMORY" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.SILICON_VERSION.200319597" name="Processor version (--silicon_version, -v)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.SILICON_VERSION.28" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.FLOAT_SUPPORT.1002982879" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.FLOAT_SUPPORT.fpu32" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.OPT_LEVEL.158333741" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.OPT_FOR_SPEED.1189713323" name="Speed vs. size trade-offs (--opt_for_speed, -mf)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.OPT_FOR_SPEED.5" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.FP_MODE.597990472" name="Floating Point mode (--fp_mode)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.FP_MODE" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.FP_MODE.relaxed" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.INCLUDE_PATH.910773204" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_ROOT}/sys/include"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_ROOT}/DSP2833x_headers/include"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_ROOT}/DSP2833x_common/include"/>
|
||||
<listOptionValue builtIn="false" value="${WORKSPACE_LOC}/FLOATPOINTLIB"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ADVICE__PERFORMANCE.1890281965" name="Provide advice on optimization techniques (--advice:performance)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ADVICE__PERFORMANCE" value="--advice:performance=all" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DEFINE.1385179336" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DEFINE" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="_DEBUG"/>
|
||||
<listOptionValue builtIn="false" value="LARGE_MODEL"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DEBUGGING_MODEL.451239249" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DIAG_WRAP.44979444" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DISPLAY_ERROR_NUMBER.320946418" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ISSUE_REMARKS.1678891727" name="Issue remarks (--issue_remarks, -pdr)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ISSUE_REMARKS" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.QUIET_LEVEL.1661022843" name="Quiet Level" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.QUIET_LEVEL" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.QUIET_LEVEL.QUIET" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ABI.2128235277" name="Application binary interface [See 'General' page to edit] (--abi)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ABI.coffabi" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ASM_LISTING.1104407996" name="Generate listing file (--asm_listing, -al)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.ASM_LISTING" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DISABLE_INLINING.31466939" name="Disable inlining (--disable_inlining)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compilerID.DISABLE_INLINING" value="false" valueType="boolean"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__C_SRCS.423959130" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__C_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__CPP_SRCS.447191296" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__CPP_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__ASM_SRCS.1088389375" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__ASM_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__ASM2_SRCS.274059361" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.compiler.inputType__ASM2_SRCS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.linkerDebug.1778512584" name="C2000 Linker" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exe.linkerDebug">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.STACK_SIZE.1215847210" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.STACK_SIZE" value="0x100" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.MAP_FILE.569103737" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.MAP_FILE" value=""${SRC_ROOT}/sys/build/Debug/framework.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.OUTPUT_FILE.167409769" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.OUTPUT_FILE" value="${SRC_ROOT}/sys/build/Debug/framework.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.HEAP_SIZE.60955433" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.HEAP_SIZE" value="0x100" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.LIBRARY.1339269017" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.LIBRARY" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="libc.a"/>
|
||||
<listOptionValue builtIn="false" value="${UTILITIES}/flash_api/2833x/28335/v210/lib/Flash28335_API_V210.lib"/>
|
||||
<listOptionValue builtIn="false" value="rts2800_fpu32.lib"/>
|
||||
<listOptionValue builtIn="false" value="rts2800_fpu32_fast_supplement.lib"/>
|
||||
<listOptionValue builtIn="false" value="${WORKSPACE_LOC}/FLOATPOINTLIB/Debug/FLOATPOINTLIB.lib"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.SEARCH_PATH.345223286" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/>
|
||||
<listOptionValue builtIn="false" value="${UTILITIES}/flash_api/2833x/28335/v210/lib"/>
|
||||
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
|
||||
<listOptionValue builtIn="false" value="${PROJECT_ROOT}"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_ROOT}/sys/build"/>
|
||||
<listOptionValue builtIn="false" value="${SRC_ROOT}/DSP2833x_headers/include"/>
|
||||
<listOptionValue builtIn="false" value="${FAST_FPU32_SUPPLEMENT}/lib"/>
|
||||
<listOptionValue builtIn="false" value="${WORKSPACE_LOC}/FLOATPOINTLIB/Debug"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.DIAG_WRAP.1827120485" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.DISPLAY_ERROR_NUMBER.728966569" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.XML_LINK_INFO.689360326" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exeLinker.inputType__CMD_SRCS.1717731033" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exeLinker.inputType__CMD_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exeLinker.inputType__CMD2_SRCS.1965417765" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exeLinker.inputType__CMD2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_21.6.exeLinker.inputType__GEN_CMDS.1435745153" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.exeLinker.inputType__GEN_CMDS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.C2000_21.6.hex.1661532341" name="C2000 Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.C2000_21.6.hex"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="SYSCTRL/AlgorithmWorkEntry.cpp|spi_rom_interface.c|digital_io.c|analog_in.c|pwm_interface.c|hsm.c|app_main.c|cmd/F28335.cmd|modbus_slave.c|analog_out.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="com.ti.ccstudio.buildDefinitions.C2000.Release.1688218530">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.C2000.Release.1688218530" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.C2000.Release.1688218530" name="Release" parent="com.ti.ccstudio.buildDefinitions.C2000.Release">
|
||||
<folderInfo id="com.ti.ccstudio.buildDefinitions.C2000.Release.1688218530." name="/" resourcePath="">
|
||||
<toolChain id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.ReleaseToolchain.1897835650" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.linkerRelease.114937104">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.116122469" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=TMS320C28XX.TMS320F28335"/>
|
||||
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=COFF"/>
|
||||
<listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.5.0"/>
|
||||
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=28335_RAM_lnk.cmd"/>
|
||||
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.116123921" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="6.2.0" valueType="string"/>
|
||||
<targetPlatform id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.targetPlatformRelease.1291109672" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.targetPlatformRelease"/>
|
||||
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.builderRelease.1360820187" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.builderRelease"/>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.compilerRelease.486955678" name="C2000 Compiler" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.compilerRelease">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.LARGE_MEMORY_MODEL.258118407" name="Use large memory model (--large_memory_model, -ml)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.LARGE_MEMORY_MODEL" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.UNIFIED_MEMORY.685177003" name="Unified memory (--unified_memory, -mt)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.UNIFIED_MEMORY" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.SILICON_VERSION.1089679905" name="Processor version (--silicon_version, -v)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.SILICON_VERSION.28" valueType="enumerated"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.FLOAT_SUPPORT.330649707" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.FLOAT_SUPPORT.fpu32" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DIAG_WARNING.202516022" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DIAG_WARNING" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value="225"/>
|
||||
</option>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DISPLAY_ERROR_NUMBER.861584018" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DIAG_WRAP.4729059" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.INCLUDE_PATH.277004018" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
|
||||
</option>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__C_SRCS.1379003288" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__C_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__CPP_SRCS.1178256257" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__CPP_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__ASM_SRCS.103330727" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__ASM_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__ASM2_SRCS.1730673654" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.compiler.inputType__ASM2_SRCS"/>
|
||||
</tool>
|
||||
<tool id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.linkerRelease.114937104" name="C2000 Linker" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exe.linkerRelease">
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.STACK_SIZE.835162724" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.STACK_SIZE" value="0x300" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.OUTPUT_FILE.1105468446" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.OUTPUT_FILE" useByScannerDiscovery="false" value="${ProjName}.out" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.MAP_FILE.1415258391" name="Input and output sections listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.XML_LINK_INFO.1998060963" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.DISPLAY_ERROR_NUMBER.1519711672" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||
<option id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.DIAG_WRAP.1448229379" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.SEARCH_PATH.1579599178" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/lib""/>
|
||||
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.LIBRARY.117696091" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.linkerID.LIBRARY" valueType="libs">
|
||||
<listOptionValue builtIn="false" value=""libc.a""/>
|
||||
</option>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exeLinker.inputType__CMD_SRCS.1278335248" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exeLinker.inputType__CMD_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exeLinker.inputType__CMD2_SRCS.81365331" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exeLinker.inputType__CMD2_SRCS"/>
|
||||
<inputType id="com.ti.ccstudio.buildDefinitions.C2000_6.2.exeLinker.inputType__GEN_CMDS.1350236437" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C2000_6.2.exeLinker.inputType__GEN_CMDS"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Framework.com.ti.ccstudio.buildDefinitions.C2000.ProjectType.1226128593" name="C2000" projectType="com.ti.ccstudio.buildDefinitions.C2000.ProjectType"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping">
|
||||
<project-mappings>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/>
|
||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
|
||||
</project-mappings>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="null.endianPreference"/>
|
||||
<storageModule moduleId="cpuFamily"/>
|
||||
</cproject>
|
||||
@ -0,0 +1,32 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/codecomposerstudio
|
||||
# Edit at https://www.gitignore.io/?templates=codecomposerstudio
|
||||
|
||||
### CodeComposerStudio ###
|
||||
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
# Generated build artifact directories
|
||||
Debug/
|
||||
Release/
|
||||
Flash/
|
||||
RAM/
|
||||
# Generated build artifacts
|
||||
makefile
|
||||
*.map
|
||||
*.mk
|
||||
*.opt
|
||||
*.pp
|
||||
*.xml
|
||||
# Generated directories
|
||||
.config/
|
||||
.launches/
|
||||
# Generated file used to help display error messages in the problems view
|
||||
.xdchelp
|
||||
# Uniflash session files
|
||||
*.uniflashsession
|
||||
.settings/
|
||||
targetConfigs/
|
||||
|
||||
# End of https://www.gitignore.io/api/codecomposerstudio
|
||||
@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>DVR500Framework</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.ti.ccstudio.core.ccsNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>app_main.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-ORIGINAL_PROJECT_ROOT/source/app_main.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Debug/framework.out</name>
|
||||
<type>1</type>
|
||||
<locationURI>EXTERNAL_BUILD_ARTIFACT</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_ADC_cal.asm</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_ADC_cal.asm</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_CodeStartBranch.asm</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_CodeStartBranch.asm</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_CpuTimers.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_CpuTimers.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_ECan.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-ORIGINAL_PROJECT_ROOT/source/DSP2833x_ECan.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_ECap.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_ECap.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_EPwm.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_EPwm.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_EQep.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_EQep.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_GlobalVariableDefs.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_headers/source/DSP2833x_GlobalVariableDefs.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_MemCopy.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_MemCopy.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_PieCtrl.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_PieCtrl.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_PieVect.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_PieVect.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_SWPrioritizedDefaultIsr.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_SWPrioritizedDefaultIsr.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_Sci.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_Sci.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_SysCtrl.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_SysCtrl.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_Xintf.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_Xintf.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/DSP2833x_usDelay.asm</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/DSP2833x_usDelay.asm</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/Date_ComBoard.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-ORIGINAL_PROJECT_ROOT/source/Date_ComBoard.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/Ecap2.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/Ecap2.c</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>F28335/Gpio.c</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-ORIGINAL_PROJECT_ROOT/DSP2833x_common/source/Gpio.c</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<variableList>
|
||||
<variable>
|
||||
<name>FAST_FPU32_SUPPLEMENT</name>
|
||||
<value>file:/C:/ti/controlSUITE/libs/math/FPUfastRTS/V100</value>
|
||||
</variable>
|
||||
<variable>
|
||||
<name>ORIGINAL_PROJECT_ROOT</name>
|
||||
<value>file:/C:/CCSWorkSpaces/Framework_500_Hz/sys/build/framework</value>
|
||||
</variable>
|
||||
<variable>
|
||||
<name>SRC_ROOT</name>
|
||||
<value>$%7BPARENT-3-ORIGINAL_PROJECT_ROOT%7D</value>
|
||||
</variable>
|
||||
<variable>
|
||||
<name>UTILITIES</name>
|
||||
<value>file:/C:/ti/controlSUITE/libs/utilities</value>
|
||||
</variable>
|
||||
</variableList>
|
||||
</projectDescription>
|
||||
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* AlertBase.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/AlertBase.h"
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlertBase::AlertBase():
|
||||
//m_mode(ALERT::AlertBase::UNDEFINED),
|
||||
m_time_sample(-1.0),
|
||||
m_level(FP_ZERO),
|
||||
m_period(FP_ZERO),
|
||||
m_timer(FP_ZERO)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
|
||||
/*
|
||||
AlertBase::mode_t AlertBase::get_mode() const
|
||||
{
|
||||
return m_mode;
|
||||
//
|
||||
}//get_mode()
|
||||
//
|
||||
|
||||
bool AlertBase::compare(mode_t mode) const
|
||||
{
|
||||
return m_mode == mode;
|
||||
//
|
||||
}//compare()
|
||||
//
|
||||
*/
|
||||
} /* namespace ALERT */
|
||||
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* AlertBase.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef ALERT_ALARMBASE_H_
|
||||
#define ALERT_ALARMBASE_H_
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
struct AlertBaseConfiguration
|
||||
{
|
||||
float level;
|
||||
float period;
|
||||
AlertBaseConfiguration():
|
||||
level(-1.0),
|
||||
period(-1.0)
|
||||
{}
|
||||
};//AlertBaseConfiguration
|
||||
|
||||
|
||||
class AlertBase
|
||||
{
|
||||
//public:
|
||||
// enum mode_t {UNDEFINED, CONFIGURATE, OPERATIONAL};
|
||||
//protected:
|
||||
// mode_t m_mode;
|
||||
protected:
|
||||
float m_time_sample;
|
||||
protected:
|
||||
float m_level;
|
||||
|
||||
protected:
|
||||
float m_period;
|
||||
float m_timer;
|
||||
//public:
|
||||
// mode_t mode;
|
||||
public:
|
||||
AlertBase();
|
||||
virtual void setup(float time_sample) = 0;
|
||||
virtual void configure(const AlertBaseConfiguration& config) = 0;
|
||||
//public:
|
||||
//mode_t get_mode() const;
|
||||
//bool compare(mode_t mode) const;
|
||||
public:
|
||||
virtual void reset() = 0;
|
||||
virtual void execute(float reference) = 0;
|
||||
protected:
|
||||
virtual void _execute_undef(float reference) = 0;
|
||||
virtual void _execute_operational(float reference) = 0;
|
||||
//
|
||||
};//AlertBase
|
||||
//
|
||||
} /* namespace ALERT */
|
||||
//
|
||||
#endif /* ALERT_ALARMBASE_H_ */
|
||||
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* FaultDecrease.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/FaultDecrease.h"
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
//CONSTRUCTOR
|
||||
FaultDecrease::FaultDecrease():
|
||||
ALERT::AlertBase(),
|
||||
// m_state(ALERT::FaultDecrease::UNKNOWN),
|
||||
m_fault(false),
|
||||
fault(false),
|
||||
_execute(&ALERT::FaultDecrease::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void FaultDecrease::setup(float time_sample)
|
||||
{
|
||||
m_time_sample = time_sample;
|
||||
//
|
||||
}//setup()
|
||||
//
|
||||
void FaultDecrease::configure(const ALERT::AlertBaseConfiguration& config)
|
||||
{
|
||||
m_level = config.level;
|
||||
m_period = config.period;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
//
|
||||
if((m_time_sample > FP_ZERO) && (m_period > m_time_sample) && (m_level >= FP_ZERO))
|
||||
{
|
||||
_execute = &ALERT::FaultDecrease::_execute_operational;
|
||||
}
|
||||
//
|
||||
}//configure()
|
||||
//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void FaultDecrease::reset()
|
||||
{
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
}//reset()
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void FaultDecrease::execute(float reference)
|
||||
{
|
||||
(this->*_execute)(reference);
|
||||
//
|
||||
}//execute()
|
||||
//
|
||||
void FaultDecrease::_execute_undef(float reference)
|
||||
{
|
||||
//
|
||||
}//_execute_undef()
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void FaultDecrease::_execute_operational(float reference)
|
||||
{
|
||||
if(reference <= m_level)
|
||||
{
|
||||
if(m_timer >= m_period)
|
||||
{
|
||||
m_fault = true;
|
||||
fault = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer += m_time_sample;
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
//
|
||||
}//
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer = FP_ZERO;
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
//
|
||||
}//
|
||||
//
|
||||
}//_execute_operational_warning()
|
||||
//
|
||||
} /* namespace ALERT */
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* FaultDecrease.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/AlertBase.h"
|
||||
|
||||
#ifndef ALERT_FAULTDECREASE_H_
|
||||
#define ALERT_FAULTDECREASE_H_
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
class FaultDecrease: public ALERT::AlertBase
|
||||
{
|
||||
public:
|
||||
// enum state_t {UNKNOWN, NORMAL, FAULT};
|
||||
private:
|
||||
// state_t m_state;
|
||||
bool m_fault;
|
||||
public:
|
||||
bool fault;
|
||||
public:
|
||||
FaultDecrease();
|
||||
void setup(float time_sample);
|
||||
void configure(const ALERT::AlertBaseConfiguration& config);
|
||||
public:
|
||||
// state_t get_state() const;
|
||||
// bool compare_state(state_t state) const;
|
||||
// bool is_fault();
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute(float reference);
|
||||
private:
|
||||
void (FaultDecrease::*_execute)(float reference);
|
||||
void _execute_undef(float reference);
|
||||
void _execute_operational(float reference);
|
||||
//
|
||||
};//FaultDecrease()
|
||||
|
||||
} /* namespace ALERT */
|
||||
|
||||
#endif /* ALERT_FAULTDECREASE_H_ */
|
||||
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* FaultExceed.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/FaultExceed.h"
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
FaultExceed::FaultExceed():
|
||||
ALERT::AlertBase(),
|
||||
m_fault(false),
|
||||
fault(false),
|
||||
_execute(&ALERT::FaultExceed::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void FaultExceed::setup(float time_sample)
|
||||
{
|
||||
m_time_sample = time_sample;
|
||||
//
|
||||
}//setup()
|
||||
//
|
||||
void FaultExceed::configure(const AlertBaseConfiguration& config)
|
||||
{
|
||||
|
||||
m_level = config.level;
|
||||
m_period = config.period;
|
||||
//
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
|
||||
//
|
||||
if((m_time_sample > FP_ZERO) && (m_period >= m_time_sample)&&(m_level > FP_ZERO))
|
||||
{
|
||||
_execute = &ALERT::FaultExceed::_execute_operational;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//configure()
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void FaultExceed::reset()
|
||||
{
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
}//reset()
|
||||
//
|
||||
void FaultExceed::execute(float reference)
|
||||
{
|
||||
(this->*_execute)(reference);
|
||||
//
|
||||
}//execute()
|
||||
//
|
||||
void FaultExceed::_execute_undef(float reference)
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void FaultExceed::_execute_operational(float reference)
|
||||
{
|
||||
if(reference >= m_level)
|
||||
{
|
||||
if(m_timer >= m_period)
|
||||
{
|
||||
m_fault = true;
|
||||
fault = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer += m_time_sample;
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer = FP_ZERO;
|
||||
m_fault = false;
|
||||
fault = false;
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
//
|
||||
} /* namespace ALERT */
|
||||
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* FaultExceed.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/AlertBase.h"
|
||||
|
||||
#ifndef ALERT_FAULTEXCEED_H_
|
||||
#define ALERT_FAULTEXCEED_H_
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
class FaultExceed: public ALERT::AlertBase
|
||||
{
|
||||
private:
|
||||
bool m_fault;
|
||||
public:
|
||||
bool fault;
|
||||
public:
|
||||
FaultExceed();
|
||||
void setup(float time_sample);
|
||||
void configure(const AlertBaseConfiguration& config);
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute(float reference);
|
||||
private:
|
||||
void (FaultExceed::*_execute)(float reference);
|
||||
void _execute_undef(float reference);
|
||||
void _execute_operational(float reference);
|
||||
//
|
||||
};//FaultExceed()
|
||||
|
||||
} /* namespace ALERT */
|
||||
|
||||
#endif /* ALERT_FAULTEXCEED_H_ */
|
||||
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* WarningDecrease.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/WarningDecrease.h"
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
WarningDecrease::WarningDecrease():
|
||||
ALERT::AlertBase(),
|
||||
m_warning(false),
|
||||
warning(false),
|
||||
_execute(&ALERT::WarningDecrease::_execute_undef)
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void WarningDecrease::setup(float time_sample)
|
||||
{
|
||||
m_time_sample = time_sample;
|
||||
//
|
||||
}//setup()
|
||||
//
|
||||
void WarningDecrease::configure(const AlertBaseConfiguration& config)
|
||||
{
|
||||
m_level = config.level;
|
||||
m_period = config.period;
|
||||
//
|
||||
m_warning = false;
|
||||
//
|
||||
if((m_time_sample > FP_ZERO) && (m_period >= m_time_sample) && (m_level > FP_ZERO))
|
||||
{
|
||||
_execute = &ALERT::WarningDecrease::_execute_operational;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//configure()
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void WarningDecrease::reset()
|
||||
{
|
||||
m_warning = false;
|
||||
warning = false;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
}//reset()
|
||||
//
|
||||
void WarningDecrease::execute(float reference)
|
||||
{
|
||||
(this->*_execute)(reference);
|
||||
//
|
||||
}//execute()
|
||||
//
|
||||
void WarningDecrease::_execute_undef(float reference)
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void WarningDecrease::_execute_operational(float reference)
|
||||
{
|
||||
//
|
||||
if(reference <= m_level)
|
||||
{
|
||||
if(m_timer >= m_period)
|
||||
{
|
||||
m_warning = true;
|
||||
warning = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer += m_time_sample;
|
||||
m_warning = false;
|
||||
warning = false;
|
||||
//
|
||||
}//if else
|
||||
}
|
||||
else
|
||||
{
|
||||
m_warning = false;
|
||||
warning = false;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
}//else if
|
||||
//
|
||||
}//_execute_operational()
|
||||
//
|
||||
} /* namespace ALERT */
|
||||
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* WarningDecrease.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/AlertBase.h"
|
||||
|
||||
#ifndef ALERT_WARNINGDECREASE_H_
|
||||
#define ALERT_WARNINGDECREASE_H_
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
class WarningDecrease: public ALERT::AlertBase
|
||||
{
|
||||
private:
|
||||
bool m_warning;
|
||||
public:
|
||||
bool warning;
|
||||
public:
|
||||
WarningDecrease();
|
||||
void setup(float time_sample);
|
||||
void configure(const AlertBaseConfiguration& config);
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute(float reference);
|
||||
private:
|
||||
void (WarningDecrease::*_execute)(float reference);
|
||||
void _execute_undef(float reference);
|
||||
void _execute_operational(float reference);
|
||||
//
|
||||
};//
|
||||
|
||||
} /* namespace ALERT */
|
||||
|
||||
#endif /* ALERT_WARNINGDECREASE_H_ */
|
||||
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* WarningExceed.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/WarningExceed.h"
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
//CONSTRUCTOR
|
||||
WarningExceed::WarningExceed():
|
||||
ALERT::AlertBase(),
|
||||
m_warning(false),
|
||||
warning(false),
|
||||
_execute(&ALERT::WarningExceed::_execute_undef)
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void WarningExceed::setup(float time_sample)
|
||||
{
|
||||
m_time_sample = time_sample;
|
||||
//
|
||||
}//setup()
|
||||
//
|
||||
void WarningExceed::configure(const AlertBaseConfiguration& config)
|
||||
{
|
||||
|
||||
m_level = config.level;
|
||||
m_period = config.period;
|
||||
//
|
||||
m_warning = false;
|
||||
//
|
||||
if((m_time_sample > FP_ZERO)&&(m_period > m_time_sample)&&(m_level >= FP_ZERO))
|
||||
{
|
||||
_execute = &ALERT::WarningExceed::_execute_operational;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//configure()
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void WarningExceed::reset()
|
||||
{
|
||||
m_warning = false;
|
||||
warning = false;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
}//reset()
|
||||
//
|
||||
void WarningExceed::execute(float reference)
|
||||
{
|
||||
(this->*_execute)(reference);
|
||||
//
|
||||
}//execute()
|
||||
//
|
||||
|
||||
void WarningExceed::_execute_undef(float reference)
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void WarningExceed::_execute_operational(float reference)
|
||||
{
|
||||
//
|
||||
if(reference >= m_level)
|
||||
{
|
||||
if(m_timer >= m_period)
|
||||
{
|
||||
m_warning = true;
|
||||
warning = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer += m_time_sample;
|
||||
m_warning = false;
|
||||
warning = false;
|
||||
//
|
||||
}//if else
|
||||
}
|
||||
else
|
||||
{
|
||||
m_warning = false;
|
||||
warning = false;
|
||||
m_timer = FP_ZERO;
|
||||
//
|
||||
}//else if
|
||||
//
|
||||
}//_execute_operational()
|
||||
//
|
||||
} /* namespace ALERT */
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* WarningExceed.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "Alert/AlertBase.h"
|
||||
|
||||
#ifndef ALERT_WARNINGEXCEED_H_
|
||||
#define ALERT_WARNINGEXCEED_H_
|
||||
|
||||
namespace ALERT
|
||||
{
|
||||
|
||||
class WarningExceed: public ALERT::AlertBase
|
||||
{
|
||||
private:
|
||||
bool m_warning;
|
||||
public:
|
||||
bool warning;
|
||||
public:
|
||||
WarningExceed();
|
||||
void setup(float time_sample);
|
||||
void configure(const AlertBaseConfiguration& config);
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute(float reference);
|
||||
private:
|
||||
void (WarningExceed::*_execute)(float reference);
|
||||
void _execute_undef(float reference);
|
||||
void _execute_operational(float reference);
|
||||
};
|
||||
|
||||
} /* namespace ALERT */
|
||||
|
||||
#endif /* ALERT_WARNINGEXCEED_H_ */
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP28x_Project.h
|
||||
//
|
||||
// TITLE: DSP28x Project Headerfile and Examples Include File
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: F2833x/F2823x Header Files and Peripheral Examples V142 $
|
||||
// $Release Date: November 1, 2016 $
|
||||
// $Copyright: Copyright (C) 2007-2016 Texas Instruments Incorporated -
|
||||
// http://www.ti.com/ ALL RIGHTS RESERVED $
|
||||
//###########################################################################
|
||||
|
||||
#ifndef DSP28x_PROJECT_H
|
||||
#define DSP28x_PROJECT_H
|
||||
|
||||
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
|
||||
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
|
||||
|
||||
#endif // end of DSP28x_PROJECT_H definition
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
// TI File $Revision: /main/2 $
|
||||
// Checkin $Date: June 22, 2007 13:11:24 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: Flash2833x_API_Config.h
|
||||
//
|
||||
// TITLE: F2833x Flash Algo's - User Settings
|
||||
//
|
||||
// NOTE: This file contains user defined settings that
|
||||
// are used by the F2833x Flash APIs.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release:$
|
||||
// $Release Date:$
|
||||
//###########################################################################
|
||||
|
||||
#ifndef FLASH2833X_API_CONFIG_H
|
||||
#define FLASH2833X_API_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Variables that can be configured by the user.
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
1. Specify the device.
|
||||
Define the device to be programmed as "1" (no quotes).
|
||||
Define all other devices as "0" (no quotes).
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#define FLASH_F28335 1
|
||||
#define FLASH_F28334 0
|
||||
#define FLASH_F28332 0
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
2. Specify the clock rate of the CPU (SYSCLKOUT) in nS.
|
||||
|
||||
Take into account the input clock frequency and the PLL multiplier
|
||||
that your application will use.
|
||||
|
||||
Use one of the values provided, or define your own.
|
||||
The trailing L is required tells the compiler to treat
|
||||
the number as a 64-bit value.
|
||||
|
||||
Only one statement should be uncommented.
|
||||
|
||||
Example: CLKIN is a 30MHz crystal.
|
||||
|
||||
If the application will set PLLCR = 0xA then the CPU clock
|
||||
will be 150Mhz (SYSCLKOUT = 150MHz).
|
||||
|
||||
In this case, the CPU_RATE will be 6.667L
|
||||
Uncomment the line: #define CPU_RATE 6.667L
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#define CPU_RATE 6.667L // for a 150MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 10.000L // for a 100MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 13.330L // for a 75MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 20.000L // for a 50MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 33.333L // for a 30MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 41.667L // for a 24MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 50.000L // for a 20MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 66.667L // for a 15MHz CPU clock speed (SYSCLKOUT)
|
||||
//#define CPU_RATE 100.000L // for a 10MHz CPU clock speed (SYSCLKOUT)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// **** DO NOT modify the code below this line ****
|
||||
//-----------------------------------------------------------------------------
|
||||
#define SCALE_FACTOR 1048576.0L*( (200L/CPU_RATE) ) // IQ20
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* extern "C" */
|
||||
|
||||
#endif // -- end FLASH2833X_API_CONFIG_H
|
||||
@ -0,0 +1,272 @@
|
||||
// TI File $Revision: /main/3 $
|
||||
// Checkin $Date: February 5, 2008 11:10:02 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: Flash2833x_API_Library.h
|
||||
//
|
||||
// TITLE: F2833x Flash Algo's main include file
|
||||
//
|
||||
// DESCRIPTION:
|
||||
//
|
||||
// This file should be included in any project that uses any of the
|
||||
// the F2833x flash APIs.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release:$
|
||||
// $Release Date:$
|
||||
//###########################################################################
|
||||
|
||||
#ifndef FLASH2833X_API_LIBRARY_H
|
||||
#define FLASH2833X_API_LIBRARY_H
|
||||
|
||||
#include <F28335/Flash2833x_API_Config.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
28x Datatypes
|
||||
|
||||
For Portability, User Is Recommended To Use Following Data Type Size
|
||||
Definitions For 16/32/64-Bit Signed/Unsigned Integers and floating point
|
||||
variables:
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DSP28_DATA_TYPES
|
||||
#define DSP28_DATA_TYPES
|
||||
typedef int int16;
|
||||
typedef long int32;
|
||||
typedef long long int64;
|
||||
typedef unsigned int Uint16;
|
||||
typedef unsigned long Uint32;
|
||||
typedef unsigned long long Uint64;
|
||||
typedef float float32;
|
||||
typedef long double float64;
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
API Status Messages
|
||||
|
||||
The following status values are returned from the API to the calling
|
||||
program. These can be used to determine if the API function passed
|
||||
or failed.
|
||||
---------------------------------------------------------------------------*/
|
||||
// Operation passed, no errors were flagged
|
||||
#define STATUS_SUCCESS 0
|
||||
|
||||
// The CSM is preventing the function from performing its operation
|
||||
#define STATUS_FAIL_CSM_LOCKED 10
|
||||
|
||||
// Device REVID does not match that required by the API
|
||||
#define STATUS_FAIL_REVID_INVALID 11
|
||||
|
||||
// Invalid address passed to the API
|
||||
#define STATUS_FAIL_ADDR_INVALID 12
|
||||
|
||||
// Incorrect PARTID
|
||||
// For example the F2806 API was used on a F2808 device.
|
||||
#define STATUS_FAIL_INCORRECT_PARTID 13
|
||||
|
||||
// API/Silicon missmatch. An old version of the
|
||||
// API is being used on silicon it is not valid for
|
||||
// Please update to the latest API.
|
||||
#define STATUS_FAIL_API_SILICON_MISMATCH 14
|
||||
|
||||
// ---- Erase Specific errors ----
|
||||
#define STATUS_FAIL_NO_SECTOR_SPECIFIED 20
|
||||
#define STATUS_FAIL_PRECONDITION 21
|
||||
#define STATUS_FAIL_ERASE 22
|
||||
#define STATUS_FAIL_COMPACT 23
|
||||
#define STATUS_FAIL_PRECOMPACT 24
|
||||
|
||||
// ---- Program Specific errors ----
|
||||
#define STATUS_FAIL_PROGRAM 30
|
||||
#define STATUS_FAIL_ZERO_BIT_ERROR 31
|
||||
|
||||
// ---- Verify Specific errors ----
|
||||
#define STATUS_FAIL_VERIFY 40
|
||||
|
||||
// Busy is set by each API function before it determines
|
||||
// a pass or fail condition for that operation.
|
||||
// The calling function will will not receive this
|
||||
// status condition back from the API
|
||||
#define STATUS_BUSY 999
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Flash sector mask definitions
|
||||
|
||||
The following macros can be used to form a mask specifying which sectors
|
||||
will be erased by the erase API function.
|
||||
|
||||
Bit0 = Sector A
|
||||
Bit1 = Sector B
|
||||
Bit2 = Sector C
|
||||
Bit3 = Sector D
|
||||
Bit4 = Sector E
|
||||
Bit5 = Sector F
|
||||
Bit6 = Sector G
|
||||
Bit7 = Sector H
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#define SECTORA (Uint16)0x0001
|
||||
#define SECTORB (Uint16)0x0002
|
||||
#define SECTORC (Uint16)0x0004
|
||||
#define SECTORD (Uint16)0x0008
|
||||
#define SECTORE (Uint16)0x0010
|
||||
#define SECTORF (Uint16)0x0020
|
||||
#define SECTORG (Uint16)0x0040
|
||||
#define SECTORH (Uint16)0x0080
|
||||
|
||||
|
||||
#if FLASH_F28335
|
||||
// All sectors on an F28335 - Sectors A - H
|
||||
#define SECTOR_F28335 (SECTORA|SECTORB|SECTORC|\
|
||||
SECTORD|SECTORE|SECTORF|\
|
||||
SECTORG|SECTORH)
|
||||
#endif // -- end FLASH_F28335
|
||||
|
||||
#if FLASH_F28334
|
||||
// All sectors on an F28334 - Sectors A - H
|
||||
#define SECTOR_F28334 (SECTORA|SECTORB|SECTORC|\
|
||||
SECTORD|SECTORE|SECTORF|\
|
||||
SECTORG|SECTORH)
|
||||
#endif // -- end FLASH_F28334
|
||||
|
||||
#if FLASH_F28332
|
||||
// All sectors on an F28332 - Sectors A - D
|
||||
#define SECTOR_F28332 (SECTORA|SECTORB|SECTORC|\
|
||||
SECTORD)
|
||||
#endif // -- end FLASH_F28332
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
API Status Structure
|
||||
|
||||
This structure is used to pass debug data back to the calling routine.
|
||||
Note that the Erase API function has 3 parts: precondition, erase and
|
||||
and compaction. Erase and compaction failures will not populate
|
||||
the expected and actual data fields.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
typedef struct {
|
||||
Uint32 FirstFailAddr;
|
||||
Uint16 ExpectedData;
|
||||
Uint16 ActualData;
|
||||
}FLASH_ST;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Interface Function prototypes
|
||||
|
||||
For each 28x Flash API library, the function names are of the form:
|
||||
Flash<DeviceNum>_<Operation>()
|
||||
|
||||
Where <DeviceNum> is the device: ie 2808, 2806, 2801
|
||||
<Operation> is the operation such as Erase, Program...
|
||||
|
||||
For portability for users who may move between the F2808, F2806 and
|
||||
F2801, the following macro definitions are supplied.
|
||||
|
||||
Using these macro definitions, the user can use instead make a generic
|
||||
call: Flash_<Operation> and the macro will map the call to the proper
|
||||
device function
|
||||
|
||||
Note except for the toggle test function, all of the function prototypes
|
||||
are compatible with F281x devices as well.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#if FLASH_F28335
|
||||
#define Flash_Erase(a,b) Flash28335_Erase(a,b)
|
||||
#define Flash_Program(a,b,c,d) Flash28335_Program(a,b,c,d)
|
||||
#define Flash_Verify(a,b,c,d) Flash28335_Verify(a,b,c,d)
|
||||
#define Flash_ToggleTest(a,b) Flash28335_ToggleTest(a,b)
|
||||
#define Flash_DepRecover() Flash28335_DepRecover()
|
||||
#define Flash_APIVersionHex() Flash28335_APIVersionHex()
|
||||
#define Flash_APIVersion() Flash28335_APIVersion()
|
||||
#endif
|
||||
|
||||
#if FLASH_F28334
|
||||
#define Flash_Erase(a,b) Flash28334_Erase(a,b)
|
||||
#define Flash_Program(a,b,c,d) Flash28334_Program(a,b,c,d)
|
||||
#define Flash_Verify(a,b,c,d) Flash28334_Verify(a,b,c,d)
|
||||
#define Flash_ToggleTest(a,b) Flash28334_ToggleTest(a,b)
|
||||
#define Flash_DepRecover() Flash28334_DepRecover()
|
||||
#define Flash_APIVersionHex() Flash28334_APIVersionHex()
|
||||
#define Flash_APIVersion() Flash28334_APIVersion()
|
||||
#endif
|
||||
|
||||
#if FLASH_F28332
|
||||
#define Flash_Erase(a,b) Flash28332_Erase(a,b)
|
||||
#define Flash_Program(a,b,c,d) Flash28332_Program(a,b,c,d)
|
||||
#define Flash_Verify(a,b,c,d) Flash28332_Verify(a,b,c,d)
|
||||
#define Flash_ToggleTest(a,b) Flash28332_ToggleTest(a,b)
|
||||
#define Flash_DepRecover() Flash28332_DepRecover()
|
||||
#define Flash_APIVersionHex() Flash28332_APIVersionHex()
|
||||
#define Flash_APIVersion() Flash28332_APIVersion()
|
||||
#endif
|
||||
|
||||
extern Uint16 Flash_Erase(Uint16 SectorMask, FLASH_ST *FEraseStat);
|
||||
extern Uint16 Flash_Program(Uint16 *FlashAddr, Uint16 *BufAddr, Uint32 Length, FLASH_ST *FProgStatus);
|
||||
extern Uint16 Flash_Verify(Uint16 *StartAddr, Uint16 *BufAddr, Uint32 Length, FLASH_ST *FVerifyStat);
|
||||
extern void Flash_ToggleTest(volatile Uint32 *ToggleReg, Uint32 Mask);
|
||||
extern Uint16 Flash_DepRecover();
|
||||
extern float32 Flash_APIVersion();
|
||||
extern Uint16 Flash_APIVersionHex();
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Frequency Scale factor:
|
||||
The calling program must provide this global parameter used
|
||||
for frequency scaling the algo's.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
extern Uint32 Flash_CPUScaleFactor;
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Callback Function Pointer:
|
||||
A callback function can be specified. This function will be called
|
||||
at safe times during erase, program and verify. This function can
|
||||
then be used to service an external watchdog or send a communications
|
||||
packet.
|
||||
|
||||
Note:
|
||||
THE FLASH AND OTP ARE NOT AVAILABLE DURING THIS FUNCTION CALL.
|
||||
THE FLASH/OTP CANNOT BE READ NOR CAN CODE EXECUTE FROM IT DURING THIS CALL
|
||||
DO NOT CALL ANY OF THE THE FLASH API FUNCTIONS DURING THIS CALL
|
||||
----------------------------------------------------------------------------*/
|
||||
extern void (*Flash_CallbackPtr) (void);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
API load/run symbols:
|
||||
These symbols are defined by the linker during the link. Refer to the
|
||||
Flash28_API section in the example .cmd file:
|
||||
|
||||
Flash28_API:
|
||||
{
|
||||
Flash28335_API_Library.lib(.econst)
|
||||
Flash28335_API_Library.lib(.text)
|
||||
} LOAD = FLASH,
|
||||
RUN = SARAM,
|
||||
LOAD_START(_Flash28_API_LoadStart),
|
||||
LOAD_END(_Flash28_API_LoadEnd),
|
||||
RUN_START(_Flash28_API_RunStart),
|
||||
PAGE = 0
|
||||
|
||||
These are used to copy the flash API from flash to SARAM
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
extern Uint16 Flash28_API_LoadStart;
|
||||
extern Uint16 Flash28_API_LoadEnd;
|
||||
extern Uint16 Flash28_API_RunStart;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* extern "C" */
|
||||
|
||||
|
||||
#endif // -- end FLASH2833x_API_LIBRARY_H
|
||||
|
||||
// --------- END OF FILE ----------------------------------
|
||||
|
||||
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* FRAMBuffer.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "FRAM/FRAMBuffer.h"
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
FRAMBuffer::FRAMBuffer():
|
||||
m_header(),
|
||||
m_config(),
|
||||
m_footer()
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
|
||||
|
||||
|
||||
void FRAMBuffer::update(const FRAM::FRAMHeader& header, const SYSCTRL::SystemControlConfiguration& config, const FRAM::FRAMFooter& footer)
|
||||
{
|
||||
m_header = header;
|
||||
m_config = config;
|
||||
m_footer = footer;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
bool FRAMBuffer::verify_header_and_footer(const FRAM::FRAMHeader& header, const FRAM::FRAMFooter& footer)
|
||||
{
|
||||
if((m_header.class_id == 0xFFFF)
|
||||
&& (m_header.part_id == 0xFFFF)
|
||||
&& (m_header.software_version == 0xFFFF)
|
||||
&& (m_header.size_of_fram_data == 0xFFFF)
|
||||
&& (m_footer.foot == 0xFFFF))
|
||||
{
|
||||
return false;
|
||||
//
|
||||
}else{
|
||||
if(m_header.class_id != header.class_id)
|
||||
{
|
||||
return false;
|
||||
//
|
||||
}else{
|
||||
if(m_header.part_id != header.part_id)
|
||||
{
|
||||
return false;
|
||||
//
|
||||
}else{
|
||||
if(m_header.software_version != header.software_version)
|
||||
{
|
||||
return false;
|
||||
//
|
||||
}else{
|
||||
if(m_header.size_of_fram_data != header.size_of_fram_data)
|
||||
{
|
||||
return false;
|
||||
//
|
||||
}else{
|
||||
if(m_footer.foot != footer.foot)
|
||||
{
|
||||
return false;
|
||||
//
|
||||
}else{
|
||||
return true;
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
void FRAMBuffer::extract(FRAM::FRAMHeader& header, SYSCTRL::SystemControlConfiguration& config, FRAM::FRAMFooter& footer)
|
||||
{
|
||||
header = m_header;
|
||||
footer = m_footer;
|
||||
config = m_config;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMBuffer::extract_header(FRAMHeader& header)
|
||||
{
|
||||
header = m_header;
|
||||
//
|
||||
}//
|
||||
//
|
||||
FRAM::FRAMHeader FRAMBuffer::get_header()
|
||||
{
|
||||
return m_header;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMBuffer::extract_footer(FRAMFooter& footer)
|
||||
{
|
||||
footer = m_footer;
|
||||
//
|
||||
}//
|
||||
//
|
||||
FRAM::FRAMFooter FRAMBuffer::get_footer()
|
||||
{
|
||||
return m_footer;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMBuffer::extract_system_configuration(SYSCTRL::SystemControlConfiguration& config)
|
||||
{
|
||||
config = m_config;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
} /* namespace FRAM */
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* FRAMBuffer.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "SYSCTRL/TypeControl.h"
|
||||
#include "SYSCTRL/SystemConfigurator.h"
|
||||
|
||||
#ifndef FRAM_FRAMBUFFER_H_
|
||||
#define FRAM_FRAMBUFFER_H_
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
|
||||
struct FRAMHeader
|
||||
{
|
||||
int16_t class_id;
|
||||
int16_t part_id;
|
||||
int16_t software_version;
|
||||
int16_t size_of_fram_data;
|
||||
FRAMHeader():
|
||||
class_id(0x0FFFF),
|
||||
part_id(0x0FFFF),
|
||||
software_version(0x0FFFF),
|
||||
size_of_fram_data(0x0FFFF)
|
||||
{}
|
||||
};//FRAMHeader
|
||||
|
||||
struct FRAMFooter
|
||||
{
|
||||
int16_t foot;
|
||||
FRAMFooter():
|
||||
foot(0x0FFFF)
|
||||
{}
|
||||
};//FRAMFooter
|
||||
|
||||
|
||||
class FRAMBuffer
|
||||
{
|
||||
private:
|
||||
FRAMHeader m_header;
|
||||
SYSCTRL::SystemControlConfiguration m_config;
|
||||
FRAMFooter m_footer;
|
||||
public:
|
||||
FRAMBuffer();
|
||||
public:
|
||||
void update(const FRAM::FRAMHeader& header, const SYSCTRL::SystemControlConfiguration& config, const FRAM::FRAMFooter& footer);
|
||||
bool verify_header_and_footer(const FRAM::FRAMHeader& header, const FRAM::FRAMFooter& footer);
|
||||
void extract(FRAM::FRAMHeader& header, SYSCTRL::SystemControlConfiguration& config, FRAM::FRAMFooter& footer);
|
||||
void extract_header(FRAMHeader& header);
|
||||
FRAM::FRAMHeader get_header();
|
||||
void extract_footer(FRAMFooter& footer);
|
||||
FRAM::FRAMFooter get_footer();
|
||||
void extract_system_configuration(SYSCTRL::SystemControlConfiguration& config);
|
||||
};
|
||||
|
||||
} /* namespace FRAM */
|
||||
|
||||
#endif /* FRAM_FRAMBUFFER_H_ */
|
||||
@ -0,0 +1,446 @@
|
||||
/*
|
||||
* FRAMConfigurationParameters.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "FRAM/FRAMDATABASE.h"
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
void FRAMDATABASE::register_configuration_parameters(SYSCTRL::SystemControlConfiguration *sys_config)
|
||||
{
|
||||
|
||||
m_fram_object_index = 0;
|
||||
m_fram_object_address = 0;
|
||||
m_fram_object_last_address = 0;
|
||||
|
||||
//add_register_float(uint8_t readonly, float* pParam, float default_value);
|
||||
//add_register_int(uint8_t readonly, int16_t* pParam, int16_t default_value);
|
||||
//
|
||||
|
||||
//
|
||||
// References
|
||||
//
|
||||
add_float( 0, &sys_config->reference_current_limit_rms, CURRENT_LIMIT_RMS);
|
||||
add_float( 0, &sys_config->reference_current_pfc_rms, CURRENT_PFC_RMS);
|
||||
add_float( 0, &sys_config->reference_voltage_rms, GRID_VOLTAGE_REFERENCE);
|
||||
add_float( 0, &sys_config->reference_voltage_high_limit_rms, GRID_VOLTAGE_HIGH_LIMIT);
|
||||
add_float( 0, &sys_config->reference_voltage_dc, CELL_DC_VOLTAGE_REFERENCE);
|
||||
//<>
|
||||
|
||||
//
|
||||
// Algorithm Control Register
|
||||
add_uint16(0, &sys_config->algorithm_control.all, ENABLE_CONTROL_BIT);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// High Voltage Cell
|
||||
//
|
||||
add_uint16(0, &sys_config->hardware.cell_level, 4);
|
||||
add_uint16(0, &sys_config->hardware.version.pwm, 210);
|
||||
add_uint16(0, &sys_config->hardware.version.cell, 211);
|
||||
add_uint32(0, &sys_config->hardware.version.cpu_cpld, 202);
|
||||
//<>
|
||||
|
||||
|
||||
add_float( 0, &sys_config->minimal_input_voltage_level, 10.0);
|
||||
//<>
|
||||
|
||||
//
|
||||
// Scale Analog Signals
|
||||
//
|
||||
add_float( 0, &sys_config->scale_voltage_input_a, 0.166324854);//0.0227386411//0.0233486816;
|
||||
add_float( 0, &sys_config->scale_voltage_input_b, 0.166955084);//0.0227597337//0.0234651081;
|
||||
add_float( 0, &sys_config->scale_voltage_input_c, 0.170290515);//0.02278281//0.0236082859;
|
||||
//
|
||||
add_float( 0, &sys_config->scale_current_input_a, 0.0057266783);
|
||||
add_float( 0, &sys_config->scale_current_input_b, 0.00571648451);
|
||||
add_float( 0, &sys_config->scale_current_input_c, 0.00571565609);
|
||||
//
|
||||
add_float( 0, &sys_config->scale_current_cell_a, 0.0095403092);//0.00665648002;
|
||||
add_float( 0, &sys_config->scale_current_cell_b, 0.00967073813);//0.00667640707;
|
||||
add_float( 0, &sys_config->scale_current_cell_c, 0.00962774921);//0.00666095456;
|
||||
//
|
||||
add_float( 0, &sys_config->scale_voltage_load_a, 0.168764219);//0.0227408651//0.0232194811;
|
||||
add_float( 0, &sys_config->scale_voltage_load_b, 0.167528242);//0.0227707103//0.0233941432;
|
||||
add_float( 0, &sys_config->scale_voltage_load_c, 0.171417475);//0.0229060184//0.0234934501;
|
||||
//
|
||||
add_float( 0, &sys_config->scale_current_load_a, 0.00949461199);//0.00668919506;
|
||||
add_float( 0, &sys_config->scale_current_load_b, 0.00953965727);//0.00669770781;
|
||||
add_float( 0, &sys_config->scale_current_load_c, 0.00959520414);//0.00670575583;
|
||||
//
|
||||
add_float( 0, &sys_config->scale_current_bypass_a, 0.00953388773);
|
||||
add_float( 0, &sys_config->scale_current_bypass_b, 0.00956917088);
|
||||
add_float( 0, &sys_config->scale_current_bypass_c, 0.00956158526);
|
||||
//<>
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Amplitude Filter Parameters
|
||||
//
|
||||
add_float( 0, &sys_config->ampl_filter_current.time, 20.0e-3);
|
||||
add_float( 0, &sys_config->ampl_filter_current.a3, 2.61313);
|
||||
add_float( 0, &sys_config->ampl_filter_current.a2, 3.41422);
|
||||
add_float( 0, &sys_config->ampl_filter_current.a1, 2.61313);
|
||||
//<>
|
||||
|
||||
//
|
||||
// RMS Filter Parameters
|
||||
//
|
||||
add_float( 0, &sys_config->rms_filter_analog_signal.time, 10.0e-3);
|
||||
add_float( 0, &sys_config->rms_filter_analog_signal.a3, 2.61313);
|
||||
add_float( 0, &sys_config->rms_filter_analog_signal.a2, 3.41422);
|
||||
add_float( 0, &sys_config->rms_filter_analog_signal.a1, 2.61313);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Zero Drift Current Input
|
||||
//
|
||||
add_float( 0, &sys_config->zero_filter.time, 1.333);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Cell DC Voltage Filter
|
||||
//
|
||||
add_float( 0, &sys_config->cell_dc_voltage_filter.time, 3.0e-3);
|
||||
add_float( 0, &sys_config->cell_dc_voltage_filter.a3, 2.61313);
|
||||
add_float( 0, &sys_config->cell_dc_voltage_filter.a2, 3.41422);
|
||||
add_float( 0, &sys_config->cell_dc_voltage_filter.a1, 2.61313);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Signal Decompose
|
||||
//
|
||||
add_float( 0, &sys_config->signal_decompose.projection_filter.time, 10.0e-3);
|
||||
add_float( 0, &sys_config->signal_decompose.projection_filter.a3, 2.61313);
|
||||
add_float( 0, &sys_config->signal_decompose.projection_filter.a2, 3.41422);
|
||||
add_float( 0, &sys_config->signal_decompose.projection_filter.a1, 2.61313);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Relative
|
||||
//
|
||||
add_float( 0, &sys_config->relative_voltage_input.minimal_amplitude_level, 0.1);
|
||||
add_float( 0, &sys_config->relative_voltage_input.limit_relative_high, 1.1);
|
||||
add_float( 0, &sys_config->relative_voltage_input.limit_relative_low, -1.1);
|
||||
add_float( 0, &sys_config->relative_voltage_input.amplitude_filter.time, (float)(1.0/2.0/FP_PI/10.0));
|
||||
add_float( 0, &sys_config->relative_voltage_input.amplitude_filter.a3, 2.61313);
|
||||
add_float( 0, &sys_config->relative_voltage_input.amplitude_filter.a2, 3.41422);
|
||||
add_float( 0, &sys_config->relative_voltage_input.amplitude_filter.a1, 2.61313);
|
||||
//<>
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Voltage PLL-ABC Parameters
|
||||
//
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.frequency_nominal, PLLABC_FREQUENCY_NOMINAL);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.filter.time, 1.0/PLLABC_FREQUENCY_CUT);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.controller.gain, PLLABC_FREQUENCY_CUT/2.0);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.controller.time, 4.0/PLLABC_FREQUENCY_CUT);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.controller.low_saturation, PLLABC_FREQUENCY_LIMIT_LOW);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.controller.high_saturation, PLLABC_FREQUENCY_LIMIT_HI);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.position.time, 1.0);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.position.low_saturation, FP_ZERO);
|
||||
add_float( 0, &sys_config->pll_abc_input_voltage.position.high_saturation, 2.0 * FP_PI);
|
||||
//<>
|
||||
|
||||
|
||||
|
||||
//
|
||||
// System Alarm
|
||||
//
|
||||
// exceed voltage level 1
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_1.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 + (PROTECTION_EXCEED_VOLTAGE_LEVEL_1_PERCENT / (float)100.0)));//253.0;
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_1.period, 10.0);
|
||||
//
|
||||
// exceed voltage level 2
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_2.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 + (PROTECTION_EXCEED_VOLTAGE_LEVEL_2_PERCENT / (float)100.0)));//264.5;
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_2.period, 5.0);
|
||||
//
|
||||
// exceed voltage level 3
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_3.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 + (PROTECTION_EXCEED_VOLTAGE_LEVEL_3_PERCENT / (float)100.0)));//276.0;
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_3.period, 2.0);
|
||||
//
|
||||
// exceed voltage level 4
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_4.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 + (PROTECTION_EXCEED_VOLTAGE_LEVEL_4_PERCENT / (float)100.0)));
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_exceed_level_4.period, 0.004);//1.0;
|
||||
//
|
||||
// decrease voltage level 1
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_decrease_level_1.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 - (PROTECTION_DECREASE_VOLTAGE_LEVEL_1_PERCENT / (float)100.0)));//218.5;//195.5;
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_decrease_level_1.period, 10.0);
|
||||
//
|
||||
// decrease voltage level 2
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_decrease_level_2.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 - (PROTECTION_DECREASE_VOLTAGE_LEVEL_2_PERCENT / (float)100.0)));//207.0;//172.5;
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_decrease_level_2.period, 5.0);
|
||||
//
|
||||
// decrease voltage level 3
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_decrease_level_3.level, NOMINAL_GRID_VOLTAGE * ((float)1.0 - (PROTECTION_DECREASE_VOLTAGE_LEVEL_3_PERCENT / (float)100.0)));
|
||||
add_float( 0, &sys_config->phase_alert_monitor.voltage_decrease_level_3.period, 2.0);
|
||||
//
|
||||
// current overload level 1 120% 60s
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_overload_level_1.level, 30.0 * 14.4);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_overload_level_1.period, 60.0);
|
||||
//
|
||||
// current overload level 2 130% 10s
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_overload_level_2.level, 30.0 * 15.6);//30.0*15.6
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_overload_level_2.period, 10.0);
|
||||
//
|
||||
// current overload level 3 150% 1ms
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_overload_level_3.level, 30.0 * 18.0);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_overload_level_3.period, 0.004);
|
||||
//
|
||||
// current invertor overload level 1 110% 60s
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_invertor_overload_level_1.level, 13.2);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_invertor_overload_level_1.period, 60.0);
|
||||
//
|
||||
// current invertor overload level 2 130% 10s
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_invertor_overload_level_2.level, 15.6);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_invertor_overload_level_2.period, 10.0);
|
||||
//
|
||||
// current invertor overload level 3 150% 1ms
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_invertor_overload_level_3.level, 18.0);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_invertor_overload_level_3.period, 0.004);
|
||||
//
|
||||
// current input overload level 1 110% 60s
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_input_overload_level_1.level, 99.0);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_input_overload_level_1.period, 60.0);
|
||||
//
|
||||
// current input overload level 2 130% 10s
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_input_overload_level_2.level, 117.0);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_input_overload_level_2.period, 10.0);
|
||||
//
|
||||
// current input overload level 3 150% 1ms
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_input_overload_level_3.level, 135.0);
|
||||
add_float( 0, &sys_config->phase_alert_monitor.current_input_overload_level_3.period, 0.004);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// DIGITAL INPUTS
|
||||
//
|
||||
add_float( 0, &sys_config->digital_input_config.period, 50.0e-3); //3001 - 3020
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// FAN CONTROL
|
||||
//
|
||||
add_float( 0, &sys_config->fan_control.timer_period, 5.0*60.0);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Generator ABC
|
||||
//
|
||||
add_float( 0, &sys_config->generator_abc.amplitude, 1.0);
|
||||
add_float( 0, &sys_config->generator_abc.frequency, 2.0*FP_PI*50.0);
|
||||
add_float( 0, &sys_config->generator_abc.phase_shift, 0.0);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Reference PWM-Generator
|
||||
//
|
||||
//add_float( 0, &sys_config->generator_pwm.frequency, 2.0*FP_PI*1.0);
|
||||
//add_float( 0, &sys_config->generator_abc.phase_shift, 0.0);
|
||||
|
||||
//add_float( 0, &sys_config->gen_inp_volt.amplitude.direct.d, 220.0);
|
||||
//
|
||||
//add_float( 0, &sys_config->gen_out_volt.amplitude.direct.d, 220.0);
|
||||
//add_float( 0, &sys_config->gen_out_volt.phase.direct.phase, 0.122756);//FP_PI/4.0);
|
||||
//
|
||||
//add_float( 0, &sys_config->gen_out_current.amplitude.direct.d, 50.0);
|
||||
//add_float( 0, &sys_config->gen_out_current.phase.direct.phase, 0.122756);//FP_PI/3.0;
|
||||
//<>
|
||||
|
||||
//
|
||||
// AlgorithmGeneratorReferences
|
||||
//
|
||||
add_float( 0, &sys_config->algorithm_source_references.voltage, 0.0);
|
||||
add_float( 0, &sys_config->algorithm_source_references.phase_shift, 0.0);
|
||||
|
||||
//
|
||||
// Harmonica Analyzer
|
||||
//
|
||||
add_float( 0, &sys_config->ph_harmonica_5.time, 50.0e-3);
|
||||
add_float( 0, &sys_config->ph_harmonica_5.a3, 2.61313);
|
||||
add_float( 0, &sys_config->ph_harmonica_5.a2, 3.41422);
|
||||
add_float( 0, &sys_config->ph_harmonica_5.a1, 2.61313);
|
||||
//<>
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Reference Intensity Idref Iqref in Start Mode
|
||||
//
|
||||
add_float( 0, &sys_config->intensity_id_iq_references.damp_factor, 0.7071);
|
||||
add_float( 0, &sys_config->intensity_id_iq_references.time, 20.0e-3);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Regulators
|
||||
//
|
||||
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
//
|
||||
#if TYPE_VOLTAGE_CONTROLLER == VOLTAGE_CONTROLLER_PII
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.gain, 1.0);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.time, 1.6e-3);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.high_saturation, 4500.0);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.low_saturation, -4500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->integrator_voltage_dq.time, 2.0e-3);
|
||||
add_float( 0, &sys_config->integrator_voltage_dq.high_saturation, 4500.0);
|
||||
add_float( 0, &sys_config->integrator_voltage_dq.low_saturation, -4500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->reference_voltage_dq_intensity.time, 200.0e-3);
|
||||
//
|
||||
#endif
|
||||
#if TYPE_VOLTAGE_CONTROLLER == VOLTAGE_CONTROLLER_I
|
||||
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.gain, 0.4);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.time, 1600.0e-6);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.high_saturation, 4500.0);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_dq.low_saturation, -4500.0);
|
||||
|
||||
//
|
||||
add_float( 0, &sys_config->integrator_voltage_dq.time, 4.0e-3); // 4.0e-3 for single winding; 2.0e-3 for double winding
|
||||
add_float( 0, &sys_config->integrator_voltage_dq.high_saturation, 4500.0);
|
||||
add_float( 0, &sys_config->integrator_voltage_dq.low_saturation, -4500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->reference_voltage_dq_intensity.time, 200.0e-3);
|
||||
//
|
||||
#endif
|
||||
//
|
||||
//add_float( 0, &sys_config->regulator_current_limit.gain, 1.0);
|
||||
add_float( 0, &sys_config->regulator_current_limit.time, 140.0e-3);
|
||||
add_float( 0, &sys_config->regulator_current_limit.high_saturation, REGULATOR_CURRENT_LIMIT_HIGH_SATURATION);
|
||||
add_float( 0, &sys_config->regulator_current_limit.low_saturation, REGULATOR_CURRENT_LIMIT_LOW_SATURATION);
|
||||
//
|
||||
add_float( 0, &sys_config->regulator_current_pfc.gain, 0.25);
|
||||
add_float( 0, &sys_config->regulator_current_pfc.time, 800.0e-3);
|
||||
add_float( 0, &sys_config->regulator_current_pfc.high_saturation, REGULATOR_CURRENT_PFC_HIGH_SATURATION);
|
||||
add_float( 0, &sys_config->regulator_current_pfc.low_saturation, REGULATOR_CURRENT_PFC_LOW_SATURATION);
|
||||
//
|
||||
#if TYPECURRENTCONTROLLER == CURRENTCONTROLLER_PI
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.gain, 8.0); // 4.0 for single winding; 8.0 for double winding
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.time, 6.4e-3);
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.high_saturation, 500.0);
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.low_saturation, -500.0);
|
||||
#endif
|
||||
#if TYPECURRENTCONTROLLER == CURRENTCONTROLLER_P
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.gain, 8.0);
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.high_saturation, 500.0);
|
||||
add_float( 0, &sys_config->regulator_current_load_dq.low_saturation, -500.0);
|
||||
#endif
|
||||
//
|
||||
add_float( 0, &sys_config->referencer_current_bypass_dq.time, 25.6e-3);
|
||||
add_float( 0, &sys_config->referencer_current_bypass_dq.high_saturation, 240.0);
|
||||
add_float( 0, &sys_config->referencer_current_bypass_dq.low_saturation, -240.0);
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
add_float( 0, &sys_config->regulator_voltage_load_active_reactive.gain, 0.04);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_active_reactive.time, 10.0e-3);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_active_reactive.high_saturation, 4500.0);
|
||||
add_float( 0, &sys_config->regulator_voltage_load_active_reactive.low_saturation, -4500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->regulator_current_limit.gain, 1.0);
|
||||
add_float( 0, &sys_config->regulator_current_limit.time, 5.0);
|
||||
add_float( 0, &sys_config->regulator_current_limit.high_saturation, GRID_VOLTAGE_REFERENCE * 0.57735);
|
||||
add_float( 0, &sys_config->regulator_current_limit.low_saturation, FP_ZERO);
|
||||
//
|
||||
add_float( 0, &sys_config->regulator_current_pfc.gain, 0.25);
|
||||
add_float( 0, &sys_config->regulator_current_pfc.time, 800.0e-3);
|
||||
add_float( 0, &sys_config->regulator_current_pfc.high_saturation, GRID_VOLTAGE_REFERENCE * 0.57735);
|
||||
add_float( 0, &sys_config->regulator_current_pfc.low_saturation, -GRID_VOLTAGE_REFERENCE * 0.57735);
|
||||
//
|
||||
add_float( 0, &sys_config->current_regulator_active.gain, 0.17); // 0.34 for single winding
|
||||
add_float( 0, &sys_config->current_regulator_active.time, 0.04);
|
||||
add_float( 0, &sys_config->current_regulator_active.high_saturation, 500.0);
|
||||
add_float( 0, &sys_config->current_regulator_active.low_saturation, -500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->current_regulator_reactive.gain, 0.17); // 0.34 for single winding
|
||||
add_float( 0, &sys_config->current_regulator_reactive.time, 0.04);
|
||||
add_float( 0, &sys_config->current_regulator_reactive.high_saturation, 500.0);
|
||||
add_float( 0, &sys_config->current_regulator_reactive.low_saturation, -500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->current_referencer.gain, 1.0);
|
||||
add_float( 0, &sys_config->current_referencer.time, 0.160);
|
||||
add_float( 0, &sys_config->current_referencer.high_saturation, 20.0);
|
||||
add_float( 0, &sys_config->current_referencer.low_saturation, -20.0);
|
||||
//
|
||||
add_float( 0, &sys_config->regulator_dc_voltage.gain, 0.05);
|
||||
add_float( 0, &sys_config->regulator_dc_voltage.time, 800.0e-3);
|
||||
add_float( 0, &sys_config->regulator_dc_voltage.high_saturation, FP_ZERO);
|
||||
add_float( 0, &sys_config->regulator_dc_voltage.low_saturation, -GRID_VOLTAGE_REFERENCE * 0.57735);
|
||||
#endif
|
||||
//<>
|
||||
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
//
|
||||
add_float( 0, &sys_config->drc_voltage_decomposer.filter.time, 31.83e-3); //31.83e-3//6.366e-3//3.183e-3
|
||||
//
|
||||
add_float( 0, &sys_config->drc_voltage_controller.gain, 0.4); //0.4 - for single winding; 0.7958 - for double winding. //7.958//1.592//0.7958
|
||||
add_float( 0, &sys_config->drc_voltage_controller.time, 3.2e-3); //31.83e-3//6.366e-3//3.183e-3
|
||||
add_float( 0, &sys_config->drc_voltage_controller.high_saturation, 4500.0);
|
||||
add_float( 0, &sys_config->drc_voltage_controller.low_saturation, -4500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->drc_reference_voltage_direct_intensity.time, 333.0e-3);
|
||||
add_float( 0, &sys_config->drc_reference_voltage_direct_intensity.damp_factor, 0.9);
|
||||
//
|
||||
add_float( 0, &sys_config->drc_regulator_current_load.gain, 4.0);// 4.0 - for single winding; 8.0 - for double winding
|
||||
add_float( 0, &sys_config->drc_regulator_current_load.time, 6.4e-3);
|
||||
add_float( 0, &sys_config->drc_regulator_current_load.high_saturation, 500.0);
|
||||
add_float( 0, &sys_config->drc_regulator_current_load.low_saturation, -500.0);
|
||||
//
|
||||
add_float( 0, &sys_config->drc_referencer_current_bypass.time, 25.6e-3);
|
||||
add_float( 0, &sys_config->drc_referencer_current_bypass.high_saturation, 240.0);
|
||||
add_float( 0, &sys_config->drc_referencer_current_bypass.low_saturation, -240.0);
|
||||
//
|
||||
add_float( 0, &sys_config->drc_regulator_current_limit.time, 140.0e-3);
|
||||
add_float( 0, &sys_config->drc_regulator_current_limit.high_saturation, REGULATOR_CURRENT_LIMIT_HIGH_SATURATION);
|
||||
add_float( 0, &sys_config->drc_regulator_current_limit.low_saturation, REGULATOR_CURRENT_LIMIT_LOW_SATURATION);
|
||||
//
|
||||
add_float( 0, &sys_config->drc_regulator_current_pfc.gain, 0.25);
|
||||
add_float( 0, &sys_config->drc_regulator_current_pfc.time, 800.0e-3);
|
||||
add_float( 0, &sys_config->drc_regulator_current_pfc.high_saturation, REGULATOR_CURRENT_PFC_HIGH_SATURATION);
|
||||
add_float( 0, &sys_config->drc_regulator_current_pfc.low_saturation, REGULATOR_CURRENT_PFC_LOW_SATURATION);
|
||||
//
|
||||
#endif
|
||||
//<>
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Timers
|
||||
//
|
||||
add_float( 0, &sys_config->timer_start.period, 5.0);
|
||||
add_float( 0, &sys_config->timer_stop.period, 5.0);
|
||||
//<>
|
||||
|
||||
|
||||
//
|
||||
// Contactor Control Fault
|
||||
//
|
||||
add_float( 0, &sys_config->contactor.period, 0.4);
|
||||
|
||||
|
||||
}//
|
||||
|
||||
} /* namespace FRAM */
|
||||
@ -0,0 +1,439 @@
|
||||
/*
|
||||
* FRAMDATABASE.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "FRAM/FRAMDATABASE.h"
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
|
||||
FRAMDATABASE::FRAMDATABASE():
|
||||
m_mode(),
|
||||
m_state(),
|
||||
m_fram_data_buffer(),
|
||||
m_buffer_pointer((uint16_t*)&m_fram_data_buffer),
|
||||
m_fram_object(),
|
||||
m_fram_size(FRAM_FRAM_SIZE),
|
||||
m_fram_object_index(0),
|
||||
m_fram_object_address(0),
|
||||
m_fram_object_last_address(0),
|
||||
m_fram_rw_index(0),
|
||||
m_header(),
|
||||
m_footer(),
|
||||
m_verify(false)
|
||||
{
|
||||
m_header.class_id = HEADER_CLASS_ID;
|
||||
m_header.part_id = HEADER_PART_ID;
|
||||
m_header.software_version = HEADER_SOFTWARE_VERSION;
|
||||
m_header.size_of_fram_data = sizeof(m_fram_data_buffer);
|
||||
m_footer.foot = FOOTER_FOOT;
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FRAM::FRAMDATABASE::mode_t FRAMDATABASE::get_mode()
|
||||
{
|
||||
return m_mode;
|
||||
//
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::compare_mode(FRAM::FRAMDATABASE::mode_t mode)
|
||||
{
|
||||
return mode == m_mode;
|
||||
//
|
||||
}//
|
||||
//
|
||||
FRAM::FRAMDATABASE::state_t FRAMDATABASE::get_state()
|
||||
{
|
||||
return m_state;
|
||||
//
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::compare_state(FRAM::FRAMDATABASE::state_t state)
|
||||
{
|
||||
return state == m_state;
|
||||
//
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_free()
|
||||
{
|
||||
return m_state == FRAM::FRAMDATABASE::FREE;
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_busy()
|
||||
{
|
||||
return m_state == FRAM::FRAMDATABASE::BUSY;
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_read()
|
||||
{
|
||||
return m_mode == FRAM::FRAMDATABASE::READ;
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_burn()
|
||||
{
|
||||
return m_mode == FRAM::FRAMDATABASE::BURN;
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_erase()
|
||||
{
|
||||
return m_mode == FRAM::FRAMDATABASE::ERASE;
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_restore()
|
||||
{
|
||||
return m_mode == FRAM::FRAMDATABASE::RESTORE;
|
||||
}//
|
||||
//
|
||||
bool FRAMDATABASE::is_verify()
|
||||
{
|
||||
return m_mode == FRAM::FRAMDATABASE::VERIFY;
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::set_read()
|
||||
{
|
||||
m_state = FRAM::FRAMDATABASE::BUSY;
|
||||
m_mode = FRAM::FRAMDATABASE::READ;
|
||||
m_fram_rw_index = 0;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::set_burn()
|
||||
{
|
||||
m_state = FRAM::FRAMDATABASE::BUSY;
|
||||
m_mode = FRAM::FRAMDATABASE::BURN;
|
||||
m_fram_rw_index = 0;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::set_erase()
|
||||
{
|
||||
m_state = FRAM::FRAMDATABASE::BUSY;
|
||||
m_mode = FRAM::FRAMDATABASE::ERASE;
|
||||
m_fram_rw_index = 0;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::set_verify()
|
||||
{
|
||||
m_state = FRAM::FRAMDATABASE::BUSY;
|
||||
m_mode = FRAM::FRAMDATABASE::VERIFY;
|
||||
m_fram_rw_index = 0;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::set_restore()
|
||||
{
|
||||
m_state = FRAM::FRAMDATABASE::BUSY;
|
||||
m_mode = FRAM::FRAMDATABASE::RESTORE;
|
||||
m_fram_rw_index = 0;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::set_break()
|
||||
{
|
||||
m_state = FRAM::FRAMDATABASE::FREE;
|
||||
m_mode = FRAM::FRAMDATABASE::WAIT;
|
||||
m_fram_rw_index = 0;
|
||||
//
|
||||
}//
|
||||
//
|
||||
FRAM::FRAMHeader FRAMDATABASE::get_header()
|
||||
{
|
||||
return m_header;
|
||||
//
|
||||
}//
|
||||
//
|
||||
FRAM::FRAMFooter FRAMDATABASE::get_footer()
|
||||
{
|
||||
return m_footer;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::extract_system_configuration(SYSCTRL::SystemControlConfiguration *sys_config)
|
||||
{
|
||||
m_fram_data_buffer.extract_system_configuration(*sys_config);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::implement_dafault_configuration()
|
||||
{
|
||||
for(uint16_t i = 0; i < m_fram_object_index; i++)
|
||||
{
|
||||
FRAM::FRAMDataObjects& o = m_fram_object[i];
|
||||
o.restore_default_value();
|
||||
//
|
||||
}//for
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
void FRAMDATABASE::upload_configuration(SYSCTRL::SystemControlConfiguration *sys_config)
|
||||
{
|
||||
register_configuration_parameters(sys_config);
|
||||
|
||||
//implement_dafault_configuration();
|
||||
|
||||
read_from_fram_to_buffer();
|
||||
|
||||
m_verify = m_fram_data_buffer.verify_header_and_footer(m_header, m_footer);
|
||||
//m_verify = false;
|
||||
if(m_verify)
|
||||
{
|
||||
extract_system_configuration(sys_config);
|
||||
}
|
||||
else
|
||||
{
|
||||
erase_fram_buffer();
|
||||
|
||||
implement_dafault_configuration();
|
||||
|
||||
m_fram_data_buffer.update(m_header, *sys_config, m_footer);
|
||||
|
||||
write_to_fram_from_buffer();
|
||||
//
|
||||
}//if else
|
||||
}//
|
||||
//
|
||||
|
||||
void FRAMDATABASE::update_buffer(const SYSCTRL::SystemControlConfiguration *sys_config)
|
||||
{
|
||||
m_fram_data_buffer.update(m_header, *sys_config, m_footer);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::erase_fram_index()
|
||||
{
|
||||
if(m_mode == FRAM::FRAMDATABASE::ERASE)
|
||||
{
|
||||
if(m_fram_rw_index < sizeof(m_fram_data_buffer))
|
||||
{
|
||||
writeint(0xFFFF, m_fram_rw_index << 1);
|
||||
m_fram_rw_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_break();
|
||||
//
|
||||
}//if else
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::verify_fram_index()
|
||||
{
|
||||
if(m_mode == FRAM::FRAMDATABASE::VERIFY)
|
||||
{
|
||||
if(m_fram_rw_index < sizeof(m_fram_data_buffer))
|
||||
{
|
||||
m_fram_rw_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_break();
|
||||
//
|
||||
}//if else
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::write_fram_index()
|
||||
{
|
||||
if(m_mode == FRAM::FRAMDATABASE::BURN)
|
||||
{
|
||||
if(m_fram_rw_index < sizeof(m_fram_data_buffer))
|
||||
{
|
||||
writeint((*(m_buffer_pointer + m_fram_rw_index)), m_fram_rw_index << 1);
|
||||
m_fram_rw_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_break();
|
||||
//
|
||||
}//if else
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::read_fram_index()
|
||||
{
|
||||
if(m_mode == FRAM::FRAMDATABASE::READ)
|
||||
{
|
||||
if(m_fram_rw_index < sizeof(m_fram_data_buffer))
|
||||
{
|
||||
*(m_buffer_pointer + m_fram_rw_index) = readint(m_fram_rw_index << 1);
|
||||
m_fram_rw_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_break();
|
||||
//
|
||||
}//if else
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::restore_fram_index()
|
||||
{
|
||||
if(m_mode == FRAM::FRAMDATABASE::RESTORE)
|
||||
{
|
||||
if(m_fram_rw_index < sizeof(m_fram_data_buffer))
|
||||
{
|
||||
writeint((*(m_buffer_pointer + m_fram_rw_index)), m_fram_rw_index << 1);
|
||||
m_fram_rw_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_break();
|
||||
//
|
||||
}//if else
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::read_from_fram_to_buffer()
|
||||
{
|
||||
set_read();
|
||||
for(m_fram_rw_index = 0; m_fram_rw_index < sizeof(m_fram_data_buffer); m_fram_rw_index++)
|
||||
{
|
||||
*(m_buffer_pointer + m_fram_rw_index) = readint(m_fram_rw_index << 1);
|
||||
//
|
||||
}//for
|
||||
//
|
||||
m_mode = FRAM::FRAMDATABASE::READ;
|
||||
m_state = FRAMDATABASE::BUSY;
|
||||
set_break();
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::write_to_fram_from_buffer()
|
||||
{
|
||||
set_burn();
|
||||
for(m_fram_rw_index = 0; m_fram_rw_index < sizeof(m_fram_data_buffer); m_fram_rw_index++)
|
||||
{
|
||||
writeint((*(m_buffer_pointer + m_fram_rw_index)), m_fram_rw_index << 1);
|
||||
//
|
||||
}//for
|
||||
//
|
||||
set_break();
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::erase_fram_buffer()
|
||||
{
|
||||
set_verify();
|
||||
for(m_fram_rw_index = 0; m_fram_rw_index < sizeof(m_fram_data_buffer); m_fram_rw_index++)
|
||||
{
|
||||
writeint(0xFFFF, m_fram_rw_index << 1);
|
||||
*(m_buffer_pointer + m_fram_rw_index) = readint(m_fram_rw_index << 1);
|
||||
//
|
||||
}//for
|
||||
//
|
||||
set_break();
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
void FRAMDATABASE::add_float(uint8_t readonly, float* pParam, float default_value)
|
||||
{
|
||||
if((m_fram_object_index < NUMBER_FRAM_PARAMETERS)&&
|
||||
(((m_fram_object_address + (sizeof(float)<<1)) < m_fram_size)))
|
||||
{
|
||||
FRAM::FRAMDataObjects& object = m_fram_object[m_fram_object_index];
|
||||
object.add_register_float(m_fram_object_address, readonly, pParam, default_value);
|
||||
m_fram_object_index++;
|
||||
m_fram_object_address += (sizeof(float) << 1);
|
||||
m_fram_object_last_address = m_fram_object_address;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::add_int16(uint8_t readonly, int16_t* pParam, int16_t default_value)
|
||||
{
|
||||
if((m_fram_object_index < NUMBER_FRAM_PARAMETERS)&&
|
||||
(((m_fram_object_address + (sizeof(uint16_t)<<1)) < m_fram_size)))
|
||||
{
|
||||
FRAM::FRAMDataObjects& object = m_fram_object[m_fram_object_index];
|
||||
object.add_register_int16(m_fram_object_address, readonly, pParam, default_value);
|
||||
m_fram_object_index++;
|
||||
m_fram_object_address += sizeof(int16_t) << 1;
|
||||
m_fram_object_last_address = m_fram_object_address;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::add_int32(uint8_t readonly, int32_t* pParam, int32_t default_value)
|
||||
{
|
||||
if((m_fram_object_index < NUMBER_FRAM_PARAMETERS)&&
|
||||
(((m_fram_object_address + (sizeof(int32_t)<<1)) < m_fram_size)))
|
||||
{
|
||||
FRAM::FRAMDataObjects& object = m_fram_object[m_fram_object_index];
|
||||
object.add_register_int32(m_fram_object_address, readonly, pParam, default_value);
|
||||
m_fram_object_index++;
|
||||
m_fram_object_address += (sizeof(int32_t) << 1);
|
||||
m_fram_object_last_address = m_fram_object_address;
|
||||
//
|
||||
}//if
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::add_uint16(uint8_t readonly, uint16_t* pParam, uint16_t default_value)
|
||||
{
|
||||
if((m_fram_object_index < NUMBER_FRAM_PARAMETERS)&&
|
||||
(((m_fram_object_address + (sizeof(uint16_t)<<1)) < m_fram_size)))
|
||||
{
|
||||
FRAM::FRAMDataObjects& object = m_fram_object[m_fram_object_index];
|
||||
object.add_register_uint16(m_fram_object_address, readonly, pParam, default_value);
|
||||
m_fram_object_index++;
|
||||
m_fram_object_address += sizeof(uint16_t) << 1;
|
||||
m_fram_object_last_address = m_fram_object_address;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::add_uint32(uint8_t readonly, uint32_t* pParam, uint32_t default_value)
|
||||
{
|
||||
if((m_fram_object_index < NUMBER_FRAM_PARAMETERS)&&
|
||||
(((m_fram_object_address + (sizeof(uint32_t)<<1)) < m_fram_size)))
|
||||
{
|
||||
FRAM::FRAMDataObjects& object = m_fram_object[m_fram_object_index];
|
||||
object.add_register_uint32(m_fram_object_address, readonly, pParam, default_value);
|
||||
m_fram_object_index++;
|
||||
m_fram_object_address += (sizeof(uint32_t) << 1);
|
||||
m_fram_object_last_address = m_fram_object_address;
|
||||
//
|
||||
}//if
|
||||
}//
|
||||
//
|
||||
void FRAMDATABASE::add_bool(uint8_t readonly, bool* pParam, bool default_value)
|
||||
{
|
||||
if((m_fram_object_index < NUMBER_FRAM_PARAMETERS)&&
|
||||
(((m_fram_object_address + (sizeof(uint16_t)<<1)) < m_fram_size)))
|
||||
{
|
||||
FRAM::FRAMDataObjects& object = m_fram_object[m_fram_object_index];
|
||||
object.add_register_bool(m_fram_object_address, readonly, pParam, default_value);
|
||||
m_fram_object_index++;
|
||||
m_fram_object_address += sizeof(int16_t) << 1;
|
||||
m_fram_object_last_address = m_fram_object_address;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
|
||||
} /* namespace FRAM */
|
||||
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* FRAMDATABASE.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
#include "FRAM/FRAMDefinitions.h"
|
||||
#include "FRAM/FRAMBuffer.h"
|
||||
#include "FRAM/FRAMDataObjects.h"
|
||||
#include "FRAM/FRAMVariant.h"
|
||||
#include "SYSCTRL/SystemConfigurator.h"
|
||||
#include "SYSCTRL/SystemDefinitions.h"
|
||||
|
||||
#ifndef FRAM_FRAMDATABASE_H_
|
||||
#define FRAM_FRAMDATABASE_H_
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
|
||||
class FRAMDATABASE
|
||||
{
|
||||
public:
|
||||
enum mode_t {WAIT, READ, BURN, ERASE, VERIFY, RESTORE};
|
||||
enum state_t {BUSY, FREE};
|
||||
private:
|
||||
mode_t m_mode;
|
||||
state_t m_state;
|
||||
private:
|
||||
FRAM::FRAMBuffer m_fram_data_buffer;
|
||||
uint16_t *m_buffer_pointer;
|
||||
FRAM::FRAMDataObjects m_fram_object[NUMBER_FRAM_PARAMETERS];
|
||||
uint16_t m_fram_size;
|
||||
uint16_t m_fram_object_index;
|
||||
uint16_t m_fram_object_address;
|
||||
uint16_t m_fram_object_last_address;
|
||||
uint16_t m_fram_rw_index;
|
||||
FRAM::FRAMHeader m_header;
|
||||
FRAM::FRAMFooter m_footer;
|
||||
bool m_verify;
|
||||
public:
|
||||
FRAMDATABASE();
|
||||
public:
|
||||
mode_t get_mode();
|
||||
bool compare_mode(mode_t mode);
|
||||
state_t get_state();
|
||||
bool compare_state(state_t state);
|
||||
public:
|
||||
bool is_free();
|
||||
bool is_busy();
|
||||
bool is_read();
|
||||
bool is_burn();
|
||||
bool is_erase();
|
||||
bool is_restore();
|
||||
bool is_verify();
|
||||
public:
|
||||
void set_read();
|
||||
void set_burn();
|
||||
void set_erase();
|
||||
void set_verify();
|
||||
void set_restore();
|
||||
void set_break();
|
||||
public:
|
||||
void upload_configuration(SYSCTRL::SystemControlConfiguration *sys_config);
|
||||
void update_buffer(const SYSCTRL::SystemControlConfiguration *sys_config);
|
||||
void erase_fram_index();
|
||||
void verify_fram_index();
|
||||
void write_fram_index();
|
||||
void read_fram_index();
|
||||
void restore_fram_index();
|
||||
void read_from_fram_to_buffer();
|
||||
void write_to_fram_from_buffer();
|
||||
void erase_fram_buffer();
|
||||
public:
|
||||
FRAM::FRAMHeader get_header();
|
||||
FRAM::FRAMFooter get_footer();
|
||||
void extract_system_configuration(SYSCTRL::SystemControlConfiguration *sys_config);
|
||||
void implement_dafault_configuration();
|
||||
//
|
||||
//
|
||||
private:
|
||||
void add_float(uint8_t readonly, float* pParam, float default_value);
|
||||
void add_int16(uint8_t readonly, int16_t* pParam, int16_t default_value);
|
||||
void add_int32(uint8_t readonly, int32_t* pParam, int32_t default_value);
|
||||
void add_uint16(uint8_t readonly, uint16_t* pParam, uint16_t default_value);
|
||||
void add_uint32(uint8_t readonly, uint32_t* pParam, uint32_t default_value);
|
||||
void add_bool(uint8_t readonly, bool* pParam, bool default_value);
|
||||
public:
|
||||
void register_configuration_parameters(SYSCTRL::SystemControlConfiguration *sys_config);
|
||||
|
||||
};//class FRAMDATABASE
|
||||
|
||||
} /* namespace FRAM */
|
||||
|
||||
#endif /* FRAM_FRAMDATABASE_H_ */
|
||||
@ -0,0 +1,201 @@
|
||||
/*
|
||||
* FRAMDataObjects.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "FRAM/FRAMDataObjects.h"
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
FRAMDataObjects::FRAMDataObjects():
|
||||
m_address(0),
|
||||
m_is_read_only(false),
|
||||
m_pParam(0),
|
||||
m_default_value()
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void FRAMDataObjects::restore_default_value()
|
||||
{
|
||||
if(m_pParam != 0)
|
||||
{
|
||||
switch(m_default_value.get_type())
|
||||
{
|
||||
case FRAM::FRAM_VARIANT_FLOAT: { *((float*) m_pParam) = m_default_value.get_float(); break;}
|
||||
case FRAM::FRAM_VARIANT_INT16: { *((int16_t*) m_pParam) = m_default_value.get_int16(); break;}
|
||||
case FRAM::FRAM_VARIANT_INT32: { *((int32_t*) m_pParam) = m_default_value.get_int32(); break;}
|
||||
case FRAM::FRAM_VARIANT_UINT16: { *((uint16_t*) m_pParam) = m_default_value.get_uint16(); break;}
|
||||
case FRAM::FRAM_VARIANT_UINT32: { *((uint32_t*) m_pParam) = m_default_value.get_uint32(); break;}
|
||||
case FRAM::FRAM_VARIANT_BOOL: { *((bool*) m_pParam) = m_default_value.get_bool(); break;}
|
||||
default: {break;}
|
||||
}//switch
|
||||
}//if
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::add_register_float(uint16_t address, uint8_t readonly, float* pParam, float default_value)
|
||||
{
|
||||
m_address = address;
|
||||
m_is_read_only = 0 != readonly ? true : false;
|
||||
m_pParam = pParam;
|
||||
m_default_value.set_float(default_value);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::add_register_int16(uint16_t address, uint8_t readonly, int16_t* pParam, int16_t default_value)
|
||||
{
|
||||
m_address = address;
|
||||
m_is_read_only = 0 != readonly ? true : false;
|
||||
m_pParam = pParam;
|
||||
m_default_value.set_int16(default_value);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::add_register_int32(uint16_t address, uint8_t readonly, int32_t* pParam, int32_t default_value)
|
||||
{
|
||||
m_address = address;
|
||||
m_is_read_only = 0 != readonly ? true : false;
|
||||
m_pParam = pParam;
|
||||
m_default_value.set_int32(default_value);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::add_register_uint16(uint16_t address, uint8_t readonly, uint16_t* pParam, uint16_t default_value)
|
||||
{
|
||||
m_address = address;
|
||||
m_is_read_only = 0 != readonly ? true : false;
|
||||
m_pParam = pParam;
|
||||
m_default_value.set_uint16(default_value);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::add_register_uint32(uint16_t address, uint8_t readonly, uint32_t* pParam, uint32_t default_value)
|
||||
{
|
||||
m_address = address;
|
||||
m_is_read_only = 0 != readonly ? true : false;
|
||||
m_pParam = pParam;
|
||||
m_default_value.set_uint32(default_value);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::add_register_bool(uint16_t address, uint8_t readonly, bool* pParam, bool default_value)
|
||||
{
|
||||
m_address = address;
|
||||
m_is_read_only = 0 != readonly ? true : false;
|
||||
m_pParam = pParam;
|
||||
m_default_value.set_bool(default_value);
|
||||
//
|
||||
}//
|
||||
//
|
||||
uint16_t FRAMDataObjects::get_address() const
|
||||
{
|
||||
return m_address;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::write_parameter(const void *pBuffer, uint8_t buffer_size)
|
||||
{
|
||||
if((m_pParam != 0)&&
|
||||
(pBuffer != 0) &&
|
||||
(buffer_size > 0) &&
|
||||
(m_is_read_only != true))
|
||||
{
|
||||
switch(m_default_value.get_type())
|
||||
{
|
||||
case FRAM::FRAM_VARIANT_FLOAT: { if(4 == buffer_size) *((float*) m_pParam) = *((float*) pBuffer); break;}
|
||||
case FRAM::FRAM_VARIANT_INT16: { if(2 == buffer_size) *((int16_t*) m_pParam) = *((int16_t*) pBuffer); break;}
|
||||
default: {break;}
|
||||
}//switch
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::read_parameter(void *pBuffer, uint8_t buffer_size) const
|
||||
{
|
||||
if((m_pParam != 0) &&
|
||||
(pBuffer != 0) &&
|
||||
(buffer_size > 0))
|
||||
{
|
||||
switch(m_default_value.get_type())
|
||||
{
|
||||
case FRAM::FRAM_VARIANT_FLOAT: {if(4 == buffer_size) *((float*) pBuffer) = *((float*) m_pParam); break;}
|
||||
case FRAM::FRAM_VARIANT_INT16: {if(2 == buffer_size) *((int16_t*) pBuffer) = *((int16_t*) m_pParam); break;}
|
||||
default: {break;}
|
||||
}//switch
|
||||
//
|
||||
}//if
|
||||
}//
|
||||
|
||||
void FRAMDataObjects::fram_write_parameter()
|
||||
{
|
||||
if(m_pParam != 0)
|
||||
{
|
||||
switch(m_default_value.get_type())
|
||||
{
|
||||
case FRAM::FRAM_VARIANT_FLOAT:
|
||||
{
|
||||
writefloat(*((float*) m_pParam), m_address);
|
||||
break;
|
||||
}
|
||||
case FRAM::FRAM_VARIANT_INT16:
|
||||
{
|
||||
writeint(*((int16_t*) m_pParam), m_address);
|
||||
break;
|
||||
}
|
||||
default: {break;}
|
||||
}//switch
|
||||
//
|
||||
}//if
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::fram_read_parameter()
|
||||
{
|
||||
if(m_pParam != 0)
|
||||
{
|
||||
switch(m_default_value.get_type())
|
||||
{
|
||||
case FRAM::FRAM_VARIANT_FLOAT:
|
||||
{
|
||||
*((float*) m_pParam) = readfloat(m_address);
|
||||
break;
|
||||
}
|
||||
case FRAM::FRAM_VARIANT_INT16:
|
||||
{
|
||||
*((int16_t*) m_pParam) = readint(m_address);
|
||||
break;
|
||||
}
|
||||
default: {break;}
|
||||
}//switch
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::write_to_fram_data(Uint16 *Dest, Uint32 Length)
|
||||
{
|
||||
for(Uint16 i = 0; i < Length; i++)
|
||||
{
|
||||
writeint((*Dest++),i);
|
||||
//
|
||||
}//for
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMDataObjects::read_from_fram_data(Uint16 *BuffAddr, Uint32 Length)
|
||||
{
|
||||
for(Uint16 i = 0; i < Length; i++)
|
||||
{
|
||||
(*BuffAddr++) = readint(i);
|
||||
//
|
||||
}//for
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
|
||||
//
|
||||
} /* namespace FRAM */
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* FRAMACCESS.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
#include "FRAM/FRAMVariant.h"
|
||||
|
||||
#ifndef FRAM_FRAMDATAOBJECTS_H_
|
||||
#define FRAM_FRAMDATAOBJECTS_H_
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
class FRAMDataObjects
|
||||
{
|
||||
private:
|
||||
uint16_t m_address;
|
||||
bool m_is_read_only;
|
||||
void* m_pParam;
|
||||
FRAM::FRAMVariant m_default_value;
|
||||
public:
|
||||
FRAMDataObjects();
|
||||
void restore_default_value();
|
||||
void add_register_float(uint16_t address, uint8_t readonly, float* pParam, float default_value);
|
||||
void add_register_int16(uint16_t address, uint8_t readonly, int16_t* pParam, int16_t default_value);
|
||||
void add_register_int32(uint16_t address, uint8_t readonly, int32_t* pParam, int32_t default_value);
|
||||
void add_register_uint16(uint16_t address, uint8_t readonly, uint16_t* pParam, uint16_t default_value);
|
||||
void add_register_uint32(uint16_t address, uint8_t readonly, uint32_t* pParam, uint32_t default_value);
|
||||
void add_register_bool(uint16_t address, uint8_t readonly, bool* pParam, bool default_value);
|
||||
public:
|
||||
uint16_t get_address() const;
|
||||
void write_parameter(const void *pBuffer, uint8_t buffer_size);
|
||||
void read_parameter(void *pBuffer, uint8_t buffer_size) const;
|
||||
public:
|
||||
void fram_write_parameter();
|
||||
void fram_read_parameter();
|
||||
public:
|
||||
void write_to_fram_data(Uint16 *Dest, Uint32 Length);
|
||||
void read_from_fram_data(Uint16 *BufAddr, Uint32 Length);
|
||||
};
|
||||
|
||||
} /* namespace FRAM */
|
||||
|
||||
#endif /* FRAM_FRAMDATAOBJECTS_H_ */
|
||||
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* FRAMDefinitions.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef FRAM_FRAMDEFINITIONS_H_
|
||||
#define FRAM_FRAMDEFINITIONS_H_
|
||||
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
//
|
||||
//
|
||||
#define FRAM_FRAM_SIZE ((uint16_t)(8192))
|
||||
//
|
||||
} /* namespace FRAM */
|
||||
#endif /* FRAM_FRAMDEFINITIONS_H_ */
|
||||
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* FRAMVariant.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "FRAM/FRAMVariant.h"
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
FRAMVariant::FRAMVariant():
|
||||
t(FRAM::FRAM_VARIANT_UNDEFINED),
|
||||
f(0)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
|
||||
FRAM::fram_variant_type_t FRAMVariant::get_type() const
|
||||
{
|
||||
return t;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
void FRAMVariant::set_float(float v)
|
||||
{
|
||||
f = v;
|
||||
t = FRAM::FRAM_VARIANT_FLOAT;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
void FRAMVariant::set_int16(int16_t v)
|
||||
{
|
||||
i16 = v;
|
||||
t = FRAM::FRAM_VARIANT_INT16;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMVariant::set_int32(int32_t v)
|
||||
{
|
||||
i32 = v;
|
||||
t = FRAM::FRAM_VARIANT_INT32;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMVariant::set_uint16(uint16_t v)
|
||||
{
|
||||
u16 = v;
|
||||
t = FRAM::FRAM_VARIANT_UINT16;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void FRAMVariant::set_uint32(uint32_t v)
|
||||
{
|
||||
u32 = v;
|
||||
t = FRAM::FRAM_VARIANT_UINT32;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
|
||||
void FRAMVariant::set_bool(bool v)
|
||||
{
|
||||
b = v;
|
||||
t = FRAM::FRAM_VARIANT_BOOL;
|
||||
//
|
||||
}//
|
||||
//
|
||||
float FRAMVariant::get_float() const
|
||||
{
|
||||
return f;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
int16_t FRAMVariant::get_int16() const
|
||||
{
|
||||
return i16;
|
||||
//
|
||||
}//
|
||||
//
|
||||
int32_t FRAMVariant::get_int32() const
|
||||
{
|
||||
return i32;
|
||||
//
|
||||
}//
|
||||
//
|
||||
uint16_t FRAMVariant::get_uint16() const
|
||||
{
|
||||
return u16;
|
||||
//
|
||||
}//
|
||||
//
|
||||
uint32_t FRAMVariant::get_uint32() const
|
||||
{
|
||||
return u32;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
bool FRAMVariant::get_bool() const
|
||||
{
|
||||
return b;
|
||||
}//
|
||||
//
|
||||
|
||||
}/* namespace FRAM */
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* FRAMVariant.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "SYSCTRL/SystemDefinitions.h"
|
||||
|
||||
|
||||
#ifndef FRAM_FRAMVARIANT_H_
|
||||
#define FRAM_FRAMVARIANT_H_
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
enum fram_variant_type_t {FRAM_VARIANT_UNDEFINED, FRAM_VARIANT_FLOAT, FRAM_VARIANT_INT16, FRAM_VARIANT_INT32, FRAM_VARIANT_UINT16, FRAM_VARIANT_UINT32, FRAM_VARIANT_BOOL};
|
||||
|
||||
class FRAMVariant
|
||||
{
|
||||
private:
|
||||
union
|
||||
{
|
||||
float f;
|
||||
int16_t i16;
|
||||
int32_t i32;
|
||||
uint16_t u16;
|
||||
uint32_t u32;
|
||||
bool b;
|
||||
SYSCTRL::Register16 r16;
|
||||
SYSCTRL::Register32 r32;
|
||||
};
|
||||
private:
|
||||
fram_variant_type_t t;
|
||||
public:
|
||||
FRAMVariant();
|
||||
fram_variant_type_t get_type() const;
|
||||
//setters
|
||||
void set_float(float v);
|
||||
void set_int16(int16_t v);
|
||||
void set_int32(int32_t v);
|
||||
void set_uint16(uint16_t v);
|
||||
void set_uint32(uint32_t v);
|
||||
void set_bool(bool v);
|
||||
//getters
|
||||
float get_float() const;
|
||||
int16_t get_int16() const;
|
||||
int32_t get_int32() const;
|
||||
uint16_t get_uint16() const;
|
||||
uint32_t get_uint32() const;
|
||||
bool get_bool() const;
|
||||
//
|
||||
};//class fram_variant_t
|
||||
//
|
||||
}/* namespace FRAM */
|
||||
|
||||
#endif /* FRAM_FRAMVARIANT_H_ */
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* FRAMheaders.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef FRAM_FRAMHEADERS_H_
|
||||
#define FRAM_FRAMHEADERS_H_
|
||||
|
||||
#include "FRAM/FRAMBuffer.h"
|
||||
#include "FRAM/FRAMDATABASE.h"
|
||||
#include "FRAM/FRAMDataObjects.h"
|
||||
#include "FRAM/FRAMVariant.h"
|
||||
|
||||
|
||||
|
||||
#endif /* FRAM_FRAMHEADERS_H_ */
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* ROM.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "FRAM/ROM.h"
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
ROM::ROM():
|
||||
m_mode(FRAM::ROM::UNDEFINED),
|
||||
m_header(),
|
||||
m_footer(),
|
||||
m_int_last_address(0),
|
||||
m_flt_last_address(0),
|
||||
_write_float(&FRAM::ROM::_write_float_undef),
|
||||
_read_float(&FRAM::ROM::_read_float_undef),
|
||||
_write_int(&FRAM::ROM::_write_int_undef),
|
||||
_read_int(&FRAM::ROM::_read_int_undef)
|
||||
{}
|
||||
//CONSTRUCTOR
|
||||
//
|
||||
void ROM::setup(const ROMSetup setup)
|
||||
{
|
||||
static bool _status = true;
|
||||
if(m_mode == FRAM::ROM::UNDEFINED)
|
||||
{
|
||||
m_header = setup.header;
|
||||
m_footer = setup.footer;
|
||||
//
|
||||
_status &= m_header.class_id != 0 ? true : false;
|
||||
_status &= m_header.part_id != 0 ? true : false;
|
||||
_status &= m_header.rom_size != 0 ? true : false;
|
||||
_status &= m_header.software_version != 0 ? true : false;
|
||||
_status &= m_footer.magic != 0 ? true : false;
|
||||
//
|
||||
if(_status)
|
||||
{
|
||||
m_mode = FRAM::ROM::OPERATIONAL;
|
||||
//
|
||||
_write_float = &FRAM::ROM::_write_float_undef;
|
||||
_read_float = &FRAM::ROM::_read_float_undef;
|
||||
_write_int = &FRAM::ROM::_write_int_undef;
|
||||
_read_int = &FRAM::ROM::_read_int_undef;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
FRAM::ROM::mode_t ROM::get_mode()
|
||||
{
|
||||
return m_mode;
|
||||
//
|
||||
}//
|
||||
//
|
||||
bool ROM::compare(FRAM::ROM::mode_t mode)
|
||||
{
|
||||
return m_mode == mode;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void ROM::write_float(float data, int16_t addr)
|
||||
{
|
||||
(this->*_write_float)(data, addr);
|
||||
|
||||
//
|
||||
}//
|
||||
//
|
||||
float ROM::read_float(int16_t addr)
|
||||
{
|
||||
return (this->*_read_float)(addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void ROM::write_int(int16_t data, int16_t addr)
|
||||
{
|
||||
(this->*_write_int)(data, addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
int16_t ROM::read_int(int16_t addr)
|
||||
{
|
||||
return (this->*_read_int)(addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void ROM::_write_float_undef(float data, int16_t addr)
|
||||
{}//
|
||||
//
|
||||
void ROM::_write_float_operate(float data, int16_t addr)
|
||||
{
|
||||
writefloat(data, addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
float ROM::_read_float_undef(int16_t addr)
|
||||
{
|
||||
return (float)0.0;
|
||||
}//
|
||||
//
|
||||
float ROM::_read_float_operate(int16_t addr)
|
||||
{
|
||||
return readfloat(addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
void ROM::_write_int_undef(int16_t data, int16_t addr)
|
||||
{}//
|
||||
//
|
||||
void ROM::_write_int_operate(int16_t data, int16_t addr)
|
||||
{
|
||||
writeint(data, addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
int16_t ROM::_read_int_undef(int16_t addr)
|
||||
{
|
||||
return 0;
|
||||
}//
|
||||
//
|
||||
int16_t ROM::_read_int_operate(int16_t addr)
|
||||
{
|
||||
return readint(addr);
|
||||
//
|
||||
}//
|
||||
//
|
||||
} /* namespace FRAM */
|
||||
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* ROM.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
#ifndef FRAM_ROM_H_
|
||||
#define FRAM_ROM_H_
|
||||
|
||||
namespace FRAM
|
||||
{
|
||||
|
||||
|
||||
struct ROMHeader
|
||||
{
|
||||
uint16_t class_id;
|
||||
uint16_t part_id;
|
||||
uint16_t software_version;
|
||||
uint16_t rom_size;
|
||||
ROMHeader():
|
||||
class_id(0),
|
||||
part_id(0),
|
||||
software_version(0),
|
||||
rom_size(0)
|
||||
{}
|
||||
};//ROMHeader
|
||||
|
||||
struct ROMFooter
|
||||
{
|
||||
uint16_t magic;
|
||||
ROMFooter():
|
||||
magic(0)
|
||||
{}
|
||||
};//ROMFooter
|
||||
|
||||
struct ROMSetup
|
||||
{
|
||||
ROMHeader header;
|
||||
ROMFooter footer;
|
||||
ROMSetup():
|
||||
header(),
|
||||
footer()
|
||||
{}
|
||||
};//ROMSetup
|
||||
|
||||
class ROM
|
||||
{
|
||||
public:
|
||||
enum mode_t {UNDEFINED, OPERATIONAL};
|
||||
private:
|
||||
mode_t m_mode;
|
||||
private:
|
||||
ROMHeader m_header;
|
||||
ROMFooter m_footer;
|
||||
uint16_t m_int_last_address;
|
||||
uint16_t m_flt_last_address;
|
||||
public:
|
||||
ROM();
|
||||
void setup(const ROMSetup setup);
|
||||
public:
|
||||
mode_t get_mode();
|
||||
bool compare(mode_t mode);
|
||||
public:
|
||||
void write_float(float data, int16_t addr);
|
||||
float read_float(int16_t addr);
|
||||
void write_int(int16_t data, int16_t addr);
|
||||
int16_t read_int(int16_t addr);
|
||||
private:
|
||||
void (ROM::*_write_float)(float data, int16_t addr);
|
||||
void _write_float_undef(float data, int16_t addr);
|
||||
void _write_float_operate(float data, int16_t addr);
|
||||
private:
|
||||
float (ROM::*_read_float)(int16_t addr);
|
||||
float _read_float_undef(int16_t addr);
|
||||
float _read_float_operate(int16_t addr);
|
||||
private:
|
||||
void (ROM::*_write_int)(int16_t data, int16_t addr);
|
||||
void _write_int_undef(int16_t data, int16_t addr);
|
||||
void _write_int_operate(int16_t data, int16_t addr);
|
||||
private:
|
||||
int16_t (ROM::*_read_int)(int16_t addr);
|
||||
int16_t _read_int_undef(int16_t addr);
|
||||
int16_t _read_int_operate(int16_t addr);
|
||||
|
||||
|
||||
//
|
||||
};// class ROM
|
||||
|
||||
} /* namespace FRAM */
|
||||
|
||||
#endif /* FRAM_ROM_H_ */
|
||||
Binary file not shown.
@ -0,0 +1,209 @@
|
||||
/*****************************************************************************
|
||||
* File Name:framework.c
|
||||
* Author:Zhangdi
|
||||
* Brief:
|
||||
* Note:
|
||||
* Last Updated for Version:
|
||||
* Date of the Last Update:
|
||||
*****************************************************************************/
|
||||
#include"framework.h"
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
** Maco Define
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
** Data Type Define
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
** Global Variable Declare
|
||||
*****************************************************************************/
|
||||
BaudRate comModbusBaudRateSet;
|
||||
Uint16 comModbusADDRSet;
|
||||
ParityMode comModbusParitySet;
|
||||
|
||||
Uint16 cpuCpldVersion;
|
||||
/*****************************************************************************
|
||||
* Brief: Analog input
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
AnalogInput analogInput = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Analog output
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
Uint16 a2001_2005 = 0;
|
||||
Uint16 a2002_2006 = 0;
|
||||
Uint16 a2003_2007 = 0;
|
||||
Uint16 a2004_2008 = 0;
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Digital input interface
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
DigitalInput digitalInput = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Digital output interface
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
DigitalOuput digitalOutput = { 0xffff };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus output coils buffer
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
Uint16 readCoils[300] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus input coils buffer
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
Uint16 writeCoils[300] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus output registers buffer
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
Uint16 readRegisters[300] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus input registers buffer
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
Uint16 writeRegisters[300] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Event for modbus state machine
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
hsmEvent etmp;
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus object
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
MODBUS_RTU_SLAVE modbusHMI;
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus event list
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
hsmEvent eBufferHMI[50];
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: modbus port object
|
||||
* Note:
|
||||
*****************************************************************************/
|
||||
MODBUS_RTU_PORT_INFOR modbusHMIPort = { 5, B9600, NO_PARITY,
|
||||
&(ScibRegs.SCIRXBUF.all), &(ScibRegs.SCITXBUF), 21, &(ScibRegs) };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Ecan data buffer. These data transport from cpu to communication
|
||||
* board.
|
||||
* Note: These data used for communication board modbus output coils.
|
||||
*****************************************************************************/
|
||||
Uint16 canData_cpu2com_coils[16] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Ecan data buffer. These data transport from cpu to communication
|
||||
* board.
|
||||
* Note: These data used for communication board modbus output registers.
|
||||
*****************************************************************************/
|
||||
Uint16 canData_cpu2com_registers[50] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Ecan data buffer. These data transport from communication board to
|
||||
* cpu board.
|
||||
* Note: These data are input coils data received by communication board modbus.
|
||||
*****************************************************************************/
|
||||
Uint16 canData_com2cpu_coils[16] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
* Brief: Ecan data buffer. These data transport from communication board to
|
||||
* cpu board.
|
||||
* Note: These data are input registers data received by communication board
|
||||
* modbus.
|
||||
*****************************************************************************/
|
||||
Uint16 canData_com2cpu_registers[50] = { 0 };
|
||||
|
||||
/*****************************************************************************
|
||||
** Global Function Declare
|
||||
*****************************************************************************/
|
||||
void frameworkDataInit(void)
|
||||
{
|
||||
Uint32 i;
|
||||
int16 *p;
|
||||
|
||||
p = (int16 *)&analogInput;
|
||||
for(i = 0; i < sizeof(analogInput) / sizeof(int16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
a2001_2005 = 0;
|
||||
a2002_2006 = 0;
|
||||
a2003_2007 = 0;
|
||||
a2004_2008 = 0;
|
||||
|
||||
digitalInput.all = 0xffffffff;
|
||||
digitalOutput.all = 0xffffffff;
|
||||
|
||||
p = (int16 *)readCoils;
|
||||
for(i = 0; i < sizeof(readCoils) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
p = (int16 *)writeCoils;
|
||||
for(i = 0; i < sizeof(writeCoils) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
p = (int16 *)readRegisters;
|
||||
for(i = 0; i < sizeof(readRegisters) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
p = (int16 *)writeRegisters;
|
||||
for(i = 0; i < sizeof(writeRegisters) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
etmp.signal = 0;
|
||||
|
||||
p = (int16 *)canData_cpu2com_coils;
|
||||
for(i = 0; i < sizeof(canData_cpu2com_coils) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
p = (int16 *)canData_cpu2com_registers;
|
||||
for(i = 0; i < sizeof(canData_cpu2com_registers) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
p = (int16 *)canData_com2cpu_coils;
|
||||
for(i = 0; i < sizeof(canData_com2cpu_coils) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
p = (int16 *)canData_com2cpu_registers;
|
||||
for(i = 0; i < sizeof(canData_com2cpu_registers) / sizeof(Uint16); i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
}
|
||||
}
|
||||
/*****************************************************************************
|
||||
** Local Function Declare
|
||||
*****************************************************************************/
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* HALBase.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "HAL/HALBase.h"
|
||||
|
||||
namespace HAL
|
||||
{
|
||||
|
||||
//CONSTRUCTOR
|
||||
HALBase::HALBase():
|
||||
m_mode(HAL::HALBase::UNDEFINED),
|
||||
m_status(false)
|
||||
//
|
||||
{}//end CONSTRUCTOR
|
||||
//
|
||||
HAL::HALBase::mode_t HAL::HALBase::get_mode() const
|
||||
{
|
||||
|
||||
return m_mode;
|
||||
//
|
||||
}//end
|
||||
//
|
||||
bool HAL::HALBase::compare(HAL::HALBase::mode_t mode) const
|
||||
{
|
||||
return m_mode == mode;
|
||||
//
|
||||
}//end
|
||||
//
|
||||
} /* namespace HAL */
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* HALBase.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
//
|
||||
#include "F28335/DSP28x_Project.h"
|
||||
|
||||
#ifndef HAL_HALVIRTUAL_H_
|
||||
#define HAL_HALVIRTUAL_H_
|
||||
|
||||
namespace HAL
|
||||
{
|
||||
|
||||
typedef void (*pGPIO_FUNCTION)();
|
||||
|
||||
|
||||
struct HALSetup
|
||||
{
|
||||
pGPIO_FUNCTION gpio_setup;
|
||||
HALSetup():
|
||||
gpio_setup(0)
|
||||
{}
|
||||
};//HALSetup
|
||||
|
||||
|
||||
class HALBase
|
||||
{
|
||||
public:
|
||||
enum mode_t {UNDEFINED=0, OPERATIONAL=1};
|
||||
protected:
|
||||
mode_t m_mode;
|
||||
bool m_status;
|
||||
public:
|
||||
HALBase();
|
||||
public:
|
||||
mode_t get_mode() const;
|
||||
bool compare(mode_t mode) const;
|
||||
//
|
||||
};//end class HALVirtual
|
||||
|
||||
} /* namespace HAL */
|
||||
|
||||
#endif /* HAL_HALVIRTUAL_H_ */
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* RUBUS.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "MODBUSRTU/RUBUS.h"
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
//CONSTRUCTOR
|
||||
RUBUS::RUBUS(uint16_t len):
|
||||
mode(MODBUSRTU::RUBUS::RUBUS_RESET),
|
||||
size(len),
|
||||
accepted(),
|
||||
response_shadow(),
|
||||
response(),
|
||||
mask(),
|
||||
m_cell(),
|
||||
cell_data(0)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
//
|
||||
//
|
||||
} /* namespace MODBUSRTU */
|
||||
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* RUBUS.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef MODBUSRTU_RUBUS_H_
|
||||
#define MODBUSRTU_RUBUS_H_
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
#include "SYSCTRL/SystemEnvironment.h"
|
||||
#include "MODBUSRTU/RUBUSRegister.h"
|
||||
#include "MODBUSRTU/RUBUSTypes.h"
|
||||
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
struct RUBUS_ACCEPTED_DATA
|
||||
{
|
||||
RUBUS_REGISTER_16 command_start;
|
||||
RUBUS_REGISTER_16 command_end;
|
||||
uint16_t index;
|
||||
RUBUS_REGISTER_16 id;
|
||||
RUBUS_REGISTER_16 com;
|
||||
RUBUS_REGISTER_32 data;
|
||||
RUBUS_ACCEPTED_DATA():
|
||||
command_start(0),
|
||||
command_end(0),
|
||||
index(0),
|
||||
id(0),
|
||||
com(0),
|
||||
data(0)
|
||||
{}
|
||||
};//RUBUS_ACCEPTED_DATA
|
||||
|
||||
|
||||
struct RUBUS_MASK
|
||||
{
|
||||
RUBUS_REGISTER_16 error_response;
|
||||
RUBUS_REGISTER_16 rubus_bool;
|
||||
RUBUS_REGISTER_16 rubus_float;
|
||||
RUBUS_REGISTER_16 rubus_uint8;
|
||||
RUBUS_REGISTER_16 rubus_uint16;
|
||||
RUBUS_REGISTER_16 rubus_uint32;
|
||||
RUBUS_REGISTER_16 rubus_int8;
|
||||
RUBUS_REGISTER_16 rubus_int16;
|
||||
RUBUS_REGISTER_16 rubus_int32;
|
||||
RUBUS_MASK():
|
||||
error_response(0x80),
|
||||
rubus_bool(0x0000),
|
||||
rubus_float(0x0002),
|
||||
rubus_uint8(0x0004),
|
||||
rubus_uint16(0x0006),
|
||||
rubus_uint32(0x0008),
|
||||
rubus_int8(0x000A),
|
||||
rubus_int16(0x00C),
|
||||
rubus_int32(0x000E)
|
||||
{}
|
||||
};//RUBUS_MASK
|
||||
|
||||
|
||||
|
||||
struct RUBUS_RESPONSE
|
||||
{
|
||||
RUBUS_REGISTER_16 command;
|
||||
uint16_t index;
|
||||
RUBUS_REGISTER_32 data;
|
||||
RUBUS_RESPONSE():
|
||||
command(0),
|
||||
index(0),
|
||||
data(0)
|
||||
{}
|
||||
};//RUBUS_RESPONSE
|
||||
|
||||
|
||||
|
||||
|
||||
struct RUBUS
|
||||
{
|
||||
enum mode_rubus_t {RUBUS_RESET, RUBUS_READ, RUBUS_WRITE, RUBUS_ERROR};
|
||||
mode_rubus_t mode;
|
||||
uint16_t size;
|
||||
RUBUS_ACCEPTED_DATA accepted;
|
||||
RUBUS_RESPONSE response_shadow;
|
||||
RUBUS_RESPONSE response;
|
||||
const RUBUS_MASK mask;
|
||||
MODBUSRTU::RUBUSRegister m_cell;
|
||||
RUBUS_REGISTER_32 cell_data;
|
||||
RUBUS(uint16_t size);
|
||||
};
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
|
||||
#endif /* MODBUSRTU_RUBUS_H_ */
|
||||
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* RUBUSCOPE.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "MODBUSRTU/RUBUSCOPE.h"
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
RUBUSCOPE::RUBUSCOPE(SYSCTRL::SystemEnvironment& env):
|
||||
m_env(env),
|
||||
m_len(RUBUSCOPEARRAYLEN),
|
||||
m_channels()
|
||||
{}//CONSTRUCTOR
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* RUBUSCOPE.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef MODBUSRTU_RUBUSCOPE_H_
|
||||
#define MODBUSRTU_RUBUSCOPE_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
#include "SYSCTRL/SystemEnvironment.h"
|
||||
#include "MODBUSRTU/RUBUSRegister.h"
|
||||
#include "MODBUSRTU/RUBUSTypes.h"
|
||||
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
#define RUBUSCOPEARRAYLEN 100
|
||||
|
||||
struct RUBUSCOPEVariables
|
||||
{
|
||||
uint16_t command;
|
||||
uint16_t response;
|
||||
uint16_t channel;
|
||||
uint16_t pointer;
|
||||
float data;
|
||||
RUBUSCOPEVariables(){}
|
||||
};//RUBUSCOPEVariables
|
||||
|
||||
|
||||
|
||||
class RUBUSCOPE
|
||||
{
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
uint16_t m_len;
|
||||
float m_channels[9][RUBUSCOPEARRAYLEN];
|
||||
public:
|
||||
RUBUSCOPE(SYSCTRL::SystemEnvironment& env);
|
||||
};
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
|
||||
#endif /* MODBUSRTU_RUBUSCOPE_H_ */
|
||||
@ -0,0 +1,565 @@
|
||||
/*
|
||||
* RUBUSDataBase.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "MODBUSRTU/RUBUSDataBase.h"
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
RUBUSDataBase::RUBUSDataBase():
|
||||
m_cell(),
|
||||
m_current_index_cell(0),
|
||||
m_index_cell(0),
|
||||
m_counter_cell(0),
|
||||
m_size_cell(NUMBER_RUBUSCELLS)
|
||||
{}//
|
||||
|
||||
|
||||
void RUBUSDataBase::add_register_bool (uint16_t index, uint16_t readonly, bool* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bool(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_float (uint16_t index, uint16_t readonly, float* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_float(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_uint8 (uint16_t index, uint16_t readonly, uint8_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_uint8(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_uint16(uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_uint16(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_uint32(uint16_t index, uint16_t readonly, uint32_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_uint32(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_int8 (uint16_t index, uint16_t readonly, int8_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_int8(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_int16 (uint16_t index, uint16_t readonly, int16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_int16(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_int32 (uint16_t index, uint16_t readonly, int32_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_int32(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
|
||||
|
||||
|
||||
void RUBUSDataBase::add_register_bit0 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit0(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit1 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit1(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit2 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit2(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit3 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit3(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit4 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit4(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit5 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit5(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit6 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit6(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit7 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit7(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit8 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit8(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit9 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit9(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit10 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit10(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit11 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit11(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit12 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit12(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit13 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit13(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit14 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit14(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit15 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit15(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit16 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit16(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit17 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit17(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit18 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit18(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit19 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit19(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit20 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit20(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit21 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit21(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit22 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit22(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit23 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit23(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit24 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit24(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit25 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit25(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit26 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit26(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit27 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit27(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit28 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit28(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit29 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit29(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit30 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit30(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSDataBase::add_register_bit31 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
if(m_counter_cell < m_size_cell)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_counter_cell];
|
||||
cell.register_bit31(index, readonly, param);
|
||||
m_counter_cell++;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
//#pragma CODE_SECTION("ramfuncs");
|
||||
MODBUSRTU::RUBUSRegister& RUBUSDataBase::get_register(uint16_t index)
|
||||
{
|
||||
m_current_index_cell = 0;
|
||||
for(m_index_cell = 0; m_index_cell < m_counter_cell; m_index_cell++)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_index_cell];
|
||||
if(cell.get_index() == index)
|
||||
{
|
||||
m_current_index_cell = m_index_cell;
|
||||
break;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//for
|
||||
//
|
||||
return m_cell[m_current_index_cell];
|
||||
//
|
||||
}//
|
||||
//
|
||||
//#pragma CODE_SECTION("ramfuncs");
|
||||
void RUBUSDataBase::read_register(uint16_t index, RUBUS_REGISTER_32& data)
|
||||
{
|
||||
m_current_index_cell = 0;
|
||||
for(m_index_cell = 0; m_index_cell < m_counter_cell; m_index_cell++)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_index_cell];
|
||||
if(cell.get_index() == index)
|
||||
{
|
||||
m_current_index_cell = m_index_cell;
|
||||
break;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//for
|
||||
//
|
||||
data.all = m_cell[m_current_index_cell].read_register().all;
|
||||
//
|
||||
}//
|
||||
//
|
||||
//#pragma CODE_SECTION("ramfuncs");
|
||||
uint16_t RUBUSDataBase::write_register(uint16_t index, RUBUS_REGISTER_32 data)
|
||||
{
|
||||
m_current_index_cell = 0;
|
||||
for(m_index_cell = 0; m_index_cell < m_counter_cell; m_index_cell++)
|
||||
{
|
||||
MODBUSRTU::RUBUSRegister& cell = m_cell[m_index_cell];
|
||||
if(cell.get_index() == index)
|
||||
{
|
||||
m_current_index_cell = m_index_cell;
|
||||
break;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//for
|
||||
//
|
||||
return m_cell[m_current_index_cell].write_register(data.all);
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* RUBUSDataBase.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef MODBUSRTU_RUBUSDATABASE_H_
|
||||
#define MODBUSRTU_RUBUSDATABASE_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
#include "SYSCTRL/SystemEnvironment.h"
|
||||
|
||||
#include "MODBUSRTU/RUBUSTypes.h"
|
||||
#include "MODBUSRTU/RUBUSRegister.h"
|
||||
|
||||
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
#define NUMBER_RUBUSCELLS ((uint16_t)(420))
|
||||
|
||||
class RUBUSDataBase
|
||||
{
|
||||
private:
|
||||
MODBUSRTU::RUBUSRegister m_cell[NUMBER_RUBUSCELLS];
|
||||
uint16_t m_current_index_cell;
|
||||
uint16_t m_index_cell;
|
||||
uint16_t m_counter_cell;
|
||||
uint16_t m_size_cell;
|
||||
public:
|
||||
RUBUSDataBase();
|
||||
public:
|
||||
void configurate();
|
||||
public:
|
||||
void add_register_bool (uint16_t index, uint16_t readonly, bool* param);
|
||||
void add_register_float (uint16_t index, uint16_t readonly, float* param);
|
||||
void add_register_uint8 (uint16_t index, uint16_t readonly, uint8_t* param);
|
||||
void add_register_uint16(uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_uint32(uint16_t index, uint16_t readonly, uint32_t* param);
|
||||
void add_register_int8 (uint16_t index, uint16_t readonly, int8_t* param);
|
||||
void add_register_int16 (uint16_t index, uint16_t readonly, int16_t* param);
|
||||
void add_register_int32 (uint16_t index, uint16_t readonly, int32_t* param);
|
||||
void add_register_bit0 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit1 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit2 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit3 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit4 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit5 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit6 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit7 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit8 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit9 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit10 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit11 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit12 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit13 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit14 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit15 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit16 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit17 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit18 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit19 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit20 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit21 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit22 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit23 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit24 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit25 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit26 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit27 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit28 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit29 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit30 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void add_register_bit31 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
public:
|
||||
MODBUSRTU::RUBUSRegister& get_register(uint16_t index);
|
||||
void read_register(uint16_t index, RUBUS_REGISTER_32& data);
|
||||
uint16_t write_register(uint16_t index, RUBUS_REGISTER_32 data);
|
||||
};
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
|
||||
#endif /* MODBUSRTU_RUBUSDATABASE_H_ */
|
||||
@ -0,0 +1,862 @@
|
||||
/*
|
||||
* RUBUSCell.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "MODBUSRTU/RUBUSRegister.h"
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
RUBUSRegister::RUBUSRegister():
|
||||
m_index(0),
|
||||
m_is_read_only(true),
|
||||
m_param(0),
|
||||
m_type(MODBUSRTU::RUBUS_UNDEFINED)
|
||||
{}//CONSTRUCTOR
|
||||
|
||||
RUBUSRegister::RUBUSRegister(const RUBUSRegister& copyregister):
|
||||
m_index(copyregister.m_index),
|
||||
m_is_read_only(copyregister.m_is_read_only),
|
||||
m_param(copyregister.m_param),
|
||||
m_type(copyregister.m_type)
|
||||
{}
|
||||
|
||||
|
||||
void RUBUSRegister::register_bool (uint16_t index, uint16_t readonly, bool* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BOOL;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_float (uint16_t index, uint16_t readonly, float* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_FLOAT;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_uint8 (uint16_t index, uint16_t readonly, uint8_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_UINT8;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_uint16(uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_UINT16;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_uint32(uint16_t index, uint16_t readonly, uint32_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_UINT32;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_int8 (uint16_t index, uint16_t readonly, int8_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_INT8;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_int16 (uint16_t index, uint16_t readonly, int16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_INT16;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_int32 (uint16_t index, uint16_t readonly, int32_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_INT32;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit0 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT0;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit1 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT1;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit2 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT2;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit3 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT3;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit4 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT4;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit5 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT5;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit6 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT6;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit7 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT7;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit8 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT8;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit9 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT9;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit10 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT10;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit11 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT11;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit12 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT12;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit13 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT13;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit14 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT14;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit15 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT15;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit16 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT16;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit17 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT17;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit18 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT18;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit19 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT19;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit20 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT20;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit21 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT21;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit22 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT22;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit23 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT23;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit24 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT24;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit25 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT25;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit26 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT26;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit27 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT27;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit28 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT28;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit29 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT29;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit30 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT30;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void RUBUSRegister::register_bit31 (uint16_t index, uint16_t readonly, uint16_t* param)
|
||||
{
|
||||
m_index = index;
|
||||
m_param = param;
|
||||
m_type = MODBUSRTU::RUBUS_BIT31;
|
||||
m_is_read_only = readonly == 0 ? false : true;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
uint16_t RUBUSRegister::get_index()
|
||||
{
|
||||
return m_index;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
bool RUBUSRegister::is_read_only()
|
||||
{
|
||||
return m_is_read_only;
|
||||
}//
|
||||
//
|
||||
|
||||
MODBUSRTU::rubus_variant_type_t RUBUSRegister::get_type()
|
||||
{
|
||||
return m_type;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
MODBUSRTU::RUBUS_REGISTER_32 RUBUSRegister::read_register()
|
||||
{
|
||||
|
||||
MODBUSRTU::RUBUS_REGISTER_32 _temp = MODBUSRTU::RUBUS_REGISTER_32(0);
|
||||
_temp.word.wL.all = 0x0000;
|
||||
_temp.word.wH.all = 0x0000;
|
||||
|
||||
|
||||
switch(m_type)
|
||||
{
|
||||
case MODBUSRTU::RUBUS_BOOL: { _temp.b = *((bool*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_FLOAT: { _temp.f = *((float*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_UINT8: { _temp.u8 = *((uint8_t*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_UINT16: { _temp.u16 = *((uint16_t*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_UINT32: { _temp.u32 = *((uint32_t*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_INT8: { _temp.i8 = *((int8_t*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_INT16: { _temp.i16 = *((int16_t*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_INT32: { _temp.i32 = *((int32_t*) m_param); break;}
|
||||
case MODBUSRTU::RUBUS_BIT0:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0001);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT1:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0002);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT2:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0004);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT3:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0008);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT4:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0010);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT5:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0020);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT6:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0040);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT7:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0080);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT8:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0100);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT9:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0200);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT10:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0400);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT11:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x0800);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT12:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x1000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT13:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x2000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT14:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x4000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT15:
|
||||
{
|
||||
_read_bit(_temp.word.wL.all, 0x8000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT16:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0001);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT17:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0002);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT18:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0004);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT19:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0008);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT20:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0010);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT21:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0020);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT22:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0040);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT23:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0080);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT24:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0100);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT25:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0200);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT26:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0400);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT27:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x0800);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT28:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x1000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT29:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x2000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT30:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x4000);
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT31:
|
||||
{
|
||||
_read_bit(_temp.word.wH.all, 0x8000);
|
||||
break;
|
||||
}
|
||||
}//switch
|
||||
//
|
||||
return _temp.all;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
uint16_t RUBUSRegister::write_register(MODBUSRTU::RUBUS_REGISTER_32 data)
|
||||
{
|
||||
|
||||
MODBUSRTU::RUBUS_REGISTER_32 _temp = MODBUSRTU::RUBUS_REGISTER_32(0);
|
||||
_temp.word.wL.all = 0x0000;
|
||||
_temp.word.wH.all = 0x0000;
|
||||
|
||||
if(m_is_read_only)
|
||||
{
|
||||
// register is read only
|
||||
// write operation is not allowed
|
||||
return 0x0040;
|
||||
}
|
||||
else
|
||||
{
|
||||
// writeable register
|
||||
switch(m_type)
|
||||
{
|
||||
case MODBUSRTU::RUBUS_BOOL: { *((bool*) m_param) = data.b; break;}
|
||||
case MODBUSRTU::RUBUS_FLOAT: { *((float*) m_param) = data.f; break;}
|
||||
case MODBUSRTU::RUBUS_UINT8: { *((uint8_t*) m_param) = data.u8; break;}
|
||||
case MODBUSRTU::RUBUS_UINT16: { *((uint16_t*) m_param) = data.u16; break;}
|
||||
case MODBUSRTU::RUBUS_UINT32: { *((uint32_t*) m_param) = data.u32; break;}
|
||||
case MODBUSRTU::RUBUS_INT8: { *((int8_t*) m_param) = data.i8; break;}
|
||||
case MODBUSRTU::RUBUS_INT16: { *((int16_t*) m_param) = data.i16; break;}
|
||||
case MODBUSRTU::RUBUS_INT32: { *((int32_t*) m_param) = data.i32; break;}
|
||||
case MODBUSRTU::RUBUS_BIT0:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b00 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = data.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT1:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b01 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT2:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b02 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT3:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b03 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT4:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b04 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT5:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b05 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT6:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b06 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT7:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b07 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT8:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b08 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT9:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b09 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT10:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b10 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT11:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b11 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT12:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b12 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT13:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b13 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT14:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b14 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT15:
|
||||
{
|
||||
_temp.u16 = *((uint16_t*) m_param);
|
||||
_temp.bit16.b15 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.u16;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT16:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b16 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT17:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b17 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT18:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b18 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT19:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b19 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT20:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b20 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT21:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b21 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT22:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b22 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT23:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b23 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT24:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b24 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT25:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b25 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT26:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b26 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT27:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b27 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT28:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b28 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT29:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b29 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT30:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b30 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
case MODBUSRTU::RUBUS_BIT31:
|
||||
{
|
||||
_temp.word.wH.all = *((uint16_t*) m_param);
|
||||
_temp.bit32.b31 = data.bit16.b00;
|
||||
*((uint16_t*) m_param) = _temp.word.wH.all;
|
||||
break;
|
||||
}
|
||||
}//switch
|
||||
//
|
||||
return 0;
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
inline void RUBUSRegister::_read_bit(uint16_t& auxreg, uint16_t mask)
|
||||
{
|
||||
auxreg = *((uint16_t*) m_param);
|
||||
auxreg &= mask;
|
||||
auxreg = auxreg == 0 ? 0 : 1;
|
||||
//
|
||||
}//
|
||||
//
|
||||
//
|
||||
} /* namespace MODBUSRTU */
|
||||
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* RUBUSCell.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef MODBUSRTU_RUBUSREGISTER_H_
|
||||
#define MODBUSRTU_RUBUSREGISTER_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
#include "SYSCTRL/SystemEnvironment.h"
|
||||
#include "MODBUSRTU/RUBUSTypes.h"
|
||||
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
class RUBUSRegister
|
||||
{
|
||||
private:
|
||||
uint16_t m_index;
|
||||
bool m_is_read_only;
|
||||
void* m_param;
|
||||
rubus_variant_type_t m_type;
|
||||
public:
|
||||
RUBUSRegister();
|
||||
RUBUSRegister(const RUBUSRegister& cell);
|
||||
public:
|
||||
void register_bool (uint16_t index, uint16_t readonly, bool* param);
|
||||
void register_float (uint16_t index, uint16_t readonly, float* param);
|
||||
void register_uint8 (uint16_t index, uint16_t readonly, uint8_t* param);
|
||||
void register_uint16(uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_uint32(uint16_t index, uint16_t readonly, uint32_t* param);
|
||||
void register_int8 (uint16_t index, uint16_t readonly, int8_t* param);
|
||||
void register_int16 (uint16_t index, uint16_t readonly, int16_t* param);
|
||||
void register_int32 (uint16_t index, uint16_t readonly, int32_t* param);
|
||||
void register_bit0 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit1 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit2 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit3 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit4 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit5 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit6 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit7 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit8 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit9 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit10 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit11 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit12 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit13 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit14 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit15 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit16 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit17 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit18 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit19 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit20 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit21 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit22 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit23 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit24 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit25 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit26 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit27 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit28 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit29 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit30 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
void register_bit31 (uint16_t index, uint16_t readonly, uint16_t* param);
|
||||
public:
|
||||
uint16_t get_index();
|
||||
bool is_read_only();
|
||||
MODBUSRTU::rubus_variant_type_t get_type();
|
||||
public:
|
||||
MODBUSRTU::RUBUS_REGISTER_32 read_register();
|
||||
uint16_t write_register(MODBUSRTU::RUBUS_REGISTER_32 data);
|
||||
private:
|
||||
inline void _read_bit(uint16_t& auxreg, uint16_t mask);
|
||||
//
|
||||
};//
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
|
||||
#endif /* MODBUSRTU_RUBUSREGISTER_H_ */
|
||||
|
||||
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* RUBUSTypes.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef MODBUSRTU_RUBUSTYPES_H_
|
||||
#define MODBUSRTU_RUBUSTYPES_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
|
||||
namespace MODBUSRTU
|
||||
{
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
|
||||
|
||||
enum rubus_variant_type_t { RUBUS_UNDEFINED,
|
||||
RUBUS_BOOL,
|
||||
RUBUS_FLOAT,
|
||||
RUBUS_UINT8,
|
||||
RUBUS_UINT16,
|
||||
RUBUS_UINT32,
|
||||
RUBUS_INT8,
|
||||
RUBUS_INT16,
|
||||
RUBUS_INT32,
|
||||
RUBUS_BIT0,
|
||||
RUBUS_BIT1,
|
||||
RUBUS_BIT2,
|
||||
RUBUS_BIT3,
|
||||
RUBUS_BIT4,
|
||||
RUBUS_BIT5,
|
||||
RUBUS_BIT6,
|
||||
RUBUS_BIT7,
|
||||
RUBUS_BIT8,
|
||||
RUBUS_BIT9,
|
||||
RUBUS_BIT10,
|
||||
RUBUS_BIT11,
|
||||
RUBUS_BIT12,
|
||||
RUBUS_BIT13,
|
||||
RUBUS_BIT14,
|
||||
RUBUS_BIT15,
|
||||
RUBUS_BIT16,
|
||||
RUBUS_BIT17,
|
||||
RUBUS_BIT18,
|
||||
RUBUS_BIT19,
|
||||
RUBUS_BIT20,
|
||||
RUBUS_BIT21,
|
||||
RUBUS_BIT22,
|
||||
RUBUS_BIT23,
|
||||
RUBUS_BIT24,
|
||||
RUBUS_BIT25,
|
||||
RUBUS_BIT26,
|
||||
RUBUS_BIT27,
|
||||
RUBUS_BIT28,
|
||||
RUBUS_BIT29,
|
||||
RUBUS_BIT30,
|
||||
RUBUS_BIT31};
|
||||
|
||||
|
||||
struct RUBUS_REGISTER_16_BIT_FIELD
|
||||
{
|
||||
uint16_t b00: 1;
|
||||
uint16_t b01: 1;
|
||||
uint16_t b02: 1;
|
||||
uint16_t b03: 1;
|
||||
uint16_t b04: 1;
|
||||
uint16_t b05: 1;
|
||||
uint16_t b06: 1;
|
||||
uint16_t b07: 1;
|
||||
uint16_t b08: 1;
|
||||
uint16_t b09: 1;
|
||||
uint16_t b10: 1;
|
||||
uint16_t b11: 1;
|
||||
uint16_t b12: 1;
|
||||
uint16_t b13: 1;
|
||||
uint16_t b14: 1;
|
||||
uint16_t b15: 1;
|
||||
};//RUBUS_REGISTER_16_BIT_FIELD
|
||||
|
||||
struct RUBUS_REGISTER_32_BIT_FIELD
|
||||
{
|
||||
uint32_t b00: 1;
|
||||
uint32_t b01: 1;
|
||||
uint32_t b02: 1;
|
||||
uint32_t b03: 1;
|
||||
uint32_t b04: 1;
|
||||
uint32_t b05: 1;
|
||||
uint32_t b06: 1;
|
||||
uint32_t b07: 1;
|
||||
uint32_t b08: 1;
|
||||
uint32_t b09: 1;
|
||||
uint32_t b10: 1;
|
||||
uint32_t b11: 1;
|
||||
uint32_t b12: 1;
|
||||
uint32_t b13: 1;
|
||||
uint32_t b14: 1;
|
||||
uint32_t b15: 1;
|
||||
uint32_t b16: 1;
|
||||
uint32_t b17: 1;
|
||||
uint32_t b18: 1;
|
||||
uint32_t b19: 1;
|
||||
uint32_t b20: 1;
|
||||
uint32_t b21: 1;
|
||||
uint32_t b22: 1;
|
||||
uint32_t b23: 1;
|
||||
uint32_t b24: 1;
|
||||
uint32_t b25: 1;
|
||||
uint32_t b26: 1;
|
||||
uint32_t b27: 1;
|
||||
uint32_t b28: 1;
|
||||
uint32_t b29: 1;
|
||||
uint32_t b30: 1;
|
||||
uint32_t b31: 1;
|
||||
};//RUBUS_REGISTER_32_BIT_FIELD
|
||||
|
||||
|
||||
struct RUBUS_REGISTER_16_BYTE_FIELD
|
||||
{
|
||||
uint16_t bt0 :8;
|
||||
uint16_t bt1 :8;
|
||||
};//RUBUS_REGISTER_16_BYTE_FIELD
|
||||
|
||||
union RUBUS_REGISTER_16
|
||||
{
|
||||
uint16_t all;
|
||||
RUBUS_REGISTER_16_BIT_FIELD bit;
|
||||
RUBUS_REGISTER_16_BYTE_FIELD byte;
|
||||
RUBUS_REGISTER_16(uint16_t val):
|
||||
all(val)
|
||||
{}
|
||||
};//RUBUS_REGISTER_16
|
||||
|
||||
|
||||
struct RUBUS_REGISTER_32_BYTE_FIELD
|
||||
{
|
||||
uint16_t bt0 :8;
|
||||
uint16_t bt1 :8;
|
||||
uint16_t bt2 :8;
|
||||
uint16_t bt3 :8;
|
||||
};//RUBUS_REGISTER_32_BYTE_FIELD
|
||||
|
||||
|
||||
union RUBUS_REGISTER_16_WORD
|
||||
{
|
||||
uint16_t all;
|
||||
RUBUS_REGISTER_16_BIT_FIELD bit;
|
||||
RUBUS_REGISTER_16_BYTE_FIELD byte;
|
||||
};//RUBUS_REGISTER_16_WORD
|
||||
|
||||
|
||||
|
||||
|
||||
struct RUBUS_REGISTER_32_WORD_FIELD
|
||||
{
|
||||
RUBUS_REGISTER_16_WORD wL;
|
||||
RUBUS_REGISTER_16_WORD wH;
|
||||
};//RUBUS_REGISTER_32_WORD_FIELD
|
||||
|
||||
union RUBUS_REGISTER_32
|
||||
{
|
||||
uint32_t all;
|
||||
bool b;
|
||||
float f;
|
||||
uint8_t u8;
|
||||
uint16_t u16;
|
||||
uint32_t u32;
|
||||
int8_t i8;
|
||||
int16_t i16;
|
||||
int32_t i32;
|
||||
RUBUS_REGISTER_16_BIT_FIELD bit16;
|
||||
RUBUS_REGISTER_32_BIT_FIELD bit32;
|
||||
RUBUS_REGISTER_32_WORD_FIELD word;
|
||||
RUBUS_REGISTER_32_BYTE_FIELD byte;
|
||||
RUBUS_REGISTER_32():
|
||||
all((uint32_t)0)
|
||||
{};
|
||||
RUBUS_REGISTER_32(uint32_t val):
|
||||
all(val)
|
||||
{}
|
||||
};//RUBUS_REGISTER_32
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} /* namespace MODBUSRTU */
|
||||
|
||||
#endif /* MODBUSRTU_RUBUSTYPES_H_ */
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* ALERTHeaders.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#ifndef ALERT_ALERTHEADERS_H_
|
||||
#define ALERT_ALERTHEADERS_H_
|
||||
|
||||
#include "Alert/AlertBase.h"
|
||||
#include "Alert/FaultDecrease.h"
|
||||
#include "Alert/FaultExceed.h"
|
||||
#include "Alert/WarningDecrease.h"
|
||||
#include "Alert/WarningExceed.h"
|
||||
|
||||
|
||||
#endif /* ALERT_ALERTHEADERS_H_ */
|
||||
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* AlgorithmBase.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmBase::AlgorithmBase():
|
||||
m_voltage_a(FP_ZERO),
|
||||
m_voltage_b(FP_ZERO),
|
||||
m_voltage_c(FP_ZERO)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmBase::get_ref_invertor_voltage(float& volt_a, float& volt_b, float& volt_c)
|
||||
{
|
||||
volt_a = m_voltage_a;
|
||||
volt_b = m_voltage_b;
|
||||
volt_c = m_voltage_c;
|
||||
//
|
||||
}//end
|
||||
//
|
||||
void AlgorithmBase::_execute_undef(){}
|
||||
//
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* AlgorithmBase.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "SYSCTRL/SystemEnvironment.h"
|
||||
|
||||
#ifndef SYSCTRL_ALGORITHMBASE_H_
|
||||
#define SYSCTRL_ALGORITHMBASE_H_
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
class AlgorithmBase
|
||||
{
|
||||
protected:
|
||||
float m_voltage_a;
|
||||
float m_voltage_b;
|
||||
float m_voltage_c;
|
||||
public:
|
||||
AlgorithmBase();
|
||||
public:
|
||||
virtual void setup() = 0;
|
||||
public:
|
||||
virtual void reset() = 0;
|
||||
public:
|
||||
void get_ref_invertor_voltage(float& volt_a, float& volt_b, float& volt_c);
|
||||
public:
|
||||
virtual void execute() = 0;
|
||||
protected:
|
||||
void _execute_undef();
|
||||
virtual void _execute_run() = 0;
|
||||
//
|
||||
};//AlgorithmBase
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGORITHMBASE_H_ */
|
||||
@ -0,0 +1,701 @@
|
||||
/*
|
||||
* AlgorithmContext.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmContext.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmContext::AlgorithmContext(SYSCTRL::SystemEnvironment& env):
|
||||
m_mode(SYSCTRL::AlgorithmContext::UNDEFINED),
|
||||
m_algorithm(SYSCTRL::AlgorithmContext::UNKNOWN),
|
||||
m_algorithm_previous(SYSCTRL::AlgorithmContext::UNKNOWN),
|
||||
m_env(env),
|
||||
m_algorithm_pointer(&m_off),
|
||||
m_fault(env),
|
||||
m_work(env),
|
||||
m_stop(env),
|
||||
m_start(env),
|
||||
m_off(env),
|
||||
m_source(env),
|
||||
_strategy(&SYSCTRL::AlgorithmContext::_strategy_undef),
|
||||
_set_fault(&SYSCTRL::AlgorithmContext::_set_empty_exe),
|
||||
_set_work(&SYSCTRL::AlgorithmContext::_set_empty_exe),
|
||||
_set_stop(&SYSCTRL::AlgorithmContext::_set_empty_exe),
|
||||
_set_start(&SYSCTRL::AlgorithmContext::_set_empty_exe),
|
||||
_set_off(&SYSCTRL::AlgorithmContext::_set_empty_exe),
|
||||
_set_source(&SYSCTRL::AlgorithmContext::_set_empty_exe)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
|
||||
|
||||
void AlgorithmContext::setup()
|
||||
{
|
||||
static bool status = true;
|
||||
if(m_mode == SYSCTRL::AlgorithmContext::UNDEFINED)
|
||||
{
|
||||
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::UNKNOWN;
|
||||
m_algorithm_previous = SYSCTRL::AlgorithmContext::UNKNOWN;
|
||||
|
||||
m_fault.setup();
|
||||
m_work.setup();
|
||||
m_stop.setup();
|
||||
m_start.setup();
|
||||
m_off.setup();
|
||||
m_source.setup();
|
||||
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_undef;
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
|
||||
if(status)
|
||||
{
|
||||
m_mode = SYSCTRL::AlgorithmContext::CONFIGURATE;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
void AlgorithmContext::configure()
|
||||
{
|
||||
static bool status = true;
|
||||
if(m_mode == SYSCTRL::AlgorithmContext::CONFIGURATE)
|
||||
{
|
||||
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_off;
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_fault_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_work_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_stop_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_start_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_off_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_source_exe;
|
||||
|
||||
if(status)
|
||||
{
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::OFF;
|
||||
m_algorithm_previous = SYSCTRL::AlgorithmContext::OFF;
|
||||
|
||||
m_mode = SYSCTRL::AlgorithmContext::OPERATIONAL;
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
SYSCTRL::AlgorithmContext::mode_t AlgorithmContext::get_mode()
|
||||
{
|
||||
return m_mode;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
SYSCTRL::AlgorithmContext::algorithm_t AlgorithmContext::get_algorithm()
|
||||
{
|
||||
return m_algorithm;
|
||||
}//
|
||||
//
|
||||
bool AlgorithmContext::compare(const SYSCTRL::AlgorithmContext::mode_t mode)
|
||||
{
|
||||
return mode == m_mode;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
bool AlgorithmContext::compare_algorithm(const SYSCTRL::AlgorithmContext::algorithm_t algorithm)
|
||||
{
|
||||
return algorithm == m_algorithm;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::get_ref_invertor_voltage(float& volt_a, float& volt_b, float& volt_c)
|
||||
{
|
||||
m_algorithm_pointer->get_ref_invertor_voltage(volt_a, volt_b, volt_c);
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::strategy()
|
||||
{
|
||||
(this->*_strategy)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
void AlgorithmContext::_strategy_undef()
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_strategy_fault()
|
||||
{
|
||||
if((!m_env.system_fault.boolbit.b0)&&(m_env.system_reset.boolbit.b0))
|
||||
{
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_strategy_work()
|
||||
{
|
||||
if(m_env.system_fault.boolbit.b0)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_fault();
|
||||
set_fault();
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
if(!m_env.enable_work.boolbit.b0)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}else{
|
||||
|
||||
if((m_env.local_remote.state.signal.is_off & m_env.remote_stop.state.signal.is_switched_on) |
|
||||
((m_env.local_remote.state.signal.is_on & m_env.external_stop.signal.is_on)))
|
||||
{
|
||||
//m_env.reference_intensity_voltage_load_direct.set_output(m_env.voltage_load_active);
|
||||
//m_env.reference_intensity_voltage_load_quadrature.set_output(m_env.voltage_load_reactive);
|
||||
|
||||
set_strategy_stop();
|
||||
set_stop();
|
||||
//
|
||||
}//if
|
||||
}
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_strategy_stop()
|
||||
{
|
||||
if(m_env.system_fault.boolbit.b0)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_fault();
|
||||
set_fault();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!m_env.enable_work.boolbit.b0 |
|
||||
//(m_env.local_remote.state.signal.is_off & m_env.remote_stop.state.signal.is_switched_on) |
|
||||
//(m_env.local_remote.state.signal.is_on & m_env.external_stop.signal.is_on)
|
||||
m_env.auxiliary_km2.state.signal.is_on
|
||||
)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_strategy_start()
|
||||
{
|
||||
if(m_env.system_fault.boolbit.b0)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_fault();
|
||||
set_fault();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!m_env.enable_work.boolbit.b0)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if((m_env.local_remote.state.signal.is_off & m_env.remote_stop.state.signal.is_switched_on) |
|
||||
((m_env.local_remote.state.signal.is_on & m_env.external_stop.signal.is_on))
|
||||
)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}//if
|
||||
|
||||
|
||||
|
||||
if(m_env.auxiliary_km2.state.signal.is_off)
|
||||
{
|
||||
//m_env.regulator_voltage_load_a.set_output(m_env.reference.start.voltage_a);
|
||||
//m_env.regulator_voltage_load_b.set_output(m_env.reference.start.voltage_b);
|
||||
//m_env.regulator_voltage_load_c.set_output(m_env.reference.start.voltage_c);
|
||||
//
|
||||
//m_env.current_regulator_active.reset();
|
||||
//m_env.current_regulator_reactive.reset();
|
||||
//
|
||||
set_strategy_work();
|
||||
set_work();
|
||||
//
|
||||
//set_strategy_stop();
|
||||
//set_stop();
|
||||
//
|
||||
}//if
|
||||
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_strategy_off()
|
||||
{
|
||||
if(m_env.system_fault.boolbit.b0)
|
||||
{
|
||||
set_strategy_fault();
|
||||
set_fault();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_env.enable_work_is_on.boolbit.b0)
|
||||
{
|
||||
set_strategy_start();
|
||||
set_start();
|
||||
//
|
||||
//set_strategy_source();
|
||||
//set_source();
|
||||
//
|
||||
//set_strategy_stop();
|
||||
//set_stop();
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_strategy_source()
|
||||
{
|
||||
if(m_env.system_fault.boolbit.b0)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_fault();
|
||||
set_fault();
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
if((!m_env.enable_work.boolbit.b0) |
|
||||
(m_env.local_remote.state.signal.is_off & m_env.remote_stop.state.signal.is_switched_on) |
|
||||
((m_env.local_remote.state.signal.is_on & m_env.external_stop.signal.is_on))
|
||||
)
|
||||
{
|
||||
m_env.enable_work_reset.boolbit.b0 = true;
|
||||
set_strategy_off();
|
||||
set_off();
|
||||
//
|
||||
}//if
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_strategy_fault()
|
||||
{
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_fault;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_strategy_work()
|
||||
{
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_work;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_strategy_stop()
|
||||
{
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_stop;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_strategy_start()
|
||||
{
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_start;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_strategy_off()
|
||||
{
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_off;
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_strategy_source()
|
||||
{
|
||||
_strategy = &SYSCTRL::AlgorithmContext::_strategy_source;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_fault()
|
||||
{
|
||||
(this->*_set_fault)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_work()
|
||||
{
|
||||
(this->*_set_work)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_stop()
|
||||
{
|
||||
(this->*_set_stop)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_start()
|
||||
{
|
||||
(this->*_set_start)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_off()
|
||||
{
|
||||
(this->*_set_off)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::set_source()
|
||||
{
|
||||
(this->*_set_source)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::execute()
|
||||
{
|
||||
m_algorithm_pointer->execute();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_set_fault_exe()
|
||||
{
|
||||
//
|
||||
m_algorithm_previous = m_algorithm;
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::FAULT;
|
||||
//
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_work_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_stop_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_start_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_off_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_source_exe;
|
||||
//
|
||||
m_env.timer_start.reset();
|
||||
m_env.timer_stop.reset();
|
||||
//
|
||||
m_algorithm_pointer = &m_fault;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_set_work_exe()
|
||||
{
|
||||
//
|
||||
m_algorithm_previous = m_algorithm;
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::WORK;
|
||||
//
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_fault_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_stop_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_start_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_off_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_source_exe;
|
||||
//
|
||||
//
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
//
|
||||
m_env.regulator_voltage_load_direct.reset();
|
||||
m_env.regulator_voltage_load_quadrature.reset();
|
||||
//
|
||||
m_env.integrator_direct.reset();
|
||||
m_env.integrator_quadrature.reset();
|
||||
//
|
||||
m_env.regulator_current_limit.set_to_low_saturation();
|
||||
m_env.regulator_current_pfc.reset();
|
||||
//
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
//
|
||||
m_env.regulator_dc_a.reset();
|
||||
m_env.regulator_dc_b.reset();
|
||||
m_env.regulator_dc_c.reset();
|
||||
//
|
||||
m_env.regulator_current_limit_a.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc_a.reset();
|
||||
|
||||
m_env.regulator_current_limit_b.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc_b.reset();
|
||||
|
||||
m_env.regulator_current_limit_c.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc_c.reset();
|
||||
|
||||
m_env.regulator_voltage_load_a_active.reset();
|
||||
m_env.regulator_voltage_load_a_reactive.reset();
|
||||
|
||||
m_env.regulator_voltage_load_b_active.reset();
|
||||
m_env.regulator_voltage_load_b_reactive.reset();
|
||||
|
||||
m_env.regulator_voltage_load_c_active.reset();
|
||||
m_env.regulator_voltage_load_c_reactive.reset();
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
|
||||
m_env.drc_positive_voltage_controller_direct.reset();
|
||||
m_env.drc_positive_voltage_controller_quadrature.reset();
|
||||
m_env.drc_negative_voltage_controller_direct.reset();
|
||||
m_env.drc_negative_voltage_controller_quadrature.reset();
|
||||
//
|
||||
m_env.drc_regulator_current_limit.set_to_low_saturation();
|
||||
m_env.drc_regulator_current_pfc.reset();
|
||||
|
||||
m_env.drc_reference_voltage_direct_intensity.set_output(m_env.drc_voltage_grid_direct);
|
||||
m_work.reset_switcher();
|
||||
//
|
||||
#endif
|
||||
|
||||
//
|
||||
m_env.timer_start.reset();
|
||||
m_env.timer_stop.reset();
|
||||
//
|
||||
m_algorithm_pointer = &m_work;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_set_stop_exe()
|
||||
{
|
||||
//
|
||||
m_algorithm_previous = m_algorithm;
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::STOP;
|
||||
//
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_fault_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_work_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_start_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_off_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_source_exe;
|
||||
//
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
m_env.reference_voltage_direct_intensity.set_output(m_env.regulator_current_limit.get_output());
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
//m_env.drc_reference_voltage_direct_intensity.set_output(m_env.drc_voltage_grid_direct);
|
||||
m_env.drc_reference_voltage_direct_intensity.set_output(m_env.drc_regulator_current_limit.get_output());
|
||||
#endif
|
||||
|
||||
//
|
||||
//
|
||||
/* FOR DEBUG ONLY!!!! */
|
||||
/*
|
||||
m_env.regulator_voltage_load_a_active.reset();
|
||||
m_env.regulator_voltage_load_a_reactive.reset();
|
||||
|
||||
m_env.regulator_voltage_load_b_active.reset();
|
||||
m_env.regulator_voltage_load_b_reactive.reset();
|
||||
|
||||
m_env.regulator_voltage_load_c_active.reset();
|
||||
m_env.regulator_voltage_load_c_reactive.reset();
|
||||
*/
|
||||
|
||||
/* FOR DEBUG ONLY!!!! */
|
||||
/* VECTOR CONTROL */
|
||||
/*
|
||||
m_env.regulator_voltage_load_direct.reset();
|
||||
m_env.regulator_voltage_load_quadrature.reset();
|
||||
//
|
||||
m_env.integrator_direct.reset();
|
||||
m_env.integrator_quadrature.reset();
|
||||
*/
|
||||
//
|
||||
m_env.timer_start.reset();
|
||||
m_env.timer_stop.start();
|
||||
//
|
||||
m_algorithm_pointer = &m_stop;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_set_start_exe()
|
||||
{
|
||||
//
|
||||
m_algorithm_previous = m_algorithm;
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::START;
|
||||
//
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_fault_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_work_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_stop_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_off_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_source_exe;
|
||||
//
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
//
|
||||
m_env.regulator_current_load_direct.reset();
|
||||
m_env.regulator_current_load_quadrature.reset();
|
||||
//
|
||||
m_env.referencer_current_bypass_direct.reset();
|
||||
m_env.referencer_current_bypass_quadrature.reset();
|
||||
//
|
||||
#endif
|
||||
//
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
//
|
||||
m_env.current_referencer_a_active.reset();
|
||||
m_env.current_referencer_a_reactive.reset();
|
||||
m_env.current_referencer_b_active.reset();
|
||||
m_env.current_referencer_b_reactive.reset();
|
||||
m_env.current_referencer_c_active.reset();
|
||||
m_env.current_referencer_c_reactive.reset();
|
||||
//
|
||||
m_env.current_regulator_a_active.reset();
|
||||
m_env.current_regulator_a_reactive.reset();
|
||||
m_env.current_regulator_b_active.reset();
|
||||
m_env.current_regulator_b_reactive.reset();
|
||||
m_env.current_regulator_c_active.reset();
|
||||
m_env.current_regulator_c_reactive.reset();
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
//
|
||||
m_env.drc_regulator_current_load_direct.reset();
|
||||
m_env.drc_regulator_current_load_quadrature.reset();
|
||||
//
|
||||
m_env.drc_referencer_current_bypass_direct.reset();
|
||||
m_env.drc_referencer_current_bypass_quadrature.reset();
|
||||
//
|
||||
m_env.drc_positive_voltage_cell_direct = FP_ZERO;
|
||||
m_env.drc_positive_voltage_cell_quadrature = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_direct = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_quadrature = FP_ZERO;
|
||||
//
|
||||
m_env.drc_positive_voltage_cell_alpha = FP_ZERO;
|
||||
m_env.drc_positive_voltage_cell_beta = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_alpha = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_beta = FP_ZERO;
|
||||
//
|
||||
m_env.drc_positive_voltage_cell_a = FP_ZERO;
|
||||
m_env.drc_positive_voltage_cell_b = FP_ZERO;
|
||||
m_env.drc_positive_voltage_cell_c = FP_ZERO;
|
||||
//
|
||||
m_env.drc_negative_voltage_cell_a = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_b = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_c = FP_ZERO;
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
m_env.timer_start.start();
|
||||
m_env.timer_stop.reset();
|
||||
//
|
||||
m_algorithm_pointer = &m_start;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_set_off_exe()
|
||||
{
|
||||
//
|
||||
m_algorithm_previous = m_algorithm;
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::OFF;
|
||||
//
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_fault_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_work_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_stop_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_start_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_source_exe;
|
||||
//
|
||||
m_env.timer_start.reset();
|
||||
m_env.timer_stop.reset();
|
||||
//
|
||||
m_algorithm_pointer = &m_off;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmContext::_set_source_exe()
|
||||
{
|
||||
//
|
||||
m_algorithm_previous = m_algorithm;
|
||||
m_algorithm = SYSCTRL::AlgorithmContext::SOURCE;
|
||||
//
|
||||
_set_fault = &SYSCTRL::AlgorithmContext::_set_fault_exe;
|
||||
_set_work = &SYSCTRL::AlgorithmContext::_set_work_exe;
|
||||
_set_stop = &SYSCTRL::AlgorithmContext::_set_stop_exe;
|
||||
_set_start = &SYSCTRL::AlgorithmContext::_set_start_exe;
|
||||
_set_off = &SYSCTRL::AlgorithmContext::_set_off_exe;
|
||||
_set_source = &SYSCTRL::AlgorithmContext::_set_empty_exe;
|
||||
//
|
||||
m_env.timer_start.reset();
|
||||
m_env.timer_stop.reset();
|
||||
//
|
||||
m_algorithm_pointer = &m_source;
|
||||
//
|
||||
}//
|
||||
//
|
||||
void AlgorithmContext::_set_empty_exe()
|
||||
{
|
||||
//
|
||||
}//
|
||||
//
|
||||
//
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* AlgorithmContext.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
#include "SYSCTRL/AlgorithmFault.h"
|
||||
#include "SYSCTRL/AlgorithmOff.h"
|
||||
#include "SYSCTRL/AlgorithmSource.h"
|
||||
#include "SYSCTRL/AlgorithmStart.h"
|
||||
#include "SYSCTRL/AlgorithmStop.h"
|
||||
#include "SYSCTRL/AlgorithmWork.h"
|
||||
#include "SYSCTRL/AlgorithmZero.h"
|
||||
#include "SYSCTRL/SystemEnvironment.h"
|
||||
|
||||
|
||||
#ifndef SYSCTRL_ALGORITHMCONTEXT_H_
|
||||
#define SYSCTRL_ALGORITHMCONTEXT_H_
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
class AlgorithmContext
|
||||
{
|
||||
private:
|
||||
friend class SYSCTRL::AlgorithmBase;
|
||||
friend class SYSCTRL::AlgorithmFault;
|
||||
friend class SYSCTRL::AlgorithmWork;
|
||||
friend class SYSCTRL::AlgorithmStop;
|
||||
friend class SYSCTRL::AlgorithmStart;
|
||||
friend class SYSCTRL::AlgorithmOff;
|
||||
friend class SYSCTRL::AlgorithmSource;
|
||||
public:
|
||||
enum mode_t {UNDEFINED, CONFIGURATE, OPERATIONAL};
|
||||
enum algorithm_t {UNKNOWN, OFF, START, ENTRY, WORK, STOP, FAULT, SOURCE};
|
||||
private:
|
||||
mode_t m_mode;
|
||||
algorithm_t m_algorithm;
|
||||
algorithm_t m_algorithm_previous;
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
private:
|
||||
SYSCTRL::AlgorithmBase* m_algorithm_pointer;
|
||||
SYSCTRL::AlgorithmFault m_fault;
|
||||
SYSCTRL::AlgorithmWork m_work;
|
||||
SYSCTRL::AlgorithmStop m_stop;
|
||||
SYSCTRL::AlgorithmStart m_start;
|
||||
SYSCTRL::AlgorithmOff m_off;
|
||||
SYSCTRL::AlgorithmSource m_source;
|
||||
public:
|
||||
AlgorithmContext(SYSCTRL::SystemEnvironment& env);
|
||||
void setup();
|
||||
void configure();
|
||||
public:
|
||||
mode_t get_mode();
|
||||
algorithm_t get_algorithm();
|
||||
bool compare(const mode_t mode);
|
||||
bool compare_algorithm(const algorithm_t algorithm);
|
||||
public:
|
||||
void get_ref_invertor_voltage(float& volt_a, float& volt_b, float& volt_c);
|
||||
public:
|
||||
void strategy();
|
||||
private:
|
||||
void (AlgorithmContext::*_strategy)();
|
||||
void _strategy_undef();
|
||||
void _strategy_fault();
|
||||
void _strategy_work();
|
||||
void _strategy_stop();
|
||||
void _strategy_start();
|
||||
void _strategy_off();
|
||||
void _strategy_source();
|
||||
public:
|
||||
void set_strategy_fault();
|
||||
void set_strategy_work();
|
||||
void set_strategy_stop();
|
||||
void set_strategy_start();
|
||||
void set_strategy_off();
|
||||
void set_strategy_source();
|
||||
public:
|
||||
void execute();
|
||||
public:
|
||||
void set_fault();
|
||||
void set_work();
|
||||
void set_stop();
|
||||
void set_start();
|
||||
void set_off();
|
||||
void set_source();
|
||||
private:
|
||||
void (AlgorithmContext::*_set_fault)();
|
||||
void (AlgorithmContext::*_set_work)();
|
||||
void (AlgorithmContext::*_set_stop)();
|
||||
void (AlgorithmContext::*_set_start)();
|
||||
void (AlgorithmContext::*_set_off)();
|
||||
void (AlgorithmContext::*_set_source)();
|
||||
void _set_fault_exe();
|
||||
void _set_work_exe();
|
||||
void _set_stop_exe();
|
||||
void _set_start_exe();
|
||||
void _set_off_exe();
|
||||
void _set_source_exe();
|
||||
void _set_empty_exe();
|
||||
//
|
||||
};//class AlgorithmContext
|
||||
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGORITHMCONTEXT_H_ */
|
||||
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* AlgorithmFault.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmFault.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmFault::AlgorithmFault(SYSCTRL::SystemEnvironment& env):
|
||||
SYSCTRL::AlgorithmBase(),
|
||||
m_env(env),
|
||||
_execute(&SYSCTRL::AlgorithmFault::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void AlgorithmFault::setup()
|
||||
{
|
||||
_execute = &SYSCTRL::AlgorithmFault::_execute_run;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmFault::reset()
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmFault::execute()
|
||||
{
|
||||
(this->*_execute)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmFault::_execute_run()
|
||||
{
|
||||
//
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_voltage_a = FP_ZERO;
|
||||
m_voltage_b = FP_ZERO;
|
||||
m_voltage_c = FP_ZERO;
|
||||
//
|
||||
}//
|
||||
//
|
||||
} /* namespace SYSCTRL */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* AlgorithmFault.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef SYSCTRL_ALGORITHMFAULT_H_
|
||||
#define SYSCTRL_ALGORITHMFAULT_H_
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
#include "SYSCTRL/HeadersFLTSYSLIB.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
|
||||
class AlgorithmFault: public AlgorithmBase
|
||||
{
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
public:
|
||||
AlgorithmFault(SYSCTRL::SystemEnvironment& env);
|
||||
public:
|
||||
void setup();
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute();
|
||||
private:
|
||||
void (AlgorithmFault::*_execute)();
|
||||
void _execute_run();
|
||||
};
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGORITHMFAULT_H_ */
|
||||
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* AlgoritmOff.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmOff.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmOff::AlgorithmOff(SYSCTRL::SystemEnvironment& env):
|
||||
SYSCTRL::AlgorithmBase(),
|
||||
m_env(env),
|
||||
_execute(&SYSCTRL::AlgorithmOff::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void AlgorithmOff::setup()
|
||||
{
|
||||
_execute = &SYSCTRL::AlgorithmOff::_execute_run;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmOff::reset()
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmOff::execute()
|
||||
{
|
||||
(this->*_execute)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmOff::_execute_run()
|
||||
{
|
||||
static bool _high_level = true;
|
||||
_high_level = true;
|
||||
|
||||
if(m_env.system_reset.boolbit.b0)
|
||||
{
|
||||
m_env.hardware.ref_control_order = ORDER_RESET;
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for(Uint16 cellnum = 0; cellnum < m_env.hardware.level; cellnum++)
|
||||
{
|
||||
_high_level &= m_env.hardware.hvcell.dc_voltage[0][cellnum] > m_env.hardware.dc_voltage_low_level ? true : false;
|
||||
_high_level &= m_env.hardware.hvcell.dc_voltage[1][cellnum] > m_env.hardware.dc_voltage_low_level ? true : false;
|
||||
_high_level &= m_env.hardware.hvcell.dc_voltage[2][cellnum] > m_env.hardware.dc_voltage_low_level ? true : false;
|
||||
//
|
||||
}//for
|
||||
//
|
||||
if(!_high_level & m_env.hardware.low_level())
|
||||
{
|
||||
m_env.hardware.ref_control_order = ORDER_RESET;
|
||||
m_env.hardware.fault_low_level = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
}
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
m_voltage_a = FP_ZERO;
|
||||
m_voltage_b = FP_ZERO;
|
||||
m_voltage_c = FP_ZERO;
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* AlgoritmOff.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef SYSCTRL_ALGORITMSTOPPED_H_
|
||||
#define SYSCTRL_ALGORITMSTOPPED_H_
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
#include "SYSCTRL/HeadersFLTSYSLIB.h"
|
||||
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
|
||||
class AlgorithmOff: public AlgorithmBase
|
||||
{
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
public:
|
||||
AlgorithmOff(SYSCTRL::SystemEnvironment& env);
|
||||
public:
|
||||
void setup();
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute();
|
||||
private:
|
||||
void (AlgorithmOff::*_execute)();
|
||||
void _execute_run();
|
||||
};
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGORITMSTOPPED_H_ */
|
||||
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* AlgorithmSource.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmSource.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmSource::AlgorithmSource(SYSCTRL::SystemEnvironment& env):
|
||||
AlgorithmBase(),
|
||||
m_env(env),
|
||||
m_voltage_direct(FP_ZERO),
|
||||
m_voltage_quadrature(FP_ZERO),
|
||||
m_voltage_alpha(FP_ZERO),
|
||||
m_voltage_beta(FP_ZERO),
|
||||
m_voltage_a_gen(FP_ZERO),
|
||||
m_voltage_b_gen(FP_ZERO),
|
||||
m_voltage_c_gen(FP_ZERO),
|
||||
m_voltage_a_relative(FP_ZERO),
|
||||
m_voltage_b_relative(FP_ZERO),
|
||||
m_voltage_c_relative(FP_ZERO),
|
||||
m_ort_alpha(FP_ZERO),
|
||||
m_ort_beta(FP_ZERO),
|
||||
_execute(&SYSCTRL::AlgorithmSource::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void AlgorithmSource::setup()
|
||||
{
|
||||
_execute = &SYSCTRL::AlgorithmSource::_execute_run;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmSource::reset()
|
||||
{}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmSource::execute()
|
||||
{
|
||||
(this->*_execute)();
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmSource::_execute_run()
|
||||
{
|
||||
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
|
||||
m_voltage_direct = m_env.algorithm_source_references.voltage * cosf(m_env.algorithm_source_references.phase_shift);
|
||||
m_voltage_quadrature = m_env.algorithm_source_references.voltage * sinf(m_env.algorithm_source_references.phase_shift);
|
||||
//
|
||||
m_ort_alpha = m_env.main_ab_orts.active;
|
||||
m_ort_beta = m_env.main_ab_orts.reactive;
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_ort_alpha, m_ort_beta, m_voltage_direct, m_voltage_quadrature, m_voltage_alpha, m_voltage_beta);
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_voltage_alpha, m_voltage_beta, m_voltage_a_gen, m_voltage_b_gen, m_voltage_c_gen);
|
||||
//
|
||||
m_voltage_a_relative = m_voltage_a_gen * m_env.cell_dc_voltage_a_reciprocal;
|
||||
m_voltage_b_relative = m_voltage_b_gen * m_env.cell_dc_voltage_b_reciprocal;
|
||||
m_voltage_c_relative = m_voltage_c_gen * m_env.cell_dc_voltage_c_reciprocal;
|
||||
//
|
||||
m_voltage_a = m_voltage_a_relative;
|
||||
m_voltage_b = m_voltage_b_relative;
|
||||
m_voltage_c = m_voltage_c_relative;
|
||||
//
|
||||
}//
|
||||
//
|
||||
} /* namespace SYSCTRL */
|
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* AlgorithmSource.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifndef SYSCTRL_ALGIRITHMSOURCE_H_
|
||||
#define SYSCTRL_ALGIRITHMSOURCE_H_
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
#include "SYSCTRL/HeadersFLTSYSLIB.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
class AlgorithmSource: public AlgorithmBase
|
||||
{
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
private:
|
||||
float m_voltage_direct;
|
||||
float m_voltage_quadrature;
|
||||
float m_voltage_alpha;
|
||||
float m_voltage_beta;
|
||||
float m_voltage_a_gen;
|
||||
float m_voltage_b_gen;
|
||||
float m_voltage_c_gen;
|
||||
float m_voltage_a_relative;
|
||||
float m_voltage_b_relative;
|
||||
float m_voltage_c_relative;
|
||||
float m_ort_alpha;
|
||||
float m_ort_beta;
|
||||
public:
|
||||
AlgorithmSource(SYSCTRL::SystemEnvironment& env);
|
||||
public:
|
||||
void setup();
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute();
|
||||
private:
|
||||
void (AlgorithmSource::*_execute)();
|
||||
void _execute_run();
|
||||
//
|
||||
};//class AlgirithmSource
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGIRITHMSOURCE_H_ */
|
||||
@ -0,0 +1,291 @@
|
||||
/*
|
||||
* AlgoritmStart.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmStart.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmStart::AlgorithmStart(SYSCTRL::SystemEnvironment& env):
|
||||
SYSCTRL::AlgorithmBase(),
|
||||
m_env(env),
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
m_reference_zero(FP_ZERO),
|
||||
m_reference_current_cell_direct(FP_ZERO),
|
||||
m_reference_current_cell_quadrature(FP_ZERO),
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
m_reference_zero(FP_ZERO),
|
||||
m_reference_current_cell_direct(FP_ZERO),
|
||||
m_reference_current_cell_quadrature(FP_ZERO),
|
||||
#endif
|
||||
_execute(&SYSCTRL::AlgorithmStart::_execute_undef)
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void AlgorithmStart::setup()
|
||||
{
|
||||
_execute = &SYSCTRL::AlgorithmStart::_execute_run;
|
||||
//
|
||||
}//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStart::reset()
|
||||
{
|
||||
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
//
|
||||
m_env.regulator_current_load_direct.reset();
|
||||
m_env.regulator_current_load_quadrature.reset();
|
||||
//
|
||||
m_env.referencer_current_bypass_direct.reset();
|
||||
m_env.referencer_current_bypass_quadrature.reset();
|
||||
//
|
||||
#endif
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
m_env.current_referencer_a_active.reset();
|
||||
m_env.current_referencer_a_reactive.reset();
|
||||
m_env.current_referencer_b_active.reset();
|
||||
m_env.current_referencer_b_reactive.reset();
|
||||
m_env.current_referencer_c_active.reset();
|
||||
m_env.current_referencer_c_reactive.reset();
|
||||
|
||||
m_env.current_regulator_a_active.reset();
|
||||
m_env.current_regulator_a_reactive.reset();
|
||||
m_env.current_regulator_b_active.reset();
|
||||
m_env.current_regulator_b_reactive.reset();
|
||||
m_env.current_regulator_c_active.reset();
|
||||
m_env.current_regulator_c_reactive.reset();
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
//
|
||||
m_env.drc_regulator_current_load_direct.reset();
|
||||
m_env.drc_regulator_current_load_quadrature.reset();
|
||||
//
|
||||
m_env.drc_referencer_current_bypass_direct.reset();
|
||||
m_env.drc_referencer_current_bypass_quadrature.reset();
|
||||
//
|
||||
#endif
|
||||
|
||||
m_voltage_a = FP_ZERO;
|
||||
m_voltage_b = FP_ZERO;
|
||||
m_voltage_c = FP_ZERO;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStart::execute()
|
||||
{
|
||||
(this->*_execute)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStart::_execute_run()
|
||||
{
|
||||
//
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_env.timer_start.execute();
|
||||
//
|
||||
m_reference_current_cell_direct = m_env.referencer_current_bypass_direct.execute(m_reference_zero, m_env.current_bypass_direct);
|
||||
m_reference_current_cell_quadrature = m_env.referencer_current_bypass_quadrature.execute(m_reference_zero, m_env.current_bypass_quadrature);
|
||||
//
|
||||
m_env.voltage_cell_direct = m_env.regulator_current_load_direct.execute(m_env.current_cell_direct, m_reference_current_cell_direct);
|
||||
m_env.voltage_cell_quadrature = m_env.regulator_current_load_quadrature.execute(m_env.current_cell_quadrature, m_reference_current_cell_quadrature);
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.voltage_cell_direct,
|
||||
m_env.voltage_cell_quadrature,
|
||||
m_env.voltage_cell_alpha,
|
||||
m_env.voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_env.voltage_cell_alpha,
|
||||
m_env.voltage_cell_beta,
|
||||
m_env.voltage_cell_a,
|
||||
m_env.voltage_cell_b,
|
||||
m_env.voltage_cell_c);
|
||||
//
|
||||
m_voltage_a = m_env.voltage_cell_a * m_env.cell_dc_voltage_a_reciprocal;
|
||||
m_voltage_b = m_env.voltage_cell_b * m_env.cell_dc_voltage_b_reciprocal;
|
||||
m_voltage_c = m_env.voltage_cell_c * m_env.cell_dc_voltage_c_reciprocal;
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
|
||||
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStart::_execute_run()
|
||||
{
|
||||
//
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_env.timer_start.execute();
|
||||
|
||||
//**** Phase A ***
|
||||
//-reference constructor
|
||||
//m_env.start_control.phase_a.reference.current_bypass_active = FP_ZERO;
|
||||
//m_env.start_control.phase_a.reference.current_bypass_reactive = FP_ZERO;
|
||||
//
|
||||
m_env.start_control.phase_a.reference.current_bypass_active = m_env.start_control.common_ref.active;
|
||||
m_env.start_control.phase_a.reference.current_bypass_reactive = m_env.start_control.common_ref.reactive;
|
||||
//
|
||||
//m_env.start_control.phase_a.test_ref = m_env.start_control.common_ref;
|
||||
|
||||
//-feedback constructor
|
||||
m_env.start_control.phase_a.feedback.current_bypass_active = m_env.projection_current_bypass_a.active;
|
||||
m_env.start_control.phase_a.feedback.current_bypass_reactive = m_env.projection_current_bypass_a.reactive;
|
||||
//
|
||||
m_env.start_control.phase_a.feedback.current_cell_active = m_env.projection_current_cell_a.active;
|
||||
m_env.start_control.phase_a.feedback.current_cell_reactive = m_env.projection_current_cell_a.reactive;
|
||||
//
|
||||
//-control
|
||||
_execute_single_phase(m_env.start_control.phase_a,
|
||||
m_env.main_abc_orts.phase_a,
|
||||
m_env.cell_dc_voltage_a_reciprocal,
|
||||
m_env.current_referencer_a_active,
|
||||
m_env.current_referencer_a_reactive,
|
||||
m_env.current_regulator_a_active,
|
||||
m_env.current_regulator_a_reactive);
|
||||
//<>
|
||||
|
||||
//**** Phase B ***
|
||||
//-reference constructor
|
||||
//m_env.start_control.phase_b.reference.current_bypass_active = FP_ZERO;
|
||||
//m_env.start_control.phase_b.reference.current_bypass_reactive = FP_ZERO;
|
||||
//
|
||||
m_env.start_control.phase_b.reference.current_bypass_active = m_env.start_control.common_ref.active;
|
||||
m_env.start_control.phase_b.reference.current_bypass_reactive = m_env.start_control.common_ref.reactive;
|
||||
//
|
||||
//m_env.start_control.phase_b.test_ref = m_env.start_control.common_ref;
|
||||
|
||||
//-feedback constructor
|
||||
m_env.start_control.phase_b.feedback.current_bypass_active = m_env.projection_current_bypass_b.active;
|
||||
m_env.start_control.phase_b.feedback.current_bypass_reactive = m_env.projection_current_bypass_b.reactive;
|
||||
//
|
||||
m_env.start_control.phase_b.feedback.current_cell_active = m_env.projection_current_cell_b.active;
|
||||
m_env.start_control.phase_b.feedback.current_cell_reactive = m_env.projection_current_cell_b.reactive;
|
||||
//
|
||||
//-control
|
||||
_execute_single_phase(m_env.start_control.phase_b,
|
||||
m_env.main_abc_orts.phase_b,
|
||||
m_env.cell_dc_voltage_b_reciprocal,
|
||||
m_env.current_referencer_b_active,
|
||||
m_env.current_referencer_b_reactive,
|
||||
m_env.current_regulator_b_active,
|
||||
m_env.current_regulator_b_reactive);
|
||||
//<>
|
||||
|
||||
|
||||
//**** Phase C ***
|
||||
//-reference constructor
|
||||
//m_env.start_control.phase_c.reference.current_bypass_active = FP_ZERO;
|
||||
//m_env.start_control.phase_c.reference.current_bypass_reactive = FP_ZERO;
|
||||
//
|
||||
m_env.start_control.phase_c.reference.current_bypass_active = m_env.start_control.common_ref.active;
|
||||
m_env.start_control.phase_c.reference.current_bypass_reactive = m_env.start_control.common_ref.reactive;
|
||||
//
|
||||
//m_env.start_control.phase_c.test_ref = m_env.start_control.common_ref;
|
||||
|
||||
//-feedback constructor
|
||||
m_env.start_control.phase_c.feedback.current_bypass_active = m_env.projection_current_bypass_c.active;
|
||||
m_env.start_control.phase_c.feedback.current_bypass_reactive = m_env.projection_current_bypass_c.reactive;
|
||||
//
|
||||
m_env.start_control.phase_c.feedback.current_cell_active = m_env.projection_current_cell_c.active;
|
||||
m_env.start_control.phase_c.feedback.current_cell_reactive = m_env.projection_current_cell_c.reactive;
|
||||
//
|
||||
//-control
|
||||
_execute_single_phase(m_env.start_control.phase_c,
|
||||
m_env.main_abc_orts.phase_c,
|
||||
m_env.cell_dc_voltage_c_reciprocal,
|
||||
m_env.current_referencer_c_active,
|
||||
m_env.current_referencer_c_reactive,
|
||||
m_env.current_regulator_c_active,
|
||||
m_env.current_regulator_c_reactive);
|
||||
//<>
|
||||
|
||||
m_voltage_a = m_env.start_control.phase_a.reference.voltage_cell_relative;
|
||||
m_voltage_b = m_env.start_control.phase_b.reference.voltage_cell_relative;
|
||||
m_voltage_c = m_env.start_control.phase_c.reference.voltage_cell_relative;
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
inline void AlgorithmStart::_execute_single_phase(SYSCTRL::AlgorithmStartSinglePhaseControl& phase,
|
||||
SYSCTRL::VectorOrthogonalProjection& orts,
|
||||
float dc_voltage_reciprocal,
|
||||
FLTSYSLIB::PIController& referencer_active,
|
||||
FLTSYSLIB::PIController& referencer_reactive,
|
||||
FLTSYSLIB::PIController& regulator_active,
|
||||
FLTSYSLIB::PIController& regulator_reactive)
|
||||
{
|
||||
//
|
||||
phase.reference.current_cell_active = referencer_active.execute(phase.reference.current_bypass_active, phase.feedback.current_bypass_active);
|
||||
phase.reference.current_cell_reactive = referencer_reactive.execute(phase.reference.current_bypass_reactive, phase.feedback.current_bypass_reactive);
|
||||
//
|
||||
phase.reference.voltage_cell_ampl_active = regulator_active.execute(phase.feedback.current_cell_active, phase.reference.current_cell_active);
|
||||
phase.reference.voltage_cell_ampl_reactive = regulator_reactive.execute(phase.feedback.current_cell_reactive, phase.reference.current_cell_reactive);
|
||||
//
|
||||
//phase.reference.voltage_cell_ampl_active = regulator_active.execute(phase.feedback.current_cell_active, phase.test_ref.active);
|
||||
//phase.reference.voltage_cell_ampl_reactive = regulator_reactive.execute(phase.feedback.current_cell_reactive, phase.test_ref.reactive);
|
||||
//
|
||||
phase.reference.voltage_cell_active = phase.reference.voltage_cell_ampl_active * orts.active;
|
||||
phase.reference.voltage_cell_reactive = phase.reference.voltage_cell_ampl_reactive * orts.reactive;
|
||||
//
|
||||
phase.reference.voltage_cell = phase.reference.voltage_cell_active - phase.reference.voltage_cell_reactive;
|
||||
phase.reference.voltage_cell_relative = phase.reference.voltage_cell * dc_voltage_reciprocal;
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStart::_execute_run()
|
||||
{
|
||||
//
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_env.timer_start.execute();
|
||||
//
|
||||
m_reference_current_cell_direct = m_env.drc_referencer_current_bypass_direct.execute(m_reference_zero, m_env.drc_current_bypass_direct);
|
||||
m_reference_current_cell_quadrature = m_env.drc_referencer_current_bypass_quadrature.execute(m_reference_zero, m_env.drc_current_bypass_quadrature);
|
||||
//
|
||||
m_env.drc_positive_voltage_cell_direct = m_env.drc_regulator_current_load_direct.execute(m_env.drc_current_cell_direct, m_reference_current_cell_direct);
|
||||
m_env.drc_positive_voltage_cell_quadrature = m_env.drc_regulator_current_load_quadrature.execute(m_env.drc_current_cell_quadrature, m_reference_current_cell_quadrature);
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.drc_positive_voltage_cell_direct,
|
||||
m_env.drc_positive_voltage_cell_quadrature,
|
||||
m_env.drc_positive_voltage_cell_alpha,
|
||||
m_env.drc_positive_voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_env.drc_positive_voltage_cell_alpha,
|
||||
m_env.drc_positive_voltage_cell_beta,
|
||||
m_env.drc_positive_voltage_cell_a,
|
||||
m_env.drc_positive_voltage_cell_b,
|
||||
m_env.drc_positive_voltage_cell_c);
|
||||
//
|
||||
m_env.drc_voltage_cell_a = m_env.drc_positive_voltage_cell_a;
|
||||
m_env.drc_voltage_cell_b = m_env.drc_positive_voltage_cell_b;
|
||||
m_env.drc_voltage_cell_c = m_env.drc_positive_voltage_cell_c;
|
||||
//
|
||||
m_voltage_a = m_env.drc_voltage_cell_a * m_env.cell_dc_voltage_a_reciprocal;
|
||||
m_voltage_b = m_env.drc_voltage_cell_b * m_env.cell_dc_voltage_b_reciprocal;
|
||||
m_voltage_c = m_env.drc_voltage_cell_c * m_env.cell_dc_voltage_c_reciprocal;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* AlgoritmStart.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef SYSCTRL_ALGORITMPRESTART_H_
|
||||
#define SYSCTRL_ALGORITMPRESTART_H_
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
#include "SYSCTRL/HeadersFLTSYSLIB.h"
|
||||
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
|
||||
class AlgorithmStart: public SYSCTRL::AlgorithmBase
|
||||
{
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
private:
|
||||
float m_reference_zero;
|
||||
float m_reference_current_cell_direct;
|
||||
float m_reference_current_cell_quadrature;
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
float m_reference_zero;
|
||||
float m_reference_current_cell_direct;
|
||||
float m_reference_current_cell_quadrature;
|
||||
#endif
|
||||
|
||||
public:
|
||||
AlgorithmStart(SYSCTRL::SystemEnvironment& env);
|
||||
public:
|
||||
void setup();
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute();
|
||||
private:
|
||||
void (AlgorithmStart::*_execute)();
|
||||
void _execute_run();
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
private:
|
||||
|
||||
inline void _execute_single_phase(SYSCTRL::AlgorithmStartSinglePhaseControl& phase,
|
||||
SYSCTRL::VectorOrthogonalProjection& orts,
|
||||
float dc_voltage_reciprocal,
|
||||
FLTSYSLIB::PIController& referencer_active,
|
||||
FLTSYSLIB::PIController& referencer_reactive,
|
||||
FLTSYSLIB::PIController& regulator_active,
|
||||
FLTSYSLIB::PIController& regulator_reactive);
|
||||
#endif
|
||||
//
|
||||
};//AlgoritmPrestart
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGORITMPRESTART_H_ */
|
||||
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* AlgorithmStop.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmStop.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmStop::AlgorithmStop(SYSCTRL::SystemEnvironment& env):
|
||||
SYSCTRL::AlgorithmBase(),
|
||||
m_env(env),
|
||||
_execute(&SYSCTRL::AlgorithmStop::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
void AlgorithmStop::setup()
|
||||
{
|
||||
_execute = &SYSCTRL::AlgorithmStop::_execute_run;
|
||||
//
|
||||
}//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStop::reset()
|
||||
{
|
||||
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStop::execute()
|
||||
{
|
||||
(this->*_execute)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStop::_execute_run()
|
||||
{
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_env.timer_stop.execute();
|
||||
//
|
||||
if(m_env.timer_stop.is_finished()){
|
||||
//
|
||||
m_voltage_a = FP_ZERO;
|
||||
m_voltage_b = FP_ZERO;
|
||||
m_voltage_c = FP_ZERO;
|
||||
//
|
||||
}else{
|
||||
//
|
||||
#if TYPE_VOLTAGE_CONTROLLER == VOLTAGE_CONTROLLER_PII
|
||||
|
||||
m_env.voltage_reference_load_direct = m_env.reference_voltage_direct_intensity.execute(m_env.voltage_grid_direct);
|
||||
//m_env.voltage_reference_load_direct = 0.33333*(m_env.rms_voltage_input_a + m_env.rms_voltage_input_b + m_env.rms_voltage_input_c);
|
||||
//m_env.voltage_reference_load_quadrature = m_env.voltage_grid_quadrature;
|
||||
m_env.voltage_reference_load_quadrature = FP_ZERO;
|
||||
m_env.voltage_pi_reg_out_direct = m_env.regulator_voltage_load_direct.execute(m_env.voltage_reference_load_direct, m_env.voltage_load_direct);
|
||||
//m_env.voltage_pi_reg_out_quadrature = m_env.regulator_voltage_load_quadrature.execute(m_env.voltage_reference_load_quadrature, m_env.voltage_load_quadrature);
|
||||
m_env.voltage_pi_reg_out_quadrature = FP_ZERO;
|
||||
//
|
||||
m_env.voltage_cell_direct = m_env.integrator_direct.execute(m_env.voltage_pi_reg_out_direct);
|
||||
//m_env.voltage_cell_quadrature = m_env.integrator_quadrature.execute(m_env.voltage_pi_reg_out_quadrature);
|
||||
m_env.voltage_cell_quadrature = FP_ZERO;
|
||||
#endif
|
||||
|
||||
#if TYPE_VOLTAGE_CONTROLLER == VOLTAGE_CONTROLLER_I
|
||||
m_env.voltage_reference_load_direct = m_env.reference_voltage_direct_intensity.execute(m_env.voltage_grid_direct);
|
||||
m_env.voltage_reference_load_quadrature = FP_ZERO;
|
||||
m_env.voltage_cell_direct = m_env.integrator_direct.execute(m_env.voltage_reference_load_direct - m_env.voltage_load_direct);
|
||||
m_env.voltage_cell_quadrature = FP_ZERO;
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.voltage_cell_direct,
|
||||
m_env.voltage_cell_quadrature,
|
||||
m_env.voltage_cell_alpha,
|
||||
m_env.voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_env.voltage_cell_alpha,
|
||||
m_env.voltage_cell_beta,
|
||||
m_env.voltage_cell_a,
|
||||
m_env.voltage_cell_b,
|
||||
m_env.voltage_cell_c);
|
||||
//
|
||||
m_voltage_a = m_env.voltage_cell_a * m_env.cell_dc_voltage_a_reciprocal;
|
||||
m_voltage_b = m_env.voltage_cell_b * m_env.cell_dc_voltage_b_reciprocal;
|
||||
m_voltage_c = m_env.voltage_cell_c * m_env.cell_dc_voltage_c_reciprocal;
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStop::_execute_run()
|
||||
{
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_env.timer_stop.execute();
|
||||
//
|
||||
//
|
||||
//reference constructor
|
||||
// m_env.phase_control.common_ref.voltage_rms_real = m_env.phase_control.common_ref.voltage_module_rms;
|
||||
//m_env.phase_control.common_ref.voltage_rms_jm = FP_ZERO;
|
||||
// m_env.phase_control.phase_a.reference.voltage_ampl_real_const = m_env.phase_control.common_ref.voltage_rms_real;
|
||||
//m_env.phase_control.phase_a.reference.voltage_ampl_jm_const = m_env.phase_control.common_ref.voltage_rms_jm;
|
||||
// m_env.phase_control.phase_a.reference.voltage_ampl_jm_const = m_env.projection_voltage_input_a.reactive;
|
||||
// m_env.phase_control.phase_b.reference.voltage_ampl_real_const = m_env.phase_control.common_ref.voltage_rms_real;
|
||||
//m_env.phase_control.phase_b.reference.voltage_ampl_jm_const = m_env.phase_control.common_ref.voltage_rms_jm;
|
||||
// m_env.phase_control.phase_b.reference.voltage_ampl_jm_const = m_env.projection_voltage_input_b.reactive;
|
||||
// m_env.phase_control.phase_c.reference.voltage_ampl_real_const = m_env.phase_control.common_ref.voltage_rms_real;
|
||||
//m_env.phase_control.phase_c.reference.voltage_ampl_jm_const = m_env.phase_control.common_ref.voltage_rms_jm;
|
||||
// m_env.phase_control.phase_c.reference.voltage_ampl_jm_const = m_env.projection_voltage_input_c.reactive;
|
||||
//
|
||||
//m_env.phase_control.phase_a.reference.voltage_ampl_real = m_env.phase_control.phase_a.reference.voltage_ampl_real_const;
|
||||
//m_env.phase_control.phase_a.reference.voltage_ampl_jm = m_env.phase_control.phase_a.reference.voltage_ampl_jm_const;
|
||||
//m_env.phase_control.phase_b.reference.voltage_ampl_real = m_env.phase_control.phase_b.reference.voltage_ampl_real_const;
|
||||
//m_env.phase_control.phase_b.reference.voltage_ampl_jm = m_env.phase_control.phase_b.reference.voltage_ampl_jm_const;
|
||||
//m_env.phase_control.phase_c.reference.voltage_ampl_real = m_env.phase_control.phase_c.reference.voltage_ampl_real_const;
|
||||
//m_env.phase_control.phase_c.reference.voltage_ampl_jm = m_env.phase_control.phase_c.reference.voltage_ampl_jm_const;
|
||||
|
||||
m_env.phase_control.phase_a.reference.voltage_ampl_real = m_env.projection_voltage_input_a.active;
|
||||
m_env.phase_control.phase_a.reference.voltage_ampl_jm = m_env.projection_voltage_input_a.reactive;
|
||||
m_env.phase_control.phase_b.reference.voltage_ampl_real = m_env.projection_voltage_input_b.active;
|
||||
m_env.phase_control.phase_b.reference.voltage_ampl_jm = m_env.projection_voltage_input_b.reactive;
|
||||
m_env.phase_control.phase_c.reference.voltage_ampl_real = m_env.projection_voltage_input_c.active;
|
||||
m_env.phase_control.phase_c.reference.voltage_ampl_jm = m_env.projection_voltage_input_c.reactive;
|
||||
|
||||
//
|
||||
//control execute
|
||||
_execute_single_phase(m_env.phase_control.phase_a,
|
||||
m_env.main_abc_orts.phase_a,
|
||||
m_env.regulator_voltage_load_a_active,
|
||||
m_env.regulator_voltage_load_a_reactive);
|
||||
//
|
||||
_execute_single_phase(m_env.phase_control.phase_b,
|
||||
m_env.main_abc_orts.phase_b,
|
||||
m_env.regulator_voltage_load_b_active,
|
||||
m_env.regulator_voltage_load_b_reactive);
|
||||
//
|
||||
_execute_single_phase(m_env.phase_control.phase_c,
|
||||
m_env.main_abc_orts.phase_c,
|
||||
m_env.regulator_voltage_load_c_active,
|
||||
m_env.regulator_voltage_load_c_reactive);
|
||||
//
|
||||
|
||||
|
||||
if(m_env.timer_stop.is_finished()){
|
||||
m_voltage_a = FP_ZERO;
|
||||
m_voltage_b = FP_ZERO;
|
||||
m_voltage_c = FP_ZERO;
|
||||
}else{
|
||||
m_voltage_a = m_env.phase_control.phase_a.reference.voltage_cell_relative;
|
||||
m_voltage_b = m_env.phase_control.phase_b.reference.voltage_cell_relative;
|
||||
m_voltage_c = m_env.phase_control.phase_c.reference.voltage_cell_relative;
|
||||
}
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
//
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
inline void AlgorithmStop::_execute_single_phase(SYSCTRL::AlgorithmSinglePhaseControl& phase,
|
||||
SYSCTRL::VectorOrthogonalProjection& orts,
|
||||
FLTSYSLIB::PIController& regulator_active,
|
||||
FLTSYSLIB::PIController& regulator_reactive)
|
||||
{
|
||||
phase.reference.voltage_cell_ampl_real = regulator_active.execute(phase.reference.voltage_ampl_real, phase.feedback.voltage_ampl_real);
|
||||
phase.reference.voltage_cell_ampl_jm = regulator_reactive.execute(phase.reference.voltage_ampl_jm, phase.feedback.voltage_ampl_jm);
|
||||
//
|
||||
phase.reference.voltage_cell_real = phase.reference.voltage_cell_ampl_real * orts.active;
|
||||
phase.reference.voltage_cell_jm = phase.reference.voltage_cell_ampl_jm * orts.reactive;
|
||||
phase.reference.voltage_cell = phase.reference.voltage_cell_real - phase.reference.voltage_cell_jm;
|
||||
//
|
||||
phase.reference.voltage_cell_relative = phase.reference.voltage_cell * phase.feedback.voltage_cell_dc_reciprocal;
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmStop::_execute_run()
|
||||
{
|
||||
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
m_env.timer_stop.execute();
|
||||
//
|
||||
if(m_env.timer_stop.is_finished()){
|
||||
//
|
||||
m_voltage_a = FP_ZERO;
|
||||
m_voltage_b = FP_ZERO;
|
||||
m_voltage_c = FP_ZERO;
|
||||
//
|
||||
}else{
|
||||
//
|
||||
|
||||
m_env.drc_voltage_reference_load_direct = m_env.drc_reference_voltage_direct_intensity.execute(m_env.drc_voltage_grid_direct);
|
||||
m_env.drc_voltage_reference_load_quadrature = FP_ZERO;
|
||||
//
|
||||
m_env.drc_positive_voltage_cell_direct = m_env.drc_positive_voltage_controller_direct.execute(m_env.drc_voltage_reference_load_direct, m_env.drc_positive_voltage_load_direct);
|
||||
m_env.drc_positive_voltage_cell_quadrature = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_direct = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_quadrature = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_alpha = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_beta = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_a = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_b = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_c = FP_ZERO;
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.drc_positive_voltage_cell_direct,
|
||||
m_env.drc_positive_voltage_cell_quadrature,
|
||||
m_env.drc_positive_voltage_cell_alpha,
|
||||
m_env.drc_positive_voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_env.drc_positive_voltage_cell_alpha,
|
||||
m_env.drc_positive_voltage_cell_beta,
|
||||
m_env.drc_positive_voltage_cell_a,
|
||||
m_env.drc_positive_voltage_cell_b,
|
||||
m_env.drc_positive_voltage_cell_c);
|
||||
//
|
||||
m_env.drc_voltage_cell_a = m_env.drc_positive_voltage_cell_a;
|
||||
m_env.drc_voltage_cell_b = m_env.drc_positive_voltage_cell_b;
|
||||
m_env.drc_voltage_cell_c = m_env.drc_positive_voltage_cell_c;
|
||||
//
|
||||
m_voltage_a = m_env.drc_voltage_cell_a * m_env.cell_dc_voltage_a_reciprocal;
|
||||
m_voltage_b = m_env.drc_voltage_cell_b * m_env.cell_dc_voltage_b_reciprocal;
|
||||
m_voltage_c = m_env.drc_voltage_cell_c * m_env.cell_dc_voltage_c_reciprocal;
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
} /* namespace SYSCTRL */
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* AlgorithmStop.h
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifndef SYSCTRL_ALGORITHMSTOP_H_
|
||||
#define SYSCTRL_ALGORITHMSTOP_H_
|
||||
|
||||
#include "SYSCTRL/AlgorithmBase.h"
|
||||
#include "SYSCTRL/HeadersFLTSYSLIB.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
|
||||
class AlgorithmStop: public SYSCTRL::AlgorithmBase
|
||||
{
|
||||
private:
|
||||
SYSCTRL::SystemEnvironment& m_env;
|
||||
public:
|
||||
AlgorithmStop(SYSCTRL::SystemEnvironment& env);
|
||||
public:
|
||||
void setup();
|
||||
public:
|
||||
void reset();
|
||||
public:
|
||||
void execute();
|
||||
private:
|
||||
void (AlgorithmStop::*_execute)();
|
||||
void _execute_run();
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
private:
|
||||
inline void _execute_single_phase(SYSCTRL::AlgorithmSinglePhaseControl& phase,
|
||||
SYSCTRL::VectorOrthogonalProjection& orts,
|
||||
FLTSYSLIB::PIController& regulator_active,
|
||||
FLTSYSLIB::PIController& regulator_reactive);
|
||||
#endif
|
||||
//
|
||||
};//AlgorithmPrestop
|
||||
|
||||
} /* namespace SYSCTRL */
|
||||
|
||||
#endif /* SYSCTRL_ALGORITHMSTOP_H_ */
|
||||
@ -0,0 +1,407 @@
|
||||
/*
|
||||
* AlgorithmWork.cpp
|
||||
*
|
||||
* Author: Aleksey Gerasimenko
|
||||
* gerasimenko.aleksey.n@gmail.com
|
||||
*/
|
||||
|
||||
#include "SYSCTRL/AlgorithmWork.h"
|
||||
|
||||
namespace SYSCTRL
|
||||
{
|
||||
//CONSTRUCTOR
|
||||
AlgorithmWork::AlgorithmWork(SYSCTRL::SystemEnvironment& env):
|
||||
AlgorithmBase(),
|
||||
m_env(env),
|
||||
m_reference_switcher(false),
|
||||
_execute(&SYSCTRL::AlgorithmWork::_execute_undef)
|
||||
//
|
||||
{}//CONSTRUCTOR
|
||||
//
|
||||
|
||||
void AlgorithmWork::setup()
|
||||
{
|
||||
_execute = &SYSCTRL::AlgorithmWork::_execute_run;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::reset()
|
||||
{
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
//
|
||||
m_env.regulator_voltage_load_direct.reset();
|
||||
m_env.regulator_voltage_load_quadrature.reset();
|
||||
//
|
||||
m_env.integrator_direct.reset();
|
||||
m_env.integrator_quadrature.reset();
|
||||
//
|
||||
m_env.regulator_current_limit.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc.reset();
|
||||
//
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
//
|
||||
m_env.regulator_current_limit_a.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc_a.reset();
|
||||
|
||||
m_env.regulator_current_limit_b.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc_b.reset();
|
||||
|
||||
m_env.regulator_current_limit_c.set_to_high_saturation();
|
||||
m_env.regulator_current_pfc_c.reset();
|
||||
|
||||
m_env.regulator_voltage_load_a_active.reset();
|
||||
m_env.regulator_voltage_load_a_reactive.reset();
|
||||
|
||||
m_env.regulator_voltage_load_b_active.reset();
|
||||
m_env.regulator_voltage_load_b_reactive.reset();
|
||||
|
||||
m_env.regulator_voltage_load_c_active.reset();
|
||||
m_env.regulator_voltage_load_c_reactive.reset();
|
||||
//
|
||||
#endif
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
|
||||
m_env.drc_positive_voltage_controller_direct.reset();
|
||||
m_env.drc_positive_voltage_controller_quadrature.reset();
|
||||
m_env.drc_negative_voltage_controller_direct.reset();
|
||||
m_env.drc_negative_voltage_controller_quadrature.reset();
|
||||
//
|
||||
m_env.drc_reference_voltage_direct_intensity.reset();
|
||||
//
|
||||
m_env.drc_regulator_current_load_direct.reset();
|
||||
m_env.drc_regulator_current_load_quadrature.reset();
|
||||
//
|
||||
m_env.drc_referencer_current_bypass_direct.reset();
|
||||
m_env.drc_referencer_current_bypass_quadrature.reset();
|
||||
//
|
||||
m_env.drc_regulator_current_limit.set_to_low_saturation();
|
||||
m_env.drc_regulator_current_pfc.reset();
|
||||
//
|
||||
m_reference_switcher = false;
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::reset_switcher()
|
||||
{
|
||||
m_reference_switcher = false;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::execute()
|
||||
{
|
||||
(this->*_execute)();
|
||||
//
|
||||
}//
|
||||
//
|
||||
|
||||
|
||||
#if TYPECONTROL == VECTORCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::_execute_run()
|
||||
{
|
||||
//
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
//if(m_env.algorithm_control.signal.enable_current_limit)
|
||||
if(false)
|
||||
{
|
||||
m_env.voltage_reference_load_direct = m_env.regulator_current_limit.execute(m_env.rms_current_load_module, m_env.current_reference_limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.regulator_current_limit.set_to_low_saturation();
|
||||
m_env.voltage_reference_load_direct = m_env.regulator_current_limit.get_output();
|
||||
}
|
||||
//
|
||||
//if(m_env.algorithm_control.signal.enable_pfc)
|
||||
if(false)
|
||||
{
|
||||
m_env.regulator_current_pfc.reset();
|
||||
m_env.voltage_reference_load_quadrature = m_env.regulator_current_pfc.get_output();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.regulator_current_pfc.reset();
|
||||
m_env.voltage_reference_load_quadrature = m_env.regulator_current_pfc.get_output();
|
||||
}
|
||||
//
|
||||
|
||||
// for PII-Controller
|
||||
#if TYPE_VOLTAGE_CONTROLLER == VOLTAGE_CONTROLLER_PII
|
||||
m_env.voltage_pi_reg_out_direct = m_env.regulator_voltage_load_direct.execute(m_env.voltage_reference_load_direct, m_env.voltage_load_direct);
|
||||
//m_env.voltage_pi_reg_out_quadrature = m_env.regulator_voltage_load_quadrature.execute(m_env.voltage_reference_load_quadrature, m_env.voltage_load_quadrature);
|
||||
m_env.voltage_pi_reg_out_quadrature = FP_ZERO;
|
||||
m_env.voltage_cell_direct = m_env.integrator_direct.execute(m_env.voltage_pi_reg_out_direct);
|
||||
//m_env.voltage_cell_quadrature = m_env.integrator_quadrature.execute(m_env.voltage_pi_reg_out_quadrature);
|
||||
m_env.voltage_cell_quadrature = FP_ZERO;
|
||||
#endif
|
||||
|
||||
// for I-Controller
|
||||
#if TYPE_VOLTAGE_CONTROLLER == VOLTAGE_CONTROLLER_I
|
||||
m_env.voltage_cell_direct = m_env.integrator_direct.execute(m_env.voltage_reference_load_direct - m_env.voltage_load_direct);
|
||||
m_env.voltage_cell_quadrature = FP_ZERO;
|
||||
#endif
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.voltage_cell_direct,
|
||||
m_env.voltage_cell_quadrature,
|
||||
m_env.voltage_cell_alpha,
|
||||
m_env.voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_env.voltage_cell_alpha,
|
||||
m_env.voltage_cell_beta,
|
||||
m_env.voltage_cell_a,
|
||||
m_env.voltage_cell_b,
|
||||
m_env.voltage_cell_c);
|
||||
//
|
||||
m_voltage_a = m_env.voltage_cell_a * m_env.cell_dc_voltage_a_reciprocal;
|
||||
m_voltage_b = m_env.voltage_cell_b * m_env.cell_dc_voltage_b_reciprocal;
|
||||
m_voltage_c = m_env.voltage_cell_c * m_env.cell_dc_voltage_c_reciprocal;
|
||||
//
|
||||
}//
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::_execute_run()
|
||||
{
|
||||
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
|
||||
m_env.phase_control.phase_a.reference.voltage_dc = m_env.phase_control.common_ref.voltage_dc;
|
||||
m_env.phase_control.phase_b.reference.voltage_dc = m_env.phase_control.common_ref.voltage_dc;
|
||||
m_env.phase_control.phase_c.reference.voltage_dc = m_env.phase_control.common_ref.voltage_dc;
|
||||
|
||||
m_env.phase_control.phase_a.reference.current_ampl_limit_const = m_env.phase_control.common_ref.current_limit_rms;
|
||||
m_env.phase_control.phase_b.reference.current_ampl_limit_const = m_env.phase_control.common_ref.current_limit_rms;
|
||||
m_env.phase_control.phase_c.reference.current_ampl_limit_const = m_env.phase_control.common_ref.current_limit_rms;
|
||||
|
||||
m_env.phase_control.phase_a.reference.current_ampl_pfc_const = m_env.phase_control.common_ref.current_pfc_rms;
|
||||
m_env.phase_control.phase_b.reference.current_ampl_pfc_const = m_env.phase_control.common_ref.current_pfc_rms;
|
||||
m_env.phase_control.phase_c.reference.current_ampl_pfc_const = m_env.phase_control.common_ref.current_pfc_rms;
|
||||
|
||||
|
||||
|
||||
_execute_single_phase(m_env.phase_control.phase_a,
|
||||
m_env.projection_voltage_input_a,
|
||||
m_env.main_abc_orts.phase_a,
|
||||
m_env.regulator_current_limit_a,
|
||||
m_env.regulator_current_pfc_a,
|
||||
m_env.regulator_dc_a,
|
||||
m_env.cell_dc_voltage_a,
|
||||
m_env.regulator_voltage_load_a_active,
|
||||
m_env.regulator_voltage_load_a_reactive);
|
||||
|
||||
_execute_single_phase(m_env.phase_control.phase_b,
|
||||
m_env.projection_voltage_input_b,
|
||||
m_env.main_abc_orts.phase_b,
|
||||
m_env.regulator_current_limit_b,
|
||||
m_env.regulator_current_pfc_b,
|
||||
m_env.regulator_dc_b,
|
||||
m_env.cell_dc_voltage_b,
|
||||
m_env.regulator_voltage_load_b_active,
|
||||
m_env.regulator_voltage_load_b_reactive);
|
||||
|
||||
_execute_single_phase(m_env.phase_control.phase_c,
|
||||
m_env.projection_voltage_input_c,
|
||||
m_env.main_abc_orts.phase_c,
|
||||
m_env.regulator_current_limit_c,
|
||||
m_env.regulator_current_pfc_c,
|
||||
m_env.regulator_dc_c,
|
||||
m_env.cell_dc_voltage_c,
|
||||
m_env.regulator_voltage_load_c_active,
|
||||
m_env.regulator_voltage_load_c_reactive);
|
||||
|
||||
m_voltage_a = m_env.phase_control.phase_a.reference.voltage_cell_relative;
|
||||
m_voltage_b = m_env.phase_control.phase_b.reference.voltage_cell_relative;
|
||||
m_voltage_c = m_env.phase_control.phase_c.reference.voltage_cell_relative;
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
#if TYPECONTROL == SCALARCONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::_execute_single_phase(SYSCTRL::AlgorithmSinglePhaseControl& phase,
|
||||
SYSCTRL::ProjectionAnalogSignalStructure& projection,
|
||||
SYSCTRL::VectorOrthogonalProjection& orts,
|
||||
FLTSYSLIB::PIController& regulator_limit,
|
||||
FLTSYSLIB::PIController& regulator_pfc,
|
||||
FLTSYSLIB::PIController& regulator_dc,
|
||||
float& dc_volatage,
|
||||
FLTSYSLIB::PIController& regulator_active,
|
||||
FLTSYSLIB::PIController& regulator_reactive)
|
||||
{
|
||||
|
||||
|
||||
if(phase.control_bit.signal.enable_current_limit)
|
||||
{
|
||||
|
||||
phase.reference.voltage_limit = regulator_limit.execute(phase.reference.current_ampl_limit_const, phase.feedback.current_ampl_real);
|
||||
|
||||
if(phase.control_bit.signal.enable_pfc)
|
||||
{
|
||||
phase.reference.voltage_pfc = regulator_pfc.execute(phase.reference.current_ampl_pfc_const, phase.feedback.current_ampl_jm) +
|
||||
regulator_dc.execute(phase.reference.voltage_dc, dc_volatage);
|
||||
}
|
||||
else
|
||||
{
|
||||
regulator_pfc.reset();
|
||||
phase.reference.voltage_pfc = projection.reactive;
|
||||
//
|
||||
}//if else
|
||||
}
|
||||
else
|
||||
{
|
||||
regulator_limit.set_to_high_saturation();
|
||||
phase.reference.voltage_limit = regulator_limit.get_output();
|
||||
//
|
||||
regulator_pfc.reset();
|
||||
phase.reference.voltage_pfc = projection.reactive;
|
||||
//
|
||||
}//if else
|
||||
|
||||
|
||||
if(phase.control_bit.signal.enable_pfc)
|
||||
{
|
||||
phase.reference.voltage_ampl_real = sqrtf(phase.reference.voltage_limit * phase.reference.voltage_limit - phase.reference.voltage_pfc * phase.reference.voltage_pfc);
|
||||
phase.reference.voltage_ampl_jm = phase.reference.voltage_pfc;
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
phase.reference.voltage_ampl_real = phase.reference.voltage_limit;
|
||||
phase.reference.voltage_ampl_jm = phase.reference.voltage_pfc;
|
||||
//
|
||||
}//if else
|
||||
//
|
||||
phase.reference.voltage_cell_ampl_real = regulator_active.execute(phase.reference.voltage_ampl_real, phase.feedback.voltage_ampl_real);
|
||||
//
|
||||
if(phase.control_bit.signal.enable_pfc)
|
||||
{
|
||||
phase.reference.voltage_cell_ampl_jm = regulator_reactive.execute(phase.reference.voltage_ampl_jm, phase.feedback.voltage_ampl_jm);
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
phase.reference.voltage_cell_ampl_jm = FP_ZERO;
|
||||
//
|
||||
}//if
|
||||
//
|
||||
phase.reference.voltage_cell_real = phase.reference.voltage_cell_ampl_real * orts.active;
|
||||
phase.reference.voltage_cell_jm = phase.reference.voltage_cell_ampl_jm * orts.reactive;
|
||||
phase.reference.voltage_cell = phase.reference.voltage_cell_real - phase.reference.voltage_cell_jm;
|
||||
//
|
||||
phase.reference.voltage_cell_relative = phase.reference.voltage_cell * phase.feedback.voltage_cell_dc_reciprocal;
|
||||
//
|
||||
}//
|
||||
#endif
|
||||
//
|
||||
|
||||
|
||||
#if TYPECONTROL == DIRECTREVERSECONTROL
|
||||
#pragma CODE_SECTION("ramfuncs");
|
||||
void AlgorithmWork::_execute_run()
|
||||
{
|
||||
|
||||
//
|
||||
m_env.hardware.ref_control_order = ORDER_START;
|
||||
//
|
||||
|
||||
if(m_reference_switcher)
|
||||
{
|
||||
//if(m_env.algorithm_control.signal.enable_current_limit)
|
||||
if(false)
|
||||
{
|
||||
m_env.drc_voltage_reference_load_direct = m_env.drc_regulator_current_limit.execute(m_env.rms_current_load_module, m_env.drc_current_reference_limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.drc_regulator_current_limit.set_to_low_saturation();
|
||||
m_env.drc_voltage_reference_load_direct = m_env.drc_regulator_current_limit.get_output();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.drc_voltage_reference_load_direct = m_env.drc_reference_voltage_direct_intensity.execute(m_env.drc_regulator_current_limit.get_output());
|
||||
//
|
||||
if(m_env.drc_voltage_reference_load_direct >= m_env.drc_regulator_current_limit.get_output())
|
||||
{
|
||||
m_reference_switcher = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//if(m_env.algorithm_control.signal.enable_pfc)
|
||||
if(false)
|
||||
{
|
||||
m_env.drc_regulator_current_pfc.reset();
|
||||
m_env.drc_voltage_reference_load_quadrature = m_env.drc_regulator_current_pfc.get_output();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_env.drc_regulator_current_pfc.reset();
|
||||
m_env.drc_voltage_reference_load_quadrature = m_env.drc_regulator_current_pfc.get_output();
|
||||
}
|
||||
//
|
||||
m_env.drc_positive_voltage_cell_direct = m_env.drc_positive_voltage_controller_direct.execute(m_env.drc_voltage_reference_load_direct, m_env.drc_positive_voltage_load_direct);
|
||||
//m_env.drc_positive_voltage_cell_quadrature = m_env.drc_positive_voltage_controller_quadrature.execute(m_env.drc_voltage_reference_load_quadrature, m_env.drc_positive_voltage_load_quadrature);
|
||||
m_env.drc_positive_voltage_cell_quadrature = FP_ZERO;
|
||||
m_env.drc_negative_voltage_cell_direct = m_env.drc_negative_voltage_controller_direct.execute(m_env.drc_voltage_reference_zero, m_env.drc_negaative_voltage_load_direct);
|
||||
m_env.drc_negative_voltage_cell_quadrature = m_env.drc_negative_voltage_controller_quadrature.execute(m_env.drc_voltage_reference_zero, m_env.drc_negative_voltage_load_quadrature);
|
||||
//m_env.drc_negative_voltage_cell_direct = FP_ZERO;
|
||||
//m_env.drc_negative_voltage_cell_quadrature = FP_ZERO;
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.drc_positive_voltage_cell_direct,
|
||||
m_env.drc_positive_voltage_cell_quadrature,
|
||||
m_env.drc_positive_voltage_cell_alpha,
|
||||
m_env.drc_positive_voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::park_inverse(m_env.main_ab_orts.active,
|
||||
m_env.main_ab_orts.reactive,
|
||||
m_env.drc_negative_voltage_cell_direct,
|
||||
m_env.drc_negative_voltage_cell_quadrature,
|
||||
m_env.drc_negative_voltage_cell_alpha,
|
||||
m_env.drc_negative_voltage_cell_beta);
|
||||
//
|
||||
FLTSYSLIB::Transformation::clarke_inverse(m_env.drc_positive_voltage_cell_alpha,
|
||||
m_env.drc_positive_voltage_cell_beta,
|
||||
m_env.drc_positive_voltage_cell_a,
|
||||
m_env.drc_positive_voltage_cell_b,
|
||||
m_env.drc_positive_voltage_cell_c);
|
||||
//
|
||||