the makefile to make a directory into executable file

1. Compilation 1.1 Windows A workspace for MS Visual Studio is provided with the name "hpm_vsXXXX.sln" in the directory "build\x86_windows". It contains the encoder and decoder projects. 1.2 Unix/Linux Makefiles are provided in the directory "build\x86_linux". 'make' command will create the obj files and generate the executable file in the 'bin' directory. 1.3 CMake for HPM Example for Windows: mkdir build_cmake cd build_cmake cmake .. -G open "HPM.sln" in build_cmake directory to generate the executable files to "build_cmake/app/Debug" or "build_cmake/app/Release" directory. Example for Linux: mkdir build_cmake cd build_cmake cmake .. make -j 'make' command will generate the executable file to the 'build_cmake/app' directory. ******************************************************************* 2. Command line parameters 2.1 Encoder encoder_app [--config file] [-paramShort ParameterValue] [--paramLong ParameterValue] --config file All Parameters are initially taken from the 'file', typically: "encode_RA.cfg". -paramShort ParameterValue --paramLong ParameterValue If -paramShort or --paramLong parameters are present, then the ParameterValue will override the default settings in the configuration file. 2.2 Decoder decoder_app [-paramShort ParameterValue] [--paramLong ParameterValue] All decoding parameters are set by the command lines. ******************************************************************* 3. Examples of command line For SDR, using cfg\encode_RA.cfg For PG, using cfg\HDR\encode_RA_PG.cfg For HLG, using cfg\HDR\encode_RA_HLG.cfg 3.1 Random Access build\x86_windows\x64\Release\encoder_app --config cfg\encode_RA.cfg -i City_1280x720_60.yuv -w 1280 -h 720 -z 60 -p 64 -f 9 -d 8 -q 45 -o City_RA.bin -r City_RA_rec.yuv build\x86_windows\x64\Release\decoder_app -s -i City_RA.bin -o City_RA_dec.yuv 3.2 All Intra build\x86_windows\x64\Release\encoder_app --config cfg\encode_AI.cfg -i City_1280x720_60.yuv -w 1280 -h 720 -z 60 -f 9 -d 8 -q 45 -o City_AI.bin -r City_AI_rec.yuv build\x86_windows\x64\Release\decoder_app -s -i City_AI.bin -o City_AI_dec.yuv 3.3 Low Delay build\x86_windows\x64\Release\encoder_app --config cfg\encode_LD.cfg -i City_1280x720_60.yuv -w 1280 -h 720 -z 60 -f 9 -d 8 -q 45 -o City_LD.bin -r City_LD_rec.yuv build\x86_windows\x64\Release\decoder_app -s -i City_LD.bin -o City_LD_dec.yuv ******************************************************************* 4. Configuration files The default configuration files are provided in the directory "cfg". These contain explanatory comments for each parameter. If the parameter name is undefined, the program will be terminated with an error message. *******************************************************************
07-20
#!/bin/bash # # git $Id$ #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: # Copyright (c) 2002-2025 The ROMS Group ::: # Licensed under a MIT/X style license ::: # See License_ROMS.md ::: #::::::::::::::::::::::::::::::::::::::::::::::::::::: Hernan G. Arango ::: # ::: # ROMS Compiling BASH Script ::: # ::: # Script to compile an user application where the application-specific ::: # files are kept separate from the ROMS source code. ::: # ::: # Q: How/why does this script work? ::: # ::: # A: The ROMS makefile configures user-defined options with a set of ::: # flags such as ROMS_APPLICATION. Browse the makefile to see these. ::: # If an option in the makefile uses the syntax ?= in setting the ::: # default, this means that make will check whether an environment ::: # variable by that name is set in the shell that calls make. If so ::: # the environment variable value overrides the default (and the ::: # user need not maintain separate makefiles, or frequently edit ::: # the makefile, to run separate applications). ::: # ::: # Usage: ::: # ::: # ./build_roms.sh [options] ::: # ::: # Options: ::: # ::: # -b Compile a specific ROMS GitHub branch ::: # ::: # build_roms.sh -j 10 -b feature/kernel ::: # ::: # -g Compile with debug flag (slower code) ::: # ::: # build_roms.sh -g -j 10 ::: # ::: # -j [N] Compile in parallel using N CPUs ::: # omit argument for all available CPUs ::: # ::: # -pio Compile with PIO (Parallel I/O) NetCDF library ::: # Otherwise, it used standard NetCDF library (slower) ::: # ::: # build_roms.sh -pio -j 10 ::: # ::: # -p macro Prints any Makefile macro value. For example, ::: # ::: # build_roms.sh -p FFLAGS ::: # ::: # -noclean Do not clean already compiled objects ::: # ::: # Notice that sometimes the parallel compilation fail to find MPI ::: # include file "mpif.h". ::: # ::: # The branch option -b is only possible for ROMS source code from ::: # https://github.com/myroms. Such versions are under development ::: # and targeted to advanced users, superusers, and beta testers. ::: # Regular and novice users must use the default 'develop' branch. ::: # ::: #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: export which_MPI=openmpi # default, overwritten below g_flags=0 parallel=0 pio_lib=0 clean=1 dprint=0 branch=0 command="build_roms.sh $@" separator=`perl -e "print '<>' x 50;"` export MY_CPP_FLAGS= while [ $# -gt 0 ] do case "$1" in -g ) shift g_flags=1 ;; -pio ) shift pio_lib=1 ;; -j ) shift parallel=1 test=`echo $1 | grep '^[0-9]\+$'` if [ "$test" != "" ]; then NCPUS="-j $1" shift else NCPUS="-j" fi ;; -p ) shift clean=0 dprint=1 debug="print-$1" shift ;; -noclean ) shift clean=0 ;; -b ) shift branch=1 branch_name=`echo $1 | grep -v '^-'` if [ "$branch_name" == "" ]; then echo "Please enter a ROMS GitHub branch name." exit 1 fi shift ;; * ) echo "" echo "${separator}" echo "$0 : Unknown option [ $1 ]" echo "" echo "Available Options:" echo "" echo "-b branch_name Compile specific ROMS GitHub branch name" echo " For example: build_roms.sh -b feature/kernel" echo "" echo "-g Compile with debugging flags, slower code" echo "" echo "-j [N] Compile in parallel using N CPUs" echo " omit argument for all avaliable CPUs" echo "" echo "-pio Compile with the PIO NetCDF Library" echo "" echo "-p macro Prints any Makefile macro value" echo " For example: build_roms.sh -p FFLAGS" echo "" echo "-noclean Do not clean already compiled objects" echo "" echo "${separator}" echo "" exit 1 ;; esac done # Set the CPP option defining the particular application. This will # determine the name of the ".h" header file with the application # CPP definitions. export ROMS_APPLICATION=UPWELLING # Set a local environmental variable to define the path to the directories # where the ROMS source code is located (MY_ROOT_DIR), and this project's # configuration and files are kept (MY_PROJECT_DIR). Notice that if the # User sets the ROMS_ROOT_DIR environment variable in their computer logging # script describing the location from where the ROMS source code was cloned # or downloaded, it uses that value. if [ -n "${ROMS_ROOT_DIR:+1}" ]; then export MY_ROOT_DIR=${ROMS_ROOT_DIR} else export MY_ROOT_DIR=${HOME}/ocean/repository/git fi export MY_PROJECT_DIR=${PWD} # The path to the user's local current ROMS source code. # # If downloading ROMS locally, this would be the user's Working Copy Path. # One advantage of maintaining your source code copy is that when working # simultaneously on multiple machines (e.g., a local workstation, a local # cluster, and a remote supercomputer), you can update with the latest ROMS # release and always get an up-to-date customized source on each machine. # This script allows for differing paths to the code and inputs on other # computers. export MY_ROMS_SRC=${MY_ROOT_DIR}/roms # Set path of the directory containing makefile configuration (*.mk) files. # The user has the option to specify a customized version of these files # in a different directory than the one distributed with the source code, # ${MY_ROMS_SRC}/Compilers. If this is the case, you need to keep these # configurations files up-to-date. export COMPILERS=${MY_ROMS_SRC}/Compilers #export COMPILERS=${HOME}/Compilers/ROMS #-------------------------------------------------------------------------- # Set tunable CPP options. #-------------------------------------------------------------------------- # # Sometimes it is desirable to activate one or more CPP options to run # different variants of the same application without modifying its header # file. If this is the case, specify each options here using the -D syntax. # Notice also that you need to use shell's quoting syntax to enclose the # definition. Both single or double quotes work. For example, # #export MY_CPP_FLAGS="${MY_CPP_FLAGS} -DAVERAGES" #export MY_CPP_FLAGS="${MY_CPP_FLAGS} -DDEBUGGING" # # can be used to write time-averaged fields. Notice that you can have as # many definitions as you want by appending values. if [ $pio_lib -eq 1 ]; then export MY_CPP_FLAGS="${MY_CPP_FLAGS} -DPIO_LIB" fi #-------------------------------------------------------------------------- # Compiler options. #-------------------------------------------------------------------------- # # Other user defined environmental variables. See the ROMS makefile for # details on other options the user might want to set here. Be sure to # leave the switches meant to be off set to an empty string or commented # out. Any string value (including off) will evaluate to TRUE in # conditional if-statements. export USE_MPI=on # distributed-memory parallelism export USE_MPIF90=on # compile with mpif90 script #export which_MPI=intel # compile with mpiifort library #export which_MPI=mpich # compile with MPICH library #export which_MPI=mpich2 # compile with MPICH2 library #export which_MPI=mvapich2 # compile with MVAPICH2 library export which_MPI=openmpi # compile with OpenMPI library #export USE_OpenMP=on # shared-memory parallelism #export FORT=ifx export FORT=ifort #export FORT=gfortran #export FORT=pgi if [ $g_flags -eq 1 ]; then export USE_DEBUG=on # use Fortran debugging flags fi export USE_LARGE=on # activate 64-bit compilation #-------------------------------------------------------------------------- # Building the ROMS executable using the shared library is not recommended # because it requires keeping track of the matching libROMS.{so|dylib} # which is located in the Build_roms or Build_romsG directory and will be # lost and/or replaced with each new build. The option to build the shared # version of libROMS was introduced for use in model coupling systems. #-------------------------------------------------------------------------- #export SHARED=on # build libROMS.{so|dylib} export STATIC=on # build libROMS.a export EXEC=on # build roms{G|M|O|S} executable # ROMS I/O choices and combinations. A more complete description of the # available options can be found in the wiki (https://myroms.org/wiki/IO). # Most users will want to enable at least USE_NETCDF4 because that will # instruct the ROMS build system to use nf-config to determine the # necessary libraries and paths to link into the ROMS executable. export USE_NETCDF4=on # compile with NetCDF-4 library #export USE_PARALLEL_IO=on # Parallel I/O with NetCDF-4/HDF5 if [ $pio_lib -eq 1 ]; then export USE_PIO=on # Parallel I/O with PIO library fi # If any of the coupling component use the HDF5 Fortran API for primary # I/O, we need to compile the main driver with the HDF5 library. #export USE_HDF5=on # compile with HDF5 library #-------------------------------------------------------------------------- # If coupling Earth System Models (ESM), set the location of the ESM # component libraries and modules. #-------------------------------------------------------------------------- source ${MY_ROMS_SRC}/ESM/esm_libs.sh ${MY_ROMS_SRC}/ESM/esm_libs.sh #-------------------------------------------------------------------------- # If applicable, use my specified library paths. #-------------------------------------------------------------------------- export USE_MY_LIBS=no # use system default library paths #export USE_MY_LIBS=yes # use my customized library paths MY_PATHS=${COMPILERS}/my_build_paths.sh if [ "${USE_MY_LIBS}" == "yes" ]; then source ${MY_PATHS} ${MY_PATHS} fi #-------------------------------------------------------------------------- # The rest of this script sets the path to the users header file and # analytical source files, if any. See the templates in User/Functionals. #-------------------------------------------------------------------------- # # If applicable, use the MY_ANALYTICAL_DIR directory to place your # customized biology model header file (like fennel.h, nemuro.h, ecosim.h, # etc). export MY_HEADER_DIR=${MY_PROJECT_DIR} export MY_ANALYTICAL_DIR=${MY_PROJECT_DIR} # Put the binary to execute in the following directory. export BINDIR=${MY_PROJECT_DIR} echo "" echo "${separator}" # Stop if activating both MPI and OpenMP at the same time. if [ -n "${USE_MPI:+1}" ] && [ -n "${USE_OpenMP:+1}" ]; then echo "" echo "You cannot activate USE_MPI and USE_OpenMP at the same time!" exit 1 fi # Put the f90 files in a project specific Build directory to avoid conflict # with other projects. if [ -n "${USE_DEBUG:+1}" ]; then export BUILD_DIR=${MY_PROJECT_DIR}/Build_romsG export myBIN=${BINDIR}/romsG else if [ -n "${USE_OpenMP:+1}" ]; then export BUILD_DIR=${MY_PROJECT_DIR}/Build_romsO export myBIN=${BINDIR}/romsO elif [ -n "${USE_MPI:+1}" ]; then export BUILD_DIR=${MY_PROJECT_DIR}/Build_romsM export myBIN=${BINDIR}/romsM else export BUILD_DIR=${MY_PROJECT_DIR}/Build_roms export myBIN=${BINDIR}/romsS fi fi # For backward compatibility, set deprecated SCRATCH_DIR to compile # older released versions of ROMS. export SCRATCH_DIR=${BUILD_DIR} # If necessary, create ROMS build directory. if [ ! -d ${BUILD_DIR} ]; then echo "" echo "Creating ROMS build directory: ${BUILD_DIR}" echo "" mkdir $BUILD_DIR fi # Go to the users source directory to compile. The options set above will # pick up the application-specific code from the appropriate place. if [ $branch -eq 1 ]; then # Check out requested branch from ROMS GitHub. if [ ! -d ${MY_PROJECT_DIR}/src ]; then echo "" echo "Downloading ROMS source code from GitHub: https://github.com/myroms" echo "" git clone https://www.github.com/myroms/roms.git src fi echo "" echo "Checking out ROMS GitHub branch: $branch_name" echo "" cd src git checkout $branch_name # If we are using the COMPILERS from the ROMS source code # overide the value set above if [[ ${COMPILERS} == ${MY_ROMS_SRC}* ]]; then export COMPILERS=${MY_PROJECT_DIR}/src/Compilers fi export MY_ROMS_SRC=${MY_PROJECT_DIR}/src else echo "" echo "Using ROMS source code from: ${MY_ROMS_SRC}" echo "" cd ${MY_ROMS_SRC} fi #-------------------------------------------------------------------------- # Compile. #-------------------------------------------------------------------------- # Remove build directory. if [ $clean -eq 1 ]; then echo "" echo "Cleaning ROMS build directory: ${BUILD_DIR}" echo "" make clean fi # Compile (the binary will go to BINDIR set above). if [ $dprint -eq 1 ]; then make $debug else echo "" echo "Compiling ROMS source code:" echo "" if [ $parallel -eq 1 ]; then make $NCPUS else make fi HEADER=`echo ${ROMS_APPLICATION} | tr '[:upper:]' '[:lower:]'`.h echo "" echo "${separator}" echo "GNU Build script command: ${command}" echo "ROMS source directory: ${MY_ROMS_SRC}" echo "ROMS header file: ${MY_HEADER_DIR}/${HEADER}" echo "ROMS build directory: ${BUILD_DIR}" echo "ROMS executable: ${myBIN}" if [ $branch -eq 1 ]; then echo "ROMS downloaded from: https://github.com/myroms/roms.git" echo "ROMS compiled branch: $branch_name" fi echo "ROMS Application: ${ROMS_APPLICATION}" FFLAGS=`make print-FFLAGS | cut -d " " -f 3-` echo "Fortran compiler: ${FORT}" echo "Fortran flags: ${FFLAGS}" if [ -n "${MY_CPP_FLAGS:+1}" ]; then echo "Added CPP Options: ${MY_CPP_FLAGS}" fi echo "${separator}" echo "" fi 配置ROMS编译选项:进入roms目录,查看ROMS/External目录下的build_roms.sh脚本,根据需要修改编译选项,例如启用MPI并行计算、指定编译器等。 需要修改哪些内容呢?
07-19
内容概要:本文详细介绍了一种基于Simulink的表贴式永磁同步电机(SPMSM)有限控制集模型预测电流控制(FCS-MPCC)仿真系统。通过构建PMSM数学模型、坐标变换、MPC控制器、SVPWM调制等模块,实现了对电机定子电流的高精度跟踪控制,具备快速动态响应和低稳态误差的特点。文中提供了完整的仿真建模步骤、关键参数设置、核心MATLAB函数代码及仿真结果分析,涵盖转速、电流、转矩和三相电流波形,验证了MPC控制策略在动态性能、稳态精度和抗负载扰动方面的优越性,并提出了参数自整定、加权代价函数、模型预测转矩控制和弱磁扩速等优化方向。; 适合人群:自动化、电气工程及其相关专业本科生、研究生,以及从事电机控制算法研究与仿真的工程技术人员;具备一定的电机原理、自动控制理论和Simulink仿真基础者更佳; 使用场景及目标:①用于永磁同步电机模型预测控制的教学演示、课程设计或毕业设计项目;②作为电机先进控制算法(如MPC、MPTC)的仿真验证平台;③支撑科研中对控制性能优化(如动态响应、抗干扰能力)的研究需求; 阅读建议:建议读者结合Simulink环境动手搭建模型,深入理解各模块间的信号流向与控制逻辑,重点掌握预测模型构建、代价函数设计与开关状态选择机制,并可通过修改电机参数或控制策略进行拓展实验,以增强实践与创新能力。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值