错误:意外的令牌参数-Modellica

如何解决错误:意外的令牌参数-Modellica

我尝试在Modelica中实现代码。我在以“参数Integer n_Kapazitaten = 3”开头的行中收到以下错误

[错误] SimModelcode,第8行:意外令牌:“参数”

model SimModelcode
  parameter Real l_Volume 
  parameter Integer n_Kapazitaten=3 ; //Anzahl der Kapazitäten
  parameter Integer n_Unterteilung=8 ;//Anzahl der Unterteilung
  parameter Real l_aussen[n_Unterteilung]=0.3;//die Länge der obigen Kante vom dem Außenrechteck
  parameter Real  l_Alu=0.05;//die Länge der obigen Kante vom Alublock
  parameter Real h_aussen[n_Unterteilung]=0.2;//die Höhe der linken Kante von dem Außenrechteck
  parameter Real h_Alu=0.02;//die Höhe der linken Kante von Alublock
  parameter Real dicke=0.01;
  parameter Integer lambda_Kunststoff=10;
  parameter Integer cp_Alu=200;
  parameter Integer cp_Kunststoff=10;
  parameter Integer rho_Kunststoff=1185;
  parameter Integer rho_Alu=2719;
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow PrescribedHeatFlow(Q_flow = 10) annotation(
      Placement(visible = true,transformation(origin = {-14,-24},extent = {{10,-10},{-10,10}},rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature PrescribedTemperature1(T = 300) annotation(
      Placement(visible = true,transformation(origin = {64,42},rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature PrescribedTemperature2(T = 300) annotation(
      Placement(visible = true,rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature PrescribedTemperature3(T = 300) annotation(
      Placement(visible = true,rotation = 0)));
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature PrescribedTemperature4(T = 300) annotation(
      Placement(visible = true,rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor Alu(C = 0.5438) annotation(
      Placement(visible = true,rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor Capacitors[4*n_Kapazitaten](C =heatcapacity) annotation(
      Placement(visible = true,rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor Conductors[4*n_Kapazitaten+4](G=thermalconductance) annotation(
      Placement(visible = true,rotation = 0)));
equation
  l_link=((l_aussen[n_Unterteilung]-l_Alu)/2) /(n_Kapazitaten+1);// Abstand zwischen zwei Kapazitäten in linkem Block und rechtem Block
  l_oben=((h_aussen[n_Unterteilung]-h_Alu)/2)/(n_Kapazitaten+1);//Abstand zwischen zwei Kapazitäten in obigem Block und unterem Block
  V_alu=l_Alu*h_Alu*dicke;
  cpm_alu=V_alu*cp_alu;
  for i in 1:n_Unterteilung loop
    h_aussen[i]=h_Alu+(i/n_Unterteilung)*(h_aussen[n_Unterteilung]-h_Alu);//Berechnung der Höhe in den linken Trapezflächen
    Flache_link[i]=h_aussen[i]*dicke;//Berechnung der Flache in den linken Trapezflächen
    l_aussen[i]=l_Alu+(i/n_Unterteilung)*(l_aussen[n_Unterteilung]-l_Alu);//Berechnung der Länge in den obigen Trapezflächen
    Flache_oben[i]=l_aussen[i]*dicke;//Berechnung der Höhe in den obigen Trapezflächen
  end for; 
  G[1:n_Kapazitaten+2]= lambda_Kunststoff*(Flache_link[1:n_Unterteilung+1:2]/l_link);
  G[n_Kapazitaten+2:2*(n_Kapazitaten+1)+1]= lambda_Kunststoff*(Flache_oben[1:n_Unterteilung+1:2]/l_oben);
  G[2*(n_Kapazitaten+1)+1:3*(n_Kapazitaten+1)+1]= lambda_Kunststoff*(Flache_link[1:n_Unterteilung+1:2]/l_link);
  G[3*(n_Kapazitaten+1)+4*(n_Kapazitaten+1)+1]= lambda_Kunststoff*(Flache_oben[1:n_Unterteilung+1:2]/l_oben);
  for i in 1:n_Kapazitaten loop
    h_Volume[i]=h_Alu+(i/n_Kapazitaten)*(h_aussen[n_Unterteilung]-h_Alu)
    l_Volume[i]=l_Alu+(i/n_Kapazitaten)*(l_aussen[n_Unterteilung]-l_Alu)
    V_link[i]=(dicke*(h_Volume[i])*((i/n_Kapazitaten)*(l_aussen[n_Unterteilung]-l_Alu)/2))/; //Volumen in linkem und rechtem Block pro Kapazitat 
    V_oben[i]=(dicke*(l_Volume[i])*((i/n_Kapazitaten)*(h_aussen[n_Unterteilung]-h_Alu)/2));//Volumen in obigem und unterem Block pro Kapazitat 
    m_link[i]=rho_Kunststoff*V_link[i];
    m_oben[i]=rho_Kunststoff*V_oben[i];
    cpm_link[i]=cp_Kunststoff*m_link[i];
    cpm_oben[i]=cp_Kunststoff*m_oben[i];
  end for;
  cpm[1:n_Kapazitaten+1]=cp_Kunststoff*m_link[1:n_Kapazitaten+1];
  cpm[n_Kapazitaten+1:2*n_Kapazitaten+1]=cp_Kunststoff*m_oben[1:n_Kapazitaten+1];
  cpm[2*n_Kapazitaten+1:3*n_Kapazitaten+1]=cp_Kunststoff*m_link[1:n_Kapazitaten+1];
  cpm[3*n_Kapazitaten+1:4*n_Kapazitaten+1]=cp_Kunststoff*m_oben[1:n_Kapazitaten+1];
  
  ///for i=1:4*n_Kapazitaten
    //Capacitors_links=Capacitors[n_Kapazitaten];
    //Capacitors_oben=Capacitors[n_Kapazitaten:2*n_Kapazitaten];
    //Capacitors_rechts=Capacitors[2*n_Kapazitaten:3*n_Kapazitaten];
    //Capacitors_unten=Capacitors[3*n_Kapazitaten:4*n_Kapazitaten]
  //end for;
  
  for i in 1:4*n_Kapazitaten+4 loop 
    thermalconductance[i]=G[i];
  end for;
  for i in 1:4*n_Kapazitaten loop 
    heatcapacity[i]=cpm[i];
  end for;  


  connect(PrescribedHeatFlow.port,Aluminium.port) annotation(
      Line(points = {{54,{16,40},40}},color = {191,0}));
  connect(Conductors[1].port_a,Alu.port );
  connect(Conductors[n_Kapazitaten+2].port_a,Alu.port );
  connect(Conductors[2*(n_Kapazitaten+1)+1].port_a,Alu.port );
  connect(Conductors[3*(n_Kapazitaten+1)+1].port_a,Alu.port );
   
  for i in 1:n_Kapazitaten loop
    connect(Conductors[i].port_a,Capacitors[i].port);
    connect(Capacitors[i].port,Conductors[i+1].port_b);
  end for;
  connect(Conductors[n_Kapazitaten+1].port_a,PrescribedTemperature1.port);
  for i in n_Kapazitaten:2*n_Kapazitaten loop
    connect(Conductors[i].port_a,Conductors[i+1].port_b);
  end for;
  connect(Conductors[2*n_Kapazitaten+2].port_a,PrescribedTemperature2.port);
  for i in 2*n_Kapazitaten:3*n_Kapazitaten loop
    connect(Conductors[i].port_a,Conductors[i+1].port_b);
  end for;
  connect(Conductors[3*n_Kapazitaten+3].port_a,PrescribedTemperature3.port);
  for i in 3*n_Kapazitaten:4*n_Kapazitaten loop
    connect(Conductors[i].port_a,Conductors[i+1].port_b);
  end for;
  connect(Conductors[4*n_Kapazitaten+4].port_a,PrescribedTemperature4.port);
end  SimModelcode;

能帮我解决这个错误吗?解决这个问题似乎很容易。但是,由于我是Modellica的初学者,非常感谢您的帮助。预先感谢!

解决方法

您在第2、47、48行的末尾错过了分号(;),并在第49行的末尾添加了斜杠(/)。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)> insert overwrite table dwd_trade_cart_add_inc > select data.id, > data.user_id, > data.course_id, > date_format(
错误1 hive (edu)> insert into huanhuan values(1,'haoge'); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive> show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 <configuration> <property> <name>yarn.nodemanager.res