我试图了解何时在 Modelica 中生成事件。在函数的上下文中,我注意到了我没想到的行为:函数似乎抑制了事件生成。
我很惊讶,据我所知,Modelica 参考文献中没有明确说明这一点。例如,如果我在 OpenModelica 1.17.0 的 OMEdit 中运行此模型
model timeEventTest
Real z(start=0);
Real dummy(start=0);
equation
der(z) = dummy;
algorithm
if time > 10 then
dummy := 1;
else
dummy := -1.;
end if;
end timeEventTest;
Run Code Online (Sandbox Code Playgroud)
我在 OMEdit 的求解器窗口中得到以下输出
### STATISTICS ###
timer
events
1 state events
0 time events
solver: dassl
46 steps taken
46 calls of functionODE
44 evaluations of jacobian
0 error test failures
0 convergence test failures
0.000122251s time of jacobian evaluation
The simulation finished …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作类似于收入直方图的东西ggplot2。然而,因为我不想显示 y 轴中的频率,而是显示 data.frame 中计算出的变量,所以我想我必须使用geom_bar()存储桶并将其分配为我的data.frame. 现在我想显示我已确定存储桶的所有条形图,但不显示 x 轴上的所有标签。我想一定有某种方法可以用breaks =in来做到这scale_x_discrete()一点,但不知道如何让它只接受“显示每个第二个标签”或类似的东西。
有人会建议如何根据因子变量在 x 轴上显示离散 x 轴的每隔一个标签吗?
(非常感谢任何人的帮助,如果我在这里使用了错误的术语,抱歉。我是 R 新手,只是想尽可能准确地描述一切。)