Driver porting: per-CPU variables

本文介绍了Linux 2.6内核中使用per-CPU变量的优势,包括减少锁定需求和提高缓存性能。讨论了如何在编译时创建、导出和链接这些变量,并提供了实例代码。

Driver porting: per-CPU variables

This article is part of the LWNPorting Drivers to 2.6 series.
The 2.6 kernel makes extensive use of per-CPU data - arrays containing one object for each processor on the system. Per-CPU variables are not suitable for every task, but, in situations where they can be used, they do offer a couple of advantages:

  • Per-CPU variables have fewer locking requirements since they are (normally) only accessed by a single processor. There is nothing other than convention that keeps processors from digging around in other processors' per-CPU data, however, so the programmer must remain aware of what is going on.

  • Nothing destroys cache performance as quickly as accessing the same data from multiple processors. Restricting each processor to its own area eliminates cache line bouncing and improves performance.

Examples of per-CPU data in the 2.6 kernel include lists of buffer heads, lists of hot and cold pages, various kernel and networking statistics (which are occasionally summed together into the full system values), timer queues, and so on. There are currently no drivers using per-CPU values, but some applications (i.e. networking statistics for high-bandwidth adapters) might benefit from their use.

The normal way of creating per-CPU variables at compile time is with this macro (defined in <linux/percpu.h>):

    DEFINE_PER_CPU(type, name);

This sort of definition will create name, which will hold one object of the given type for each processor on the system. If the variables are to be exported to modules, use:

    EXPORT_PER_CPU_SYMBOL(name);
    EXPORT_PER_CPU_SYMBOL_GPL(name);

If you need to link to a per-CPU variable defined elsewhere, a similar macro may be used:

    DECLARE_PER_CPU(type, name);

Variables defined in this way are actually an array of values. To get at a particular processor's value, theper_cpu() macro may be used; it works as an lvalue, so so code like the following works:

    DEFINE_PER_CPU(int, mypcint);

    per_cpu(mypcint, smp_processor_id()) = 0;

The above code can be dangerous, however. Accessing per-CPU variables can often be done without locking, since each processor has its own private area to work in. The 2.6 kernel is preemptible, however, and that adds a couple of challenges. Since kernel code can be preempted, it is possible to encounter race conditions with other kernel threads running on the same processor. Also, accessing a per-CPU variable requires knowing which processor you are running on; it would not do to be preempted and moved to a different CPU between looking up the processor ID and accessing a per-CPU variable.

For both of the above reasons, kernel preemption usually must be disabled when working with per-CPU data. The usual way of doing this is with the get_cpu_var and put_cpu_var macros. get_cpu_var works as an lvalue, so it can be assigned to, have its address taken, etc. Perhaps the simplest example of the use of these macros can be found innet/socket.c:

	get_cpu_var(sockets_in_use)++;
	put_cpu_var(sockets_in_use);

Of course, since preemption is disabled between the calls, the code should take care not to sleep. Note that there is no version of these macros for access to another CPU's data; cross-processor access to per-CPU data requires explicit locking arrangements.

It is also possible to allocate per-CPU variables dynamically. Simply use these functions:

    void *alloc_percpu(type);
    void free_percpu(const void *);

alloc_percpu() will allocate one object (of the given type) for each CPU on the system; the allocated storage will be zeroed before being returned to the caller.

There is another set of macros which may be used to access per-CPU data obtained with kmalloc_percpu(). At the lowest level, you may use:

    per_cpu_ptr(void *ptr, int cpu)

which returns (without any concurrency control) a pointer to the per-CPU data for the given cpu. For access to a local processor's data, with preemption disabled, use:

    get_cpu_ptr(ptr)
    put_cpu_ptr(ptr)

With the usual proviso that you do not sleep between the two.


================================ [CLEAN SUCCESS] Took 0.00 seconds ================================ ================================ [Python环境正常] ================================ warning: the int symbol LFS_PARTITION_ID (defined at middleware/chips/ws63/Kconfig:105) has a non-int default 0x21 (undefined) warning: default on the choice symbol MIDDLEWARE_SUPPORT_UPG_COMPRESS (defined at middleware/chips/ws63/Kconfig:52) will have no effect, as defaults do not affect choice symbols warning: default on the choice symbol MIDDLEWARE_SUPPORT_UPG_AB (defined at middleware/chips/ws63/Kconfig:59) will have no effect, as defaults do not affect choice symbols warning: default on the choice symbol MIDDLEWARE_SUPPORT_EXCEPT_REBOOT (defined at middleware/chips/ws63/Kconfig:85) will have no effect, as defaults do not affect choice symbols warning: default on the choice symbol MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER (defined at middleware/chips/ws63/Kconfig:91) will have no effect, as defaults do not affect choice symbols D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_flashboot.config:432: warning: DRIVER_SUPPORT_DMA (defined at drivers/drivers/Kconfig:51) set more than once. Old value "n", new value "y". Not searching for unused variables given on the command line. -- BUILD_PLATFORM: windows -- BUILD_PLATFORM: windows -- The C compiler identification is GNU 7.3.0 -- The ASM compiler identification is GNU -- Found assembler: D:/fbb_ws63-master/src/tools/bin/compiler/riscv/cc_riscv32_musl_100/cc_riscv32_musl_win/bin/riscv32-linux-musl-gcc.exe -- The CXX compiler identification is GNU 7.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Detecting CXX compile features -- Detecting CXX compile features - done GEN_TARGET_SRC = D:/fbb_ws63-master/src/output/ws63/acore/acore.c PRECOMPILE_TARGET = D:/fbb_ws63-master/src/output/ws63/acore/acore.etypes TARGET_INCLUDE = D:/fbb_ws63-master/src/middleware/chips/ws63/nv/nv_config/include;D:/fbb_ws63-master/src/middleware/utils/common_headers/native BGTP_PROJECT=ws63 BGTP_ROM_VERSION=false BGTP_DEVICE_ONLY=false BG COMMON BTH_ROM_LIST:__null__ BTH_ROM_LIST:__null__ -- project_name: -- Configuring done -- Generating done -- Build files have been written to: D:/fbb_ws63-master/src/output/ws63/acore/ws63-flashboot [0/1] Re-running CMake... ninja: error: rebuilding 'build.ninja': subcommand failed FAILED: build.ninja C:\Users\���ļ�\AppData\Local\Programs\Python\Python311\Lib\site-packages\cmake\data\bin\cmake.exe --regenerate-during-build -SD:\fbb_ws63-master\src -BD:\fbb_ws63-master\src\output\ws63\acore\ws63-flashboot CreateProcess failed: The system cannot find the file specified. python path: C:\Users\���ļ�\AppData\Local\Programs\Python\Python311\python.exe [ws63][acore] run custom cmd success! D:\fbb_ws63-master\src\build\script\.\..\..\config.in d:\fbb_ws63-master\src Kconfig header saved to 'D:\fbb_ws63-master\src\output\ws63\acore\ws63-flashboot\mconfig.h' ######### Build target:ws63_flashboot failed warning: the int symbol LFS_PARTITION_ID (defined at middleware/chips/ws63/Kconfig:105) has a non-int default 0x21 (undefined) warning: default on the choice symbol MIDDLEWARE_SUPPORT_UPG_COMPRESS (defined at middleware/chips/ws63/Kconfig:52) will have no effect, as defaults do not affect choice symbols warning: default on the choice symbol MIDDLEWARE_SUPPORT_UPG_AB (defined at middleware/chips/ws63/Kconfig:59) will have no effect, as defaults do not affect choice symbols warning: default on the choice symbol MIDDLEWARE_SUPPORT_EXCEPT_REBOOT (defined at middleware/chips/ws63/Kconfig:85) will have no effect, as defaults do not affect choice symbols warning: default on the choice symbol MIDDLEWARE_SUPPORT_EXCEPT_WAITFOREVER (defined at middleware/chips/ws63/Kconfig:91) will have no effect, as defaults do not affect choice symbols D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:215: warning: DRIVER_SUPPORT_DMA (defined at drivers/drivers/Kconfig:51) set more than once. Old value "n", new value "n". D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:216: warning: DRIVER_SUPPORT_FLASH (defined at drivers/drivers/Kconfig:108) set more than once. Old value "n", new value "n". D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:256: warning: DRIVER_SUPPORT_HASH (defined at drivers/drivers/Kconfig:137) set more than once. Old value "n", new value "n". D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:259: warning: DRIVER_SUPPORT_EDGE (defined at drivers/drivers/Kconfig:66) set more than once. Old value "n", new value "n". D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:264: warning: DRIVER_SUPPORT_EFLASH (defined at drivers/drivers/Kconfig:80) set more than once. Old value "n", new value "n". D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:394: warning: DRIVER_SUPPORT_USB (defined at drivers/drivers/Kconfig:503) set more than once. Old value "n", new value "n". D:\fbb_ws63-master\src\build\script\.\..\..\build\config\target_config\ws63\menuconfig\acore\ws63_liteos_app.config:685: warning: DRIVER_SUPPORT_DMA (defined at drivers/drivers/Kconfig:51) set more than once. Old value "n", new value "y". Not searching for unused variables given on the command line. -- BUILD_PLATFORM: windows -- BUILD_PLATFORM: windows -- The C compiler identification is GNU 7.3.0 -- The ASM compiler identification is GNU -- Found assembler: D:/fbb_ws63-master/src/tools/bin/compiler/riscv/cc_riscv32_musl_100/cc_riscv32_musl_fp_win/bin/riscv32-linux-musl-gcc.exe -- The CXX compiler identification is GNU 7.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Detecting CXX compile features -- Detecting CXX compile features - done LOSCFG_PLATFORM is set to ws63 LOSCFG_COMPILER_GNU_BINUTILS is set to y LOSCFG_COMPILER_GCC is set to y LOSCFG_COMPILER_TOOLCHAIN_MUSL is set to y LOSCFG_COMPILER_RISCV_GCC_MUSL is set to y LOSCFG_COMPILER_RISCV_UNKNOWN is set to y LOSCFG_RISCV_COMPILER_OPTIONS_USER_DEFINED is set to LOSCFG_RISCV_COMPILER_OPTIONS_LDM_STM is set to y LOSCFG_RISCV_COMPILER_OPTIONS_EMIT_LLI is set to y LOSCFG_COMPILER_OPTIMIZE_SIZE is set to y LOSCFG_FAMILY_AIOT is set to y LOSCFG_FAMILY is set to aiot LOSCFG_PLATFORM is set to ws63 LOSCFG_PLATFORM_WS63 is set to y LOSCFG_USING_BOARD_LD is set to y LOSCFG_USING_BOARD_RESET_VECTOR is set to y LOSCFG_ARCH_FPU_ENABLE is set to y LOSCFG_APC_ENABLE is set to y LOSCFG_ARCH_PMU is set to y LOSCFG_ARCH_RISCV32 is set to y LOSCFG_ARCH_RISCV_RV32IMC is set to y LOSCFG_ARCH_RISCV_RV32F is set to y LOSCFG_ARCH_LINXCORE_131 is set to y LOSCFG_KERNEL_MIN is set to y LOSCFG_SCHED is set to y LOSCFG_SCHED_SQ is set to y LOSCFG_BASE_CORE_TIMESLICE is set to y LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT is set to 2 LOSCFG_BASE_CORE_TSK_MONITOR is set to y LOSCFG_TASK_STACK_DYNAMIC_ALLOCATION is set to y LOSCFG_BASE_CORE_TSK_LIMIT is set to 28 LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE is set to 1024 LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE is set to 2048 LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE is set to 2048 LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE is set to 1024 LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO is set to 10 LOSCFG_BASE_CORE_TICK_PER_SECOND is set to 100 LOSCFG_BASE_CORE_USE_SINGLE_LIST is set to y LOSCFG_STARTUP_STACK_SIZE is set to 0x4000 LOSCFG_KERNEL_MEM_ALLOC is set to y LOSCFG_KERNEL_MEM_BESTFIT is set to y LOSCFG_KERNEL_MEM_SLAB_EXTENTION is set to y LOSCFG_ARCH_INTERRUPT_TAKEOVER is set to y LOSCFG_ARCH_INTERRUPT_PREEMPTION is set to y LOSCFG_HWI_PRE_POST_PROCESS is set to y LOSCFG_HWI_WITH_ARG is set to y LOSCFG_IRQ_STACK_SIZE is set to 0x2000 LOSCFG_NMI_STACK_SIZE is set to 0x800 LOSCFG_PLATFORM_HWI_LIMIT is set to 96 LOSCFG_HWI_PRIO_LIMIT is set to 7 LOSCFG_EXC_STACK_SIZE is set to 0x800 LOSCFG_BASE_CORE_SWTMR is set to y LOSCFG_BASE_CORE_SWTMR_LIMIT is set to 16 LOSCFG_BASE_IPC_QUEUE is set to y LOSCFG_QUEUE_DYNAMIC_ALLOCATION is set to y LOSCFG_BASE_IPC_QUEUE_LIMIT is set to 16 LOSCFG_BASE_IPC_EVENT is set to y LOSCFG_BASE_IPC_MUX is set to y LOSCFG_MUTEX_WAITMODE_PRIO is set to y LOSCFG_BASE_IPC_MUX_LIMIT is set to 60 LOSCFG_BASE_IPC_SEM is set to y LOSCFG_BASE_IPC_SEM_LIMIT is set to 32 LOSCFG_KERNEL_PRINTF is set to y LOSCFG_KERNEL_PRINTF_SIZE_EXTEND is set to y LOSCFG_KERNEL_RINGBUF is set to y LOSCFG_BASE_CORE_SYS_RES_CHECK is set to y LOSCFG_LIB_LIBC is set to y LOSCFG_LIB_LIBM is set to y LOSCFG_LIB_FORMAT is set to y LOSCFG_COMPAT_CMSIS is set to y LOSCFG_COMPAT_CMSIS_VER_2 is set to y LOSCFG_COMPAT_LINUX is set to y LOSCFG_COMPAT_LINUX_PENDLIST is set to y LOSCFG_COMPAT_LINUX_TIMER is set to y LOSCFG_COMPAT_LINUX_COMPLETION is set to y LOSCFG_COMPAT_LINUX_WAITQUEUE is set to y LOSCFG_COMPAT_LINUX_DRIVER_BASE is set to y LOSCFG_NET_IPERF is set to y LOSCFG_BACKTRACE is set to y LOSCFG_SERIAL_OUTPUT_ENABLE is set to y LOSCFG_KERNEL_CPUP is set to y LOSCFG_DRIVERS_BASE is set to y LOSCFG_RISCV_HIMIDEERV200_PLIC is set to y LOSCFG_TIMER_VENDOR is set to y LOSCFG_DRIVERS_UART_VENDOR is set to y LOSCFG_DRIVERS_SIMPLE_UART is set to y LOSCFG_CC_NO_STACKPROTECTOR is set to y CMAKE_TOOLCHAIN_FILE is defined ahead, skip auto-config compiler CMAKE_TOOLCHAIN_FILE is defined ahead, skip auto-config compiler OUT:D:/fbb_ws63-master/src/output/ws63/acore/ws63-liteos-app/kernel/liteos/liteos_v208.5.0 LITEOS_MODULE_DEP_LIBS_PATH: LITEOS_DEP_LIBS_INT: LITEOS_DEP_LIBS_EXT:gcc;gcc_eh LITEOS_BASELIB:m;gcc;gcc_eh LOS_INTF_DEP_TARGETS: -- COM_HEADER-includeD:/fbb_ws63-master/src/output/ws63/acore/ws63-liteos-app/kernel/liteos/liteos_v208.5.0/menuconfig/include/menuconfig.h -- D:/fbb_ws63-master/src/drivers/chips/ws63/porting/patch/sfc_patch.c is not found, finding libplat_patch.a in D:/fbb_ws63-master/src/drivers/chips/ws63/porting/patch/ws63-liteos-app -- D:/fbb_ws63-master/src/drivers/chips/ws63/rom_config/acore/output/rom_callback.S is not found, finding librom_callback.a in D:/fbb_ws63-master/src/drivers/chips/ws63/ws63-liteos-app GEN_TARGET_SRC = D:/fbb_ws63-master/src/output/ws63/acore/acore.c PRECOMPILE_TARGET = D:/fbb_ws63-master/src/output/ws63/acore/acore.etypes TARGET_INCLUDE = D:/fbb_ws63-master/src/middleware/chips/ws63/nv/nv_config/include;D:/fbb_ws63-master/src/middleware/utils/common_headers/native -- D:/fbb_ws63-master/src/middleware/utils/at/at_bt_cmd/src/at_bt_cmd_register.c is not found, finding libbt_at.a in D:/fbb_ws63-master/src/middleware/utils/at/at_bt_cmd/ws63-liteos-app -- D:/fbb_ws63-master/src/middleware/utils/at/at_radar_cmd/at/at_radar.c is not found, finding libradar_at.a in D:/fbb_ws63-master/src/middleware/utils/at/at_radar_cmd/ws63-liteos-app Build wifi device with rom repo! -- D:/fbb_ws63-master/src/protocol/wifi/rom_code/ws63/source/alg/iot_alg/device/alg_main.c is not found, finding libwifi_driver_dmac.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/rom_code/ws63/source/common/romable/wifi_rom_data.c is not found, finding libwifi_rom_data.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/host/feature/interface/hmac_feature_interface.c is not found, finding libwifi_driver_hmac.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/host/forward/hmac_rx_data.c is not found, finding libwifi_driver_tcm.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/alg/iot_alg/host/alg_txbf.c is not found, finding libwifi_alg_txbf.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/alg/iot_alg/host/alg_temp_protect.c is not found, finding libwifi_alg_temp_protect.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/alg/iot_alg/host/alg_anti_interference.c is not found, finding libwifi_alg_anti_interference.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/alg/iot_alg/host/alg_edca_opt.c is not found, finding libwifi_alg_edca_opt.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/wifi/source/alg/iot_alg/host/alg_cca_intrf_mode.c is not found, finding libwifi_alg_cca_opt.a in D:/fbb_ws63-master/src/protocol/wifi/ws63-liteos-app BGTP_PROJECT=ws63 BGTP_ROM_VERSION=true BGTP_DEVICE_ONLY=false -- D:/fbb_ws63-master/src/protocol/bt/controller/bgtp/__null__ is not found, finding libbgtp.a in D:/fbb_ws63-master/src/protocol/bt/controller/bgtp/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/bt/controller/bgtp/__null__ is not found, finding libbgtp_rom_data.a in D:/fbb_ws63-master/src/protocol/bt/controller/bgtp/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/bt/host/bg_common/__null__ is not found, finding libbg_common.a in D:/fbb_ws63-master/src/protocol/bt/host/bg_common/ws63-liteos-app BG COMMON BTH_ROM_LIST:__null__ BTH_ROM_LIST:__null__ -- D:/fbb_ws63-master/src/protocol/bt/host/bt/__null__ is not found, finding libbt_app.a in D:/fbb_ws63-master/src/protocol/bt/host/bt/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/bt/host/bt/sdk/__null__ is not found, finding libbth_sdk.a in D:/fbb_ws63-master/src/protocol/bt/host/bt/sdk/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/bt/host/bt/__null__ is not found, finding libbt_host.a in D:/fbb_ws63-master/src/protocol/bt/host/bt/ws63-liteos-app BTH_ROM_LIST:__null__ BTH_PUBLIC_HEADER_LIST= -- D:/fbb_ws63-master/src/protocol/bt/host/gle/__null__ is not found, finding libbth_gle.a in D:/fbb_ws63-master/src/protocol/bt/host/gle/ws63-liteos-app -- D:/fbb_ws63-master/src/protocol/radar/alg_ai/radar_ai_attention_layer.c is not found, finding libradar_ai.a in D:/fbb_ws63-master/src/protocol/radar/alg_ai/ws63-liteos-app -- project_name: -- D:/fbb_ws63-master/src/protocol/radar/plat/radar_service.c is not found, finding libradar_sensing.a in D:/fbb_ws63-master/src/protocol/radar/plat/ws63-liteos-app -- Configuring done -- Generating done -- Build files have been written to: D:/fbb_ws63-master/src/output/ws63/acore/ws63-liteos-app [0/1] Re-running CMake... ninja: error: rebuilding 'build.ninja': subcommand failed FAILED: build.ninja C:\Users\���ļ�\AppData\Local\Programs\Python\Python311\Lib\site-packages\cmake\data\bin\cmake.exe --regenerate-during-build -SD:\fbb_ws63-master\src -BD:\fbb_ws63-master\src\output\ws63\acore\ws63-liteos-app CreateProcess failed: The system cannot find the file specified. python path: C:\Users\���ļ�\AppData\Local\Programs\Python\Python311\python.exe flashboot start build ..... ['C:\\Users\\���ļ�\\AppData\\Local\\Programs\\Python\\Python311\\python.exe', 'build.py', 'ws63-flashboot'] [ws63][acore] run custom cmd success! D:\fbb_ws63-master\src\build\script\.\..\..\config.in d:\fbb_ws63-master\src Kconfig header saved to 'D:\fbb_ws63-master\src\output\ws63\acore\ws63-liteos-app\mconfig.h' ######### Build target:ws63_liteos_app failed ================================ [FAILED] Took 14.97 seconds ================================ * 终端进程已终止,退出代码: -1。 * 终端将被任务重用,按任意键关闭。
06-07
基于可靠性评估序贯蒙特卡洛模拟法的配电网可靠性评估研究(Matlab代码实现)内容概要:本文围绕“基于可靠性评估序贯蒙特卡洛模拟法的配电网可靠性评估研究”,介绍了利用Matlab代码实现配电网可靠性的仿真分析方法。重点采用序贯蒙特卡洛模拟法对配电网进行长时间段的状态抽样与统计,通过模拟系统元件的故障与修复过程,评估配电网的关键可靠性指标,如系统停电频率、停电持续时间、负荷点可靠性等。该方法能够有效处理复杂网络结构与设备时序特性,提升评估精度,适用于含分布式电源、电动汽车等新型负荷接入的现代配电网。文中提供了完整的Matlab实现代码与案例分析,便于复现和扩展应用。; 适合人群:具备电力系统基础知识和Matlab编程能力的高校研究生、科研人员及电力行业技术人员,尤其适合从事配电网规划、运行与可靠性分析相关工作的人员; 使用场景及目标:①掌握序贯蒙特卡洛模拟法在电力系统可靠性评估中的基本原理与实现流程;②学习如何通过Matlab构建配电网仿真模型并进行状态转移模拟;③应用于含新能源接入的复杂配电网可靠性定量评估与优化设计; 阅读建议:建议结合文中提供的Matlab代码逐段调试运行,理解状态抽样、故障判断、修复逻辑及指标统计的具体实现方式,同时可扩展至不同网络结构或加入更多不确定性因素进行深化研究。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值