Modelica中的条件组件(Conditional Components in Modelica)
我想用条件表达式减少超过300000个方程的大型通用模型,这样只剩下相关的部分。 为了说明问题,我有以下最小模型:
model Test parameter Boolean level1=true; parameter Boolean level2=false; Integer x=1 if level1; Integer y=2 if level2; Integer z; equation if level1 and level2 then z = x+y; elseif level1 then z = x; elseif level2 then z = y; else z=0; end if; end Test;
此模型在Dymola中不起作用,并显示以下错误消息:
未声明的变量:y因为有条件地删除了y的声明
在OpenModelica中,模型有效。 所以我的问题是,这个Model Modelica是否合规? 在Modelica 3.4规范第4.4.5节中,我没有找到任何会使该模型无效的内容。
谢谢您的帮助。
I want with conditional expressions reduce large general models with over 300000 equations so that only a relevant part remains. To illustrate the problem I have the following minimal model:
model Test parameter Boolean level1=true; parameter Boolean level2=false; Integer x=1 if level1; Integer y=2 if level2; Integer z; equation if level1 and level2 then z = x+y; elseif level1 then z = x; elseif level2 then z = y; else z=0; end if; end Test;
This model does not work in Dymola, with the error message:
Undeclared variables: y since the declaration of y was conditionally removed
In OpenModelica the model works. So my question is, is this Model Modelica compliant? In the Modelica 3.4 specification section 4.4.5 I did not find anything that would invalidate this model.
Thanks for the help.
原文:https://stackoverflow.com/questions/48662090
最满意答案
首先创建
DIV
对象,向其添加内容,然后将DIV
附加到#aspcal
表。 喜欢这个://Create the DIV... var myDiv = $("<div id='outer' style='height:15px'></div>"); //add the inner content... for (l = 0; l < rssArray.length; l++) if (eleArray[l][19] == curNumMonth && eleArray[l][20] == curNumDay && eleArray[l][21] == curNumYear) { myDiv.append("</br><div style='height:auto'><b>" + eleArray[l][8] + "</b></br><a href='" + eleArray[l][0] + "' target='_blank'>" + eleArray[l][1] + "</a></div>"); } //add the div here... $('#aspcal tr:eq(' + loopweek + ') td:eq(' + loopday + ')').append(myDiv);
Create the
DIV
object first, append content to it, then append theDIV
to your#aspcal
table. Like this://Create the DIV... var myDiv = $("<div id='outer' style='height:15px'></div>"); //add the inner content... for (l = 0; l < rssArray.length; l++) if (eleArray[l][19] == curNumMonth && eleArray[l][20] == curNumDay && eleArray[l][21] == curNumYear) { myDiv.append("</br><div style='height:auto'><b>" + eleArray[l][8] + "</b></br><a href='" + eleArray[l][0] + "' target='_blank'>" + eleArray[l][1] + "</a></div>"); } //add the div here... $('#aspcal tr:eq(' + loopweek + ') td:eq(' + loopday + ')').append(myDiv);
相关问答
更多-
如果div有内容显示div(if div has content show div)[2023-10-10]
如果你想检查文本 ,你可以使用text()方法: $(document).ready(function(){ if ($("#box3").text().length > 0) { $('#third').show(); } }); 或者对于html: $(document).ready(function(){ if ($("#box3").html().length > 0) { ... -
因为您只是将该方法应用于类,并且只要找到该类,该函数就会被执行。 您需要定义该函数应该在click元素的父类上执行。 您可以像这样使用.parents()或.closest()选择器 $(".add").click(function () { $(this).closest(".content").append('
-
创建
并动态追加(Createand appenddynamically)[2021-06-24]使用相同的过程。 您已经有变量iDiv ,它仍然是您创建的原始元素。 你只需要创建另一个并调用appendChild() 。 // Your existing code unmodified... var iDiv = document.createElement('div'); iDiv.id = 'block'; iDiv.className = 'block'; document.getElementsByTagName('body')[0].appendC ...无法将连续值附加到div块中的customId(Unable to append concatenated value to a customId in a div block)[2022-06-15]
你必须把赋值mergeValue = selectedTemplate + selectedAssignment; 在使用变量之前。 完整的代码是: var selectedTemplate; var selectedAssignment; var mergeValue; selectedTemplate = $("#criteriaTemplate option:selected ...使用事件委派。 .on()方法将事件处理程序附加到jQuery对象中当前选定的一组元素。 写: $(document).on('click','.btnAdd',function () { $(document).find('.btnAdd').remove(); $('#otheranettedata').append(datatoappend); // end append }); 这里更新了小提琴。 请参阅此文档。 Use event deleg ...不能附加Div(Can not append a Div)[2019-09-02]
在使用jQuery时,请使用 var div = $('') .prop('id', "data" + div_count) .html(tableHTML); $('#data') .append(div) .append("
"); As you are using jQuery, use var div = $('') .prop('id', "data" + div_count) ...Jquery将内容附加到div(Jquery append content to div)[2022-07-20]
$('#video1').append('Test
'); 对于演示,我在这里附加了p 。 $('#video1').append('Test
'); For demo, I have appended p here.将div放在背景div中(Put div inside background div)[2022-06-14]
你在错误的地方添加了锚标签 var theToggle = document.getElementById('toggle'); // based on Todd Motto functions // http://toddmotto.com/labs/reusable-js/ // hasClass function hasClass(elem, className) { return new RegExp(' ' + className + ' ').test(' ' + el ...在调用Code.photoSwipe之前,尝试在DOMContentLoaded处理程序中执行append 。 此外,jQuery提供了一种更短的编写方式: