<div class="iteye-blog-content-contain" style="font-size: 14px"></div>
前段时间由于项目需要,做了一下统一异常和日志管理,由spring AOP来完成,统一业务处理放在service层处理,非成功状态统一抛异常。废话不多说,上代码:
用于日志打印的注解类
/** * 自定义注解 拦截service 方法名称描述 * @author lyl * @date 2015年12月14日 */ @Target({ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface SystemServiceLog { String description() default ""; }
AOP切面类
package com.yzkjchip.aop; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Method; import java.net.ConnectException; import java.sql.SQLException; import java.util.concurrent.CancellationException; import java.text.ParseException; import org.apache.log4j.Logger; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.hibernate.exception.ConstraintViolationException; import org.springframework.dao.DataAccessException; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Component; import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException; import com.taobao.api.ApiException; import com.yzkjchip.aop.annotation.SystemControllerLog; import com.yzkjchip.aop.annotation.SystemServiceLog; import com.yzkjchip.constants.ErrorCode; import com.yzkjchip.util.ConstantUtil; /** * 异常和日志统一处理 * @author lyl * @date 2015年12月14日 */ @Aspect @Component public class AspceJAdvice { /** * Pointcut 定义Pointcut,Pointcut的名称为aspectjMethod(),此方法没有返回值和参数 * 该方法就是一个标识,不进行调用 * @author lyl */ @Pointcut("execution (* com.yzkjchip.service.*.*(..))") private void aspectjMethod() { }; /** * Before 在核心业务执行前执行,不能阻止核心业务的调用。 * @author lyl * @param joinPoint * @throws ClassNotFoundException */ @Before("aspectjMethod()") public void before(JoinPoint joinPoint) throws ClassNotFoundException { String des = getServiceMthodDescription(joinPoint); Logger log = Logger.getLogger(joinPoint.getTarget().getClass()); if(!des.equals("")){ log.info("方法描述:" + des + " 开始"); } log.info(getMethodNameAndArgs(joinPoint)); // HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); // if(null != request){ // HttpSession session = request.getSession(); // //TODO token获取 request.getAttribute("token"); // Logger logger = Logger.getLogger(joinPoint.getTarget().getClass()); // logger.info(request.getLocalAddr()); // } } /** * After 核心业务逻辑退出后(包括正常执行结束和异常退出),执行此Advice * @author lyl * @param joinPoint * @throws ClassNotFoundException */ @After(value = "aspectjMethod()") public void after(JoinPoint joinPoint) throws ClassNotFoundException { String des = getServiceMthodDescription(joinPoint); if(!des.equals("")){ Logger log = Logger.getLogger(joinPoint.getTarget().getClass()); log.info("方法描述:" + des + " 结束"); } } /** * Around 手动控制调用核心业务逻辑,以及调用前和调用后的处理, * * 注意:当核心业务抛异常后,立即退出,转向AfterAdvice 执行完AfterAdvice,再转到ThrowingAdvice * @author lyl * @param pjp * @return * @throws Throwable */ @Around(value = "aspectjMethod()") public Object around(ProceedingJoinPoint pjp) throws Throwable { // 调用核心逻辑 Object retVal = pjp.proceed(); return retVal; } /** * AfterReturning 核心业务逻辑调用正常退出后,不管是否有返回值,正常退出后,均执行此Advice * @author lyl * @param joinPoint */ @AfterReturning(value = "aspectjMethod()", returning = "retVal") public void afterReturning(JoinPoint joinPoint, String retVal) { // todo something } /** * 核心业务逻辑调用异常退出后,执行此Advice,处理错误信息 * * 注意:执行顺序在Around Advice之后 * @author lyl * @param joinPoint * @param e * @throws ClassNotFoundException */ @AfterThrowing(value = "aspectjMethod()", throwing = "e") public void afterThrowing(JoinPoint joinPoint, Throwable e) throws ClassNotFoundException { String des = getServiceMthodDescription(joinPoint); Logger log = Logger.getLogger(joinPoint.getTarget().getClass()); log.error("-------------------afterThrowing.handler.start-------------------"); if(!des.equals("")){ log.error("方法描述:" + des); } log.error(getMethodNameAndArgs(joinPoint)); log.error("ConstantUtil.getTrace(e): " + getTrace(e)); log.error("异常名称:" + e.getClass().toString()); log.error("e.getMessage():" + e.getMessage()); log.error("-------------------afterThrowing.handler.end-------------------"); // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // 在这里判断异常,根据不同的异常返回错误。 if (e.getClass().equals(DataAccessException.class)) { throw new BusinessException(ErrorCode.DataAccessException.des, ErrorCode.DataAccessException.code); } else if (e.getClass().toString().equals(ConstraintViolationException.class.toString())) { throw new BusinessException(ErrorCode.ConstraintViolationException.des, ErrorCode.ConstraintViolationException.code); } else if (e.getClass().toString().equals(DataIntegrityViolationException.class.toString())) { throw new BusinessException(ErrorCode.DataIntegrityViolationException.des, ErrorCode.DataIntegrityViolationException.code); } else if (e.getClass().toString().equals(MySQLIntegrityConstraintViolationException.class.toString())) { throw new BusinessException(ErrorCode.MySQLIntegrityConstraintViolationException.des, ErrorCode.MySQLIntegrityConstraintViolationException.code); } else if (e.getClass().toString().equals(NullPointerException.class.toString())) { throw new BusinessException(ErrorCode.NullPointerException.des, ErrorCode.NullPointerException.code); } else if (e.getClass().equals(IOException.class)) { throw new BusinessException(ErrorCode.IOException.des, ErrorCode.IOException.code); } else if (e.getClass().equals(ClassNotFoundException.class)) { throw new BusinessException(ErrorCode.ClassNotFoundException.des, ErrorCode.ClassNotFoundException.code); } else if (e.getClass().equals(ArithmeticException.class)) { throw new BusinessException(ErrorCode.ArithmeticException.des, ErrorCode.ArithmeticException.code); } else if (e.getClass().equals(ArrayIndexOutOfBoundsException.class)) { throw new BusinessException(ErrorCode.ArrayIndexOutOfBoundsException.des, ErrorCode.ArrayIndexOutOfBoundsException.code); } else if (e.getClass().equals(IllegalArgumentException.class)) { throw new BusinessException(ErrorCode.IllegalArgumentException.des, ErrorCode.IllegalArgumentException.code); } else if (e.getClass().equals(ClassCastException.class)) { throw new BusinessException( ErrorCode.ClassCastException.des, ErrorCode.ClassCastException.code); } else if (e.getClass().equals(SecurityException.class)) { throw new BusinessException(ErrorCode.SecurityException.des, ErrorCode.SecurityException.code); } else if (e.getClass().equals(SQLException.class)) { throw new BusinessException(ErrorCode.SQLException.des, ErrorCode.SQLException.code); } else if (e.getClass().equals(NoSuchMethodError.class)) { throw new BusinessException(ErrorCode.NoSuchMethodError.des, ErrorCode.NoSuchMethodError.code); } else if (e.getClass().equals(InternalError.class)) { throw new BusinessException( ErrorCode.InternalError.des, ErrorCode.InternalError.code); } else if(e.getClass().equals(ConnectException.class)){ throw new BusinessException( ErrorCode.ConnectException.des, ErrorCode.ConnectException.code); } else if(e.getClass().equals(CancellationException.class)){ throw new BusinessException( ErrorCode.CancellationException.des, ErrorCode.CancellationException.code); } else if (e.getClass().equals(ApiException.class)) { throw new BusinessException( ErrorCode.ApiException.des, ErrorCode.ApiException.code); } else if (e.getClass().equals(ParseException.class)) { throw new BusinessException( ErrorCode.ParseException.des, ErrorCode.ParseException.code); } else { throw new BusinessException(ErrorCode.INTERNAL_PROGRAM_ERROR.des + e.getMessage(), ErrorCode.INTERNAL_PROGRAM_ERROR.code); } } /** * 获取方法名和参数 * @author lyl * @param joinPoint * @return */ private String getMethodNameAndArgs(JoinPoint joinPoint){ Object[] args = joinPoint.getArgs(); StringBuffer sb = new StringBuffer("请求方法:"); sb.append(joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "("); for (int i = 0; i < args.length; i++) { sb.append("arg[" + i + "]: " + args[i] + ","); } if (args.length > 0) { sb.deleteCharAt(sb.length() - 1); } sb.append(")"); return sb.toString(); } /** * 获取注解中对方法的描述信息 用于service层注解 * @author lyl * @param joinPoint * @return * @throws ClassNotFoundException */ public static String getServiceMthodDescription(JoinPoint joinPoint) throws ClassNotFoundException { String targetName = joinPoint.getTarget().getClass().getName(); String methodName = joinPoint.getSignature().getName(); Object[] arguments = joinPoint.getArgs(); Class targetClass = Class.forName(targetName); Method[] methods = targetClass.getMethods(); String description = ""; for (Method method : methods) { if (method.getName().equals(methodName) && method.isAnnotationPresent(SystemServiceLog.class)) { SystemServiceLog serviceLog = method.getAnnotation(SystemServiceLog.class); description =serviceLog.description(); break; } } return description; } /** * 获取注解中对方法的描述信息 用于Controller层注解 * @author lyl * @param joinPoint * @return * @throws ClassNotFoundException */ public static String getControllerMethodDescription(JoinPoint joinPoint) throws ClassNotFoundException { String targetName = joinPoint.getTarget().getClass().getName(); String methodName = joinPoint.getSignature().getName(); Object[] arguments = joinPoint.getArgs(); Class targetClass = Class.forName(targetName); Method[] methods = targetClass.getMethods(); String description = ""; for (Method method : methods) { if (method.getName().equals(methodName) && method.isAnnotationPresent(SystemControllerLog.class)) { SystemControllerLog controllerLog = method.getAnnotation(SystemControllerLog.class); description =controllerLog.description(); break; } } return description; } /** * 将异常信息输出到log文件 * @param t * @return */ public static String getTrace(Throwable t) { StringWriter stringWriter= new StringWriter(); PrintWriter writer= new PrintWriter(stringWriter); t.printStackTrace(writer); StringBuffer buffer= stringWriter.getBuffer(); return buffer.toString(); } }
自定义异常类:
package com.yzkjchip.aop; import org.apache.log4j.Logger; import com.google.gson.Gson; import com.yzkjchip.constants.SystemConstants; import com.yzkjchip.vo.JsonTypeCommonVO; /** * 自定义业务异常处理类 友好提示 * * @author lyl * @date 2015年12月14日 */ public class BusinessException extends RuntimeException { private static final long serialVersionUID = 3152616724785436891L; private static final Logger log = Logger.getLogger(BusinessException.class); public static JsonTypeCommonVO<String> jsonTypeCommonVO; private static Gson gson = new Gson(); public static String json; public BusinessException(String errorMsg, Number errorCode) { super(createFriendlyErrMsg(errorMsg, errorCode)); } public BusinessException(Throwable throwable) { super(throwable); } public BusinessException(Throwable throwable, String errorMsg, Number errorCode) { super(throwable); } private static String createFriendlyErrMsg(String msgBody, Number errorCode) { // log.info("msgBody" + msgBody); if (msgBody.contains("success") && msgBody.contains("errorCode") && msgBody.contains("msg")) { json = msgBody.substring(msgBody.indexOf("{"), msgBody.indexOf("}") + 1); log.info(json); return json; } StringBuffer friendlyErrMsg = new StringBuffer(); // friendlyErrMsg.append("抱歉,"); friendlyErrMsg.append(msgBody); // friendlyErrMsg.append(",请稍后再试或与管理员联系。"); jsonTypeCommonVO = new JsonTypeCommonVO<String>(SystemConstants.SUCCESS_FALSE_FLAG, errorCode, friendlyErrMsg.toString(), null, null); json = gson.toJson(jsonTypeCommonVO); log.info(json); return json; } }
错误码(异常码):
package com.thread.daemon.test; /** * 李云龙 * 错误码 码表 * @author lyl * @date 2015年11月6日 */ public enum ErrorCode { //-----------------------------统一异常捕获(50***)错误码开始------------------------------------- /**程序内部错误,操作失败*/ INTERNAL_PROGRAM_ERROR(50000,"程序内部错误,操作失败"), //说明:以下的异常名称定义,为了可读性均是异常原名,不建议作全部大写‘_’分隔 样式 lyl /**数据库操作失败*/ DataAccessException(50001,"数据库操作失败"), /**违反数据库约(唯一)束异常*/ ConstraintViolationException(50002,"对象已经存在,请勿重复操作"), /**hibernate 违反数据库约(唯一)束异常*/ DataIntegrityViolationException(50003,"对象已经存在,请勿重复操作"), /**mysql 违反数据库约(唯一)束异常*/ MySQLIntegrityConstraintViolationException(50004,"对象已经存在,请勿重复操作"), /**空指针异常*/ NullPointerException(50005,"调用了未经初始化的对象或者是不存在的对象"), /**IO异常*/ IOException(50006,"IO异常"), /**指定的类不存在*/ ClassNotFoundException(50007,"指定的类不存在"), /**数学运算异常*/ ArithmeticException(50008,"数学运算异常"), /**数组下标越界*/ ArrayIndexOutOfBoundsException(50009,"数组下标越界"), /**方法的参数错误或非法*/ IllegalArgumentException(50010,"参数错误或非法"), /**类型强制转换错误*/ ClassCastException(50011,"类型强制转换错误"), /**操作数据库异常*/ SQLException(50013,"操作数据库异常"), /**违背安全原则异常*/ SecurityException(50012,"违背安全原则异常"), /**方法末找到异常*/ NoSuchMethodError(50014,"方法末找到异常"), /**Java虚拟机发生了内部错误*/ InternalError(50015,"内部错误"), ConnectException(50016,"服务器连接异常"), CancellationException(50017,"任务已被取消的异常"), /**Java阿里服务器错误*/ ApiException(50018,"阿里服务器错误"), /**[日期]或[数值]等转换错误*/ ParseException(50019,"日期格式错误"), //-----------------------------统一异常捕获(50***)错误码结束------------------------------------- //-----------------------------参数异常(51***)错误码开始------------------------------------- ParaIsNull(51002,"参数为空"), paraNotRight(51003,"参数非法"), //-----------------------------参数异常(51***)错误码结束------------------------------------- //-----------------------------公共操作成功、失败(60***)错误码开始------------------------------------- HANDLER_SUCCESS(60000,"操作成功"), HANDLER_FAILED(60001,"操作失败"), SAVE_SUCCESS(60002,"新增成功"), SAVE_FAILED(60003,"新增失败"), DELETE_SUCCESS(60004,"删除成功"), DELETE_FAILED(60005,"删除失败"), UPDATE_SUCCESS(60006,"修改成功"), UPDATE_FAILED(60007,"修改失败"), SET_SUCCESS(60008,"设置成功"), SET_FAILED(60009,"设置失败"), /**无对应数据*/ NO_DATA(60010,"无对应数据"), /**同步成功*/ SYNC_SUCCESS(60011,"同步成功"), /**同步失败*/ SYNC_FAILED(60012,"同步失败"), /**同步数据为空*/ SYNC_DATA_IS_NULL(60013,"同步数据为空"), /**同步数据部分成功*/ SYNC_DATA_NOT_ALL_SUCCESS(60014,"同步数据部分成功"), /** 查询成功 */ FIND_SUCCESS(60015,"查询成功"), /** 查询失败 */ FIND_FAILED(60016,"查询失败"), //-----------------------------公共操作成功、失败(60***)错误码结束------------------------------------- ; public Number code; public String des; private ErrorCode(Number code,String des){ this.code = code; this.des = des; } public static ErrorCode get(Number code){ for(ErrorCode errorCode:ErrorCode.values()){ if(errorCode.code.toString().equals(code.toString())){ return errorCode; } } return null; } @Override public String toString(){ return "code:"+code +", des:"+des; } public static void main(String[] args) { ErrorCode errorCode = get(12001); if(null != errorCode) System.out.println(errorCode); System.err.println(errorCode.code+"<==========>"+errorCode.des); } }
springMVC配置:核心
<!--通知spring使用cglib而不是jdk的来生成代理方法 AOP可以拦截到Controller-->
<aop:aspectj-autoproxy proxy-target-class="true"/>
<!-- 注解扫描包 --> <context:component-scan base-package="com" /> <!-- 开启注解 --> <mvc:annotation-driven > </mvc:annotation-driven>
以下是完整配置:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"> <!-- 注解扫描包 --> <context:component-scan base-package="com" /> <!-- 开启注解 --> <mvc:annotation-driven > </mvc:annotation-driven> <!-- 静态资源(js/image)的访问 --> <mvc:resources location="/res/" mapping="/res/**"/> <!-- 定义视图解析器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/"></property> <property name="suffix" value=".jsp"></property> </bean> <!-- 上传文件拦截,设置最大上传文件大小 10M=10*1024*1024(B)=10485760 bytes --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize"><value>10485760</value></property> <property name="defaultEncoding"><value>UTF-8</value></property> </bean> <!--通知spring使用cglib而不是jdk的来生成代理方法 AOP可以拦截到Controller--> <aop:aspectj-autoproxy proxy-target-class="true"/> </beans>
spring配置:
核心配置<!-- aop -->
<aop:aspectj-autoproxy/>
以下是完整配置:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" > <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <!-- 基本属性 url、user、password --> <property name="url" value="jdbc:mysql://localhost:3306/iamchip?useUnicode=true&characterEncoding=utf-8" /> <property name="username" value="root" /> <property name="password" value="123" /> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="1" /> <property name="minIdle" value="1" /> <property name="maxActive" value="20" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="60000" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="300000" /> <property name="validationQuery" value="SELECT 'x'" /> <property name="testWhileIdle" value="true" /> <property name="testOnBorrow" value="false" /> <property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 --> <property name="poolPreparedStatements" value="true" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <!-- 配置监控统计拦截的filters --> <property name="filters" value="stat" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="packagesToScan" > <list> <value>com.aspectj.entity</value> </list> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource" /> </bean> <!-- <bean id="MemcachedService" class="com.yzkjchip.service.MemcachedService" scope="singleton"> </bean> --> <!-- 定时任务 --> <task:annotation-driven scheduler="qbScheduler" mode="proxy"/> <task:scheduler id="qbScheduler" pool-size="10"/> <!-- aop --> <aop:aspectj-autoproxy/>
相关推荐
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
MMC整流器技术解析:基于Matlab的双闭环控制策略与环流抑制性能研究,Matlab下的MMC整流器技术文档:18个子模块,双闭环控制稳定直流电压,环流抑制与最近电平逼近调制,优化桥臂电流波形,高效并网运行。,MMC整流器(Matlab),技术文档 1.MMC工作在整流侧,子模块个数N=18,直流侧电压Udc=25.2kV,交流侧电压6.6kV 2.控制器采用双闭环控制,外环控制直流电压,采用PI调节器,电流内环采用PI+前馈解耦; 3.环流抑制采用PI控制,能够抑制环流二倍频分量; 4.采用最近电平逼近调制(NLM), 5.均压排序:电容电压排序采用冒泡排序,判断桥臂电流方向确定投入切除; 结果: 1.输出的直流电压能够稳定在25.2kV; 2.有功功率,无功功率稳态时波形稳定,有功功率为3.2MW,无功稳定在0Var; 3.网侧电压电流波形均为对称的三相电压和三相电流波形,网侧电流THD=1.47%<2%,符合并网要求; 4.环流抑制后桥臂电流的波形得到改善,桥臂电流THD由9.57%降至1.93%,环流波形也可以看到得到抑制; 5.电容电压能够稳定变化 ,工作点关键词:MMC
Boost二级升压光伏并网结构的Simulink建模与MPPT最大功率点追踪:基于功率反馈的扰动观察法调整电压方向研究,Boost二级升压光伏并网结构的Simulink建模与MPPT最大功率点追踪:基于功率反馈的扰动观察法调整电压方向研究,Boost二级升压光伏并网结构,Simulink建模,MPPT最大功率点追踪,扰动观察法采用功率反馈方式,若ΔP>0,说明电压调整的方向正确,可以继续按原方向进行“干扰”;若ΔP<0,说明电压调整的方向错误,需要对“干扰”的方向进行改变。 ,Boost升压;光伏并网结构;Simulink建模;MPPT最大功率点追踪;扰动观察法;功率反馈;电压调整方向。,光伏并网结构中Boost升压MPPT控制策略的Simulink建模与功率反馈扰动观察法
STM32F103C8T6 USB寄存器开发详解(12)-键盘设备
科技活动人员数专指直接从事科技活动以及专门从事科技活动管理和为科技活动提供直接服务的人员数量
Matlab Simulink仿真探究Flyback反激式开关电源性能表现与优化策略,Matlab Simulink仿真探究Flyback反激式开关电源的工作机制,Matlab Simulimk仿真,Flyback反激式开关电源仿真 ,Matlab; Simulink仿真; Flyback反激式; 开关电源仿真,Matlab Simulink在Flyback反激式开关电源仿真中的应用
基于Comsol的埋地电缆电磁加热计算模型:深度解析温度场与电磁场分布学习资料与服务,COMSOL埋地电缆电磁加热计算模型:温度场与电磁场分布的解析与学习资源,comsol 埋地电缆电磁加热计算模型,可以得到埋地电缆温度场及电磁场分布,提供学习资料和服务, ,comsol;埋地电缆电磁加热计算模型;温度场分布;电磁场分布;学习资料;服务,Comsol埋地电缆电磁加热模型:温度场与电磁场分布学习资料及服务
1、文件内容:ibus-table-chinese-yong-1.4.6-3.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/ibus-table-chinese-yong-1.4.6-3.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、更多资源/技术支持:公众号禅静编程坊
基于51单片机protues仿真的汽车智能灯光控制系统设计(仿真图、源代码) 一、设计项目 根据本次设计的要求,设计出一款基于51单片机的自动切换远近光灯的设计。 技术条件与说明: 1. 设计硬件部分,中央处理器采用了STC89C51RC单片机; 2. 使用两个灯珠代表远近光灯,感光部分采用了光敏电阻,因为光敏电阻输出的是电压模拟信号,单片机不能直接处理模拟信号,所以经过ADC0832进行转化成数字信号; 3. 显示部分采用了LCD1602液晶,还增加按键部分电路,可以选择手自动切换远近光灯; 4. 用超声模块进行检测距离;
altermanager的企业微信告警服务
MyAgent测试版本在线下载
Comsol技术:可调BIC应用的二氧化钒VO2材料探索,Comsol模拟二氧化钒VO2的可调BIC特性研究,Comsol二氧化钒VO2可调BIC。 ,Comsol; 二氧化钒VO2; 可调BIC,Comsol二氧化钒VO2材料:可调BIC技术的关键应用
C++学生成绩管理系统源码
基于Matlab与Cplex的激励型需求响应模式:负荷转移与电价响应的差异化目标函数解析,基于Matlab与CPLEX的激励型需求响应负荷转移策略探索,激励型需求响应 matlab +cplex 激励型需求响应采用激励型需求响应方式对负荷进行转移,和电价响应模式不同,具体的目标函数如下 ,激励型需求响应; matlab + cplex; 负荷转移; 目标函数。,Matlab与Cplex结合的激励型需求响应模型及其负荷转移策略
scratch介绍(scratch说明).zip
内容概要:本文全面介绍了深度学习模型的概念、工作机制和发展历程,详细探讨了神经网络的构建和训练过程,包括反向传播算法和梯度下降方法。文中还列举了深度学习在图像识别、自然语言处理、医疗和金融等多个领域的应用实例,并讨论了当前面临的挑战,如数据依赖、计算资源需求、可解释性和对抗攻击等问题。最后,文章展望了未来的发展趋势,如与量子计算和区块链的融合,以及在更多领域的应用前景。 适合人群:对该领域有兴趣的技术人员、研究人员和学者,尤其适合那些希望深入了解深度学习原理和技术细节的读者。 使用场景及目标:①理解深度学习模型的基本原理和结构;②了解深度学习模型的具体应用案例;③掌握应对当前技术挑战的方向。 阅读建议:文章内容详尽丰富,读者应在阅读过程中注意理解各个关键技术的概念和原理,尤其是神经网络的构成及训练过程。同时也建议对比不同模型的特点及其在具体应用中的表现。
该文档提供了一个关于供应链管理系统开发的详细指南,重点介绍了项目安排、技术实现和框架搭建的相关内容。 文档分为以下几个关键部分: 项目安排:主要步骤包括搭建框架(1天),基础数据模块和权限管理(4天),以及应收应付和销售管理(5天)。 供应链概念:供应链系统的核心流程是通过采购商品放入仓库,并在销售时从仓库提取商品,涉及三个主要订单:采购订单、销售订单和调拨订单。 大数据的应用:介绍了数据挖掘、ETL(数据抽取)和BI(商业智能)在供应链管理中的应用。 技术实现:讲述了DAO(数据访问对象)的重用、服务层的重用、以及前端JS的继承机制、jQuery插件开发等技术细节。 系统框架搭建:包括Maven环境的配置、Web工程的创建、持久化类和映射文件的编写,以及Spring配置文件的实现。 DAO的需求和功能:供应链管理系统的各个模块都涉及分页查询、条件查询、删除、增加、修改操作等需求。 泛型的应用:通过示例说明了在Java语言中如何使用泛型来实现模块化和可扩展性。 文档非常技术导向,适合开发人员参考,用于构建供应链管理系统的架构和功能模块。
这份长达104页的手册由清华大学新闻与传播学院新媒体研究中心元宇宙文化实验室的余梦珑博士后及其团队精心编撰,内容详尽,覆盖了从基础概念、技术原理到实战案例的全方位指导。它不仅适合初学者快速了解DeepSeek的基本操作,也为有经验的用户提供了高级技巧和优化策略。
主题说明: 1、将mxtheme目录放置根目录 | 将mxpro目录放置template文件夹中 2、苹果cms后台-系统-网站参数配置-网站模板-选择mxpro 模板目录填写html 3、网站模板选择好之后一定要先访问前台,然后再进入后台设置 4、主题后台地址: MXTU MAX图图主题,/admin.php/admin/mxpro/mxproset admin.php改成你登录后台的xxx.php 5、首页幻灯片设置视频推荐9,自行后台设置 6、追剧周表在视频数据中,节目周期添加周一至周日自行添加,格式:一,二,三,四,五,六,日
运行GUI版本,可二开