升到了cm-4.1.999

本文记录了作者刷入 CM-4.1.999 版本 ROM 的过程及遇到的问题,包括解决 io 占用高、蓝牙耳机控制键失灵、部分应用权限问题等,并分享了对新系统的初步感受。
经过几次思想上的天人交战,终于还是对新事物的冲动盖过了对改变的恐惧,刷了cm-4.1.999,打上了联系人排序补丁。为了规避Google的法律条文,cm的rom里面并不再包含那些闭源应用,而是采取了先刷官方adp版本的rom,然后从中备份出闭源应用,在刷了cm版本rom后,进行恢复。由此,前一段时间闹的轰轰烈烈的自制rom的合法性问题得到了暂时的解决。 其间遇到了一点挫折: 在第一次刷完boot之后,发现应用程序相当缓慢,70%以上的CPU都被io占用。而且每次开机都会不停地报magic number错误,然后把所有dalvik-cache里面的内容重写一遍,经过深入挖掘,发现这是一个已知的bug:当TF卡的第二分区是ext2的时候,在新rom里面会被误认为是ext4分区进行mount。解决方案是把第二分区改为 ext3。解决了这个问题之后,就没再有速度慢的情况出现了。由于目前为止这个bug的重要程度还是很低,所以不知道过多久才会进行修复,坚守ext2的同学们还是凑合着升到ext3吧,不过多占用了一点tf空间而已,算下来不到几块钱的事情。 然后就是很多应用程序因为新加入的对tf卡的读写权限控制水土不服,需要重新安装,否则会报出一个没有权限的异常。 然后就是蓝牙耳机的控制键全部失效,听歌的时候没法顺利的进行上一曲、下一曲的切换了,估计这个不久会修正的。 然后就是目前google map不知道为什么要去访问 mobilemap.android.google.com,否则无法正常显示。这个问题直接导致cmwrap下无法使用Gmap,这个问题已经在新版本中进行了修正,并将更新放到了项目主页,有兴趣的同学可以试试,Market发布可能要再等一段时间看看是否稳定。 相对于 4.0.4 ,没感觉到采用了BFS的系统快了多少。新的Market对于看惯了黑色背景的我来说,也有点不习惯:就像lianyun的图标,现在整个就跟消失了一样。 对于最终用户来说,新的更新并没有带来太多惊喜。但对于开发者来说,早一点适应一下新的版本还是有好处的。
# 1 化合物基本性质 # 化合物物理化学性质 compound_params <- list( MW = 581.29, # 分子量 (g/mol) logP = 1.59, # 油水分配系数 pKa_base = 8.8, # 碱基pKa Permeability = c(A2B = 0.45e-6, B2A = 14.0e-6, ER = 31.2) # 渗透性 (cm/s) ) # 生理介质溶解度 (mg/mL) solubility <- data.frame( pH = c(1.4, 2.5, 4.0, 5.0, 6.5, 7.4, 6.5, 5.0, 1.4), medium = c(rep("Buffer", 6), rep("FaSSIF", 1), rep("FeSSIF", 1), rep("FaSSGF", 1)), value = c(0.08557, 0.06794, 0.07188, 0.07629, 0.08165, 0.07515, 0.06638, 0.06084, 0.07234) ) # 2 物种特异性参数 # 固有清除率(μL/min/mg protein) clint_data <- data.frame( Species = c("Human", "Monkey", "Dog", "Rat", "Mouse"), Clint_MMS = c(45.55, 168.92, 15.85, 13.34, 27.98) ) # 血浆蛋白结合参数 protein_binding <- data.frame( Species = c("Human", "Dog", "Rat", "Mouse"), Rbp = c(0.954, 1.034, 1.576, 0.975), fup = c(0.0818, 0.0981, 0.1560, 0.0873) # 游离药物分数 ) # 动物PK参数 pk_params <- data.frame( Species = rep(c("Mouse", "Rat", "Dog"), each = 4), Parameter = rep(c("Vd", "Cl", "T1/2", "F"), 3), Value = c(0.213, 0.116, 2.08, 15.94, 5.01, 1.67, 2.82, 3.24, 51.4, 19.4, 1.99, 29.48), Unit = rep(c("L", "L/h", "h", "%"), 3), BW = rep(c(0.025, 0.22, 11), each = 4) # 体重(kg) ) # 3.1 组织体积与血流速 # 基于[[180]]获取标准生理参数 physio_params_human <- data.frame( Tissue = c("Liver", "Muscle", "Adipose", "Brain", "Kidney", "Heart", "Lung", "Spleen", "Intestine"), Volume_fraction = c(0.026, 0.40, 0.19, 0.02, 0.004, 0.004, 0.01, 0.002, 0.03), Blood_flow_fraction = c(0.25, 0.17, 0.05, 0.15, 0.19, 0.04, 1.00, 0.02, 0.15) ) # 按体重缩放其他物种参数 species_weights <- c(Monkey = 5, Dog = 11, Rat = 0.22, Mouse = 0.025) # kg # 3.2 组织脂质组成 # Rodgers-Rowland方法组织组成数据(基于[[207]][[252]][[258]] tissue_composition <- list( Liver = list(phospholipid = 0.569, neutral_lipid = 0.042, water = 0.71, protein = 0.24), Muscle = list(phospholipid = 0.023, neutral_lipid = 0.012, water = 0.76, protein = 0.20), Adipose = list(phospholipid = 0.002, neutral_lipid = 0.85, water = 0.15, protein = 0.02), Brain = list(phospholipid = 0.55, neutral_lipid = 0.30, water = 0.15, protein = 0.0) ) # 3.3 MPPGL值(微粒体蛋白/克肝脏) # 基于[[226]]和[[347]] mppgl_values <- c( Human = 40.0, # Barter et al. 2007推荐的标准化值 Monkey = 40.0, # 使用人类值替代 Dog = 45.0, # 文献报告范围[[226]] Rat = 40.0, # Barter et al. 2007 Mouse = 35.0 # [[226]] ) # 4. 核心模型构建 # 4.1 Kp值计算(Rodgers-Rowland方法) calculate_Kp <- function(logP, pKa, fup, tissue_comp, is.base = TRUE) { # 电离状态计算 ion_factor <- ifelse(is.base, 10^(pKa - 7.4)/(1 + 10^(pKa - 7.4)), 1) # Rodgers-Rowland方程 Kp <- (fup * tissue_comp$water + ion_factor * (0.3 * tissue_comp$phospholipid * 10^logP) + (1 - fup) * (0.5 * tissue_comp$neutral_lipid * 10^logP)) / (fup + (1 - fup) * 0.5) return(Kp) } # 计算人体主要组织Kp值 Kp_human <- sapply(names(tissue_composition), function(tissue) { calculate_Kp( logP = compound_params$logP, pKa = compound_params$pKa_base, fup = protein_binding$fup[protein_binding$Species == "Human"], tissue_comp = tissue_composition[[tissue]], is.base = TRUE ) }) # 4.2 清除率外推(IVIVE) # 固有清除率标化 calculate_hepatic_clearance <- function(species) { # 获取生理参数 bw <- ifelse(species == "Human", 70, species_weights[species]) liver_fraction <- physio_params_human$Volume_fraction[physio_params_human$Tissue == "Liver"] liver_mass <- bw * liver_fraction * 1000 # 克 # 肝血流速(Qh) - 基于[[240]] Qh <- switch(species, Human = 1.24 * bw, Monkey = 2.7 * bw, Dog = 4.2 * bw, Rat = 4.2 * bw, Mouse = 5.4 * bw) # 微粒体蛋白总量 microsomal_protein_total <- liver_mass * mppgl_values[species] # 固有清除率 Clint <- clint_data$Clint_MMS[clint_data$Species == species] # μL/min/mg Clint_mL_min <- Clint / 1000 # mL/min/mg # 体外→体内转换 fup_val <- protein_binding$fup[protein_binding$Species == species] # 肝清除率Well-stirred模型 CLint <- Clint_mL_min * microsomal_protein_total * 60 / 1000 # L/h CLh <- (Qh * fup_val * CLint) / (Qh + fup_val * CLint) return(list(CLint = CLint, CLh = CLh)) } # 4.3 吸收模型(Ka估算) calculate_Ka <- function() { # 肠腔溶解度取FaSSIF和FeSSIF平均值 sol_intestine <- mean(c( solubility$value[solubility$medium == "FaSSIF"], solubility$value[solubility$medium == "FeSSIF"] )) # Caco-2渗透性→人空肠Peff转换(基于Web Page 提供的经验关系) Peff_human <- 10^(-4) * (0.3 * compound_params$Permeability["A2B"] + 0.05) # cm/s # 扩散限制吸收 D <- 1e-5 # 扩散系数(cm²/s) h <- 30e-4 # 未搅拌水层厚度(cm) # 吸收速率常数Ka(1/h) Ka <- (2 * Peff_human * 3600) / (h + (D / Peff_human)) # 转换为h⁻&sup1; return(Ka) } # 5. 完整PBPK模型实现 # 加载必要库 library(deSolve) # PBPK模型方程 pbpk_model <- function(time, state, parameters) { with(as.list(c(state, parameters)), { # 中心室浓度(血浆) C_plasma <- A_central / V_central # 组织室浓度计算(血流限制) dA_liver <- Q_liver * (C_plasma - C_liver/Kp_liver) dA_muscle <- Q_muscle * (C_plasma - C_muscle/Kp_muscle) dA_adipose <- Q_adipose * (C_plasma - C_adipose/Kp_adipose) dA_brain <- Q_brain * (C_plasma - C_brain/Kp_brain) dA_other <- sum(Q_other) * (C_plasma - C_other/Kp_other) # 中央室(血浆+瞬时平衡组织) dA_central <- - (Q_total * C_plasma) + Ka * A_GI + # 吸收项 (dA_liver + dA_muscle + dA_adipose + dA_brain + dA_other) - CL_total * C_plasma # 清除项 # 肠道吸收 dA_GI <- -Ka * A_GI # 返回微分值 return(list(c(dA_GI, dA_central, dA_liver, dA_muscle, dA_adipose, dA_brain, dA_other))) }) } # 参数初始化与模拟 run_pbpk_simulation <- function(species = "Human", dose = 10, route = "oral") { # 生理参数 bw <- ifelse(species == "Human", 70, species_weights[species]) tissue_fractions <- physio_params_human$Volume_fraction names(tissue_fractions) <- physio_params_human$Tissue # 血流比例 flow_fractions <- physio_params_human$Blood_flow_fraction names(flow_fractions) <- physio_params_human$Tissue # 心输出量(CO, L/h) - 基于[[240]] CO <- switch(species, Human = 70 * 60 * 1.24, # L/h Monkey = 5 * 60 * 1.5, # 估算值 Dog = 11 * 60 * 1.2, Rat = 0.22 * 60 * 1.5, Mouse = 0.025 * 60 * 1.6) # 计算组织体积(L) V_tissues <- sapply(names(tissue_fractions), function(t) bw * tissue_fractions[t]) # 计算组织血流(L/h) Q_tissues <- sapply(names(flow_fractions), function(t) CO * flow_fractions[t]) # Kp值 if(species == "Human") { Kp_values <- Kp_human } else { # 使用与人类相同的组织组成 Kp_values <- sapply(names(tissue_composition), function(t) { calculate_Kp( compound_params$logP, compound_params$pKa_base, protein_binding$fup[protein_binding$Species == species], tissue_composition[[t]], TRUE ) }) } # 清除率 clearance <- calculate_hepatic_clearance(species) # 吸收参数 Ka_val <- if(route == "oral") calculate_Ka() else 0 # 初始状态 state <- c( A_GI = if(route == "oral") dose * 1e6 else 0, # μg A_central = 0, A_liver = 0, A_muscle = 0, A_adipose = 0, A_brain = 0, A_other = 0 ) # 参数列表 parameters <- list( Ka = Ka_val, V_central = tissue_fractions["Plasma"] * bw, # 血浆体积 Kp_liver = Kp_values["Liver"], Kp_muscle = Kp_values["Muscle"], Kp_adipose = Kp_values["Adipose"], Kp_brain = Kp_values["Brain"], Kp_other = mean(Kp_values), # 其他组织平均Kp Q_total = CO, Q_liver = Q_tissues["Liver"], Q_muscle = Q_tissues["Muscle"], Q_adipose = Q_tissues["Adipose"], Q_brain = Q_tissues["Brain"], Q_other = CO - sum(Q_tissues[c("Liver","Muscle","Adipose","Brain")]), CL_total = clearance$CLh, V_liver = V_tissues["Liver"], V_muscle = V_tissues["Muscle"], V_adipose = V_tissues["Adipose"], V_brain = V_tissues["Brain"], V_other = sum(V_tissues) - sum(V_tissues[c("Plasma","Liver","Muscle","Adipose","Brain")]) ) # 时间点 times <- seq(0, 24, by = 0.1) # ODE求解 out <- ode(y = state, times = times, func = pbpk_model, parms = parameters) # 结果处理 results <- data.frame(out) results$C_plasma <- results$A_central / parameters$V_central # μg/mL return(list( results = results, parameters = parameters, AUC = trapz(results$time, results$C_plasma), Cmax = max(results$C_plasma), Tmax = results$time[which.max(results$C_plasma)] )) } # 6. 模型验证与结果外推 # 6.1 动物模型验证 # 大鼠验证示例 rat_iv <- run_pbpk_simulation(species = "Rat", dose = 10, route = "iv") rat_oral <- run_pbpk_simulation(species = "Rat", dose = 10, route = "oral") # 计算预测PK参数 predicted_CL_rat <- rat_iv$parameters$CL_total predicted_Vd_rat <- sum(rat_iv$parameters$V_central, rat_iv$parameters$V_liver * rat_iv$parameters$Kp_liver, rat_iv$parameters$V_muscle * rat_iv$parameters$Kp_muscle, rat_iv$parameters$V_adipose * rat_iv$parameters$Kp_adipose, rat_iv$parameters$V_brain * rat_iv$parameters$Kp_brain, rat_iv$parameters$V_other * rat_iv$parameters$Kp_other) predicted_F_rat <- (rat_oral$AUC / rat_iv$AUC) * (dose_iv/dose_oral) # 与实际PK参数比较 comparison_rat <- data.frame( Parameter = c("CL", "Vd", "F"), Actual = c(1.67, 5.01, 3.24/100), Predicted = c(predicted_CL_rat, predicted_Vd_rat, predicted_F_rat) ) # 狗和小鼠采用相同验证流程... # 6.2 人体PK参数外推 # 人体IV和PO模拟 human_iv <- run_pbpk_simulation(species = "Human", dose = 100, route = "iv") human_oral <- run_pbpk_simulation(species = "Human", dose = 100, route = "oral") # 外推的人体PK参数 human_pk <- list( Ka = human_oral$parameters$Ka, Kp = Kp_human, Vss = sum(human_iv$parameters$V_central, human_iv$parameters$V_liver * human_iv$parameters$Kp_liver, human_iv$parameters$V_muscle * human_iv$parameters$Kp_muscle, human_iv$parameters$V_adipose * human_iv$parameters$Kp_adipose, human_iv$parameters$V_brain * human_iv$parameters$Kp_brain, human_iv$parameters$V_other * human_iv$parameters$Kp_other), CL = human_iv$parameters$CL_total, t1_2 = log(2) * human_iv$parameters$V_central / human_iv$parameters$CL_total, F = (human_oral$AUC / human_iv$AUC) * (100/100) # 剂量相同 ) # 7. 结果分析与讨论 # 7.1 关键外推参数 # 输出人体外推参数 cat("人体外推PK参数:\n") cat(sprintf("Ka = %.2f h⁻&sup1;\n", human_pk$Ka)) cat("组织分配系数(Kp):\n") print(human_pk$Kp) cat(sprintf("\n分布容积(Vss) = %.1f L\n", human_pk$Vss)) cat(sprintf("清除率(CL) = %.2f L/h\n", human_pk$CL)) cat(sprintf("半衰期(t₁/₂) = %.1f h\n", human_pk$t1_2)) cat(sprintf("口服生物利用度(F) = %.1f%%\n", human_pk$F * 100)) #7.3 敏感性分析建议 # 示例:Ka的敏感性分析 ka_values <- seq(0.5, 5, by = 0.5) * human_pk$Ka sensitivity_auc <- sapply(ka_values, function(ka) { params <- human_oral$parameters params$Ka <- ka out <- ode(y = state, times = times, func = pbpk_model, parms = params) trapz(out[,1], out[,2]/params$V_central) }) plot(ka_values, sensitivity_auc, type = "b", xlab = "Ka (h⁻&sup1;)", ylab = "AUC") > rat_iv <- run_pbpk_simulation(species = "Rat", dose = 10, route = "iv") 错误于eval(substitute(expr), data, enclos = parent.frame()): 找不到对象'C_liver' Called from: eval(substitute(expr), data, enclos = parent.frame()) Browse[1]> rat_oral <- run_pbpk_simulation(species = "Rat", dose = 10, route = "oral") 收捲时出错: 找不到对象'C_liver' Error: no more error handlers available (recursive errors?); invoking 'abort' restart
08-15
基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究(Matlab代码实现)内容概要:本文围绕“基于数据驱动的Koopman算子的递归神经网络模型线性化”展开,旨在研究纳米定位系统的预测控制方法。通过结合数据驱动技术与Koopman算子理论,将非线性系统动态近似为高维线性系统,进而利用递归神经网络(RNN)建模并实现系统行为的精确预测。文中详细阐述了模型构建流程、线性化策略及在预测控制中的集成应用,并提供了完整的Matlab代码实现,便于科研人员复现实验、优化算法并拓展至其他精密控制系统。该方法有效提升了纳米级定位系统的控制精度与动态响应性能。; 适合人群:具备自动控制、机器学习或信号处理背景,熟悉Matlab编程,从事精密仪器控制、智能制造或先进控制算法研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①实现非线性动态系统的数据驱动线性化建模;②提升纳米定位平台的轨迹跟踪与预测控制性能;③为高精度控制系统提供可复现的Koopman-RNN融合解决方案; 阅读建议:建议结合Matlab代码逐段理解算法实现细节,重点关注Koopman观测矩阵构造、RNN训练流程与模型预测控制器(MPC)的集成方式,鼓励在实际硬件平台上验证并调整参数以适应具体应用场景。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值