Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » ae_graham
  • » Profile

Posts

Posts

Hello everyone,

I would like to create a simple block that by having it loaded on the library, and double clicking it, it will run an executable program associated to it. Is this possible? If so, what function would I have to use?

Thanks

Oct-20-16 15:27:46
Runtime Error

Every so often just by connecting two blocks together or adding new blocks to a model, OMEdit crashes and it closes unexpectedly loosing part of my work done. I get the following message at the bottom 

"Scripting Notification.
terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc"

Any suggestions or solutions to fix this problem?
Thank you

Jun-06-16 10:56:26
Normally distributed random noise

Hello everyone

My problem is that, when I include the "NoiseNormal" block into a new model and simulate it, I get a sequence of random numbers as expected, but the problem is that if I re-simulate I get exactly the same set of random numbers during the same time interval, so it actually doesn't change the numbers every time I simulate. I am using Omedit, and the code inside the NoiseNormal block is:

block NoiseNormal "Normally distributed random noise"
  parameter Real mean = 0 "Mean value of random noise";
  parameter Real stdev = 100 "Standard deviation of random noise";
  parameter Real tSample = 1 "Noise sample time";
  Modelica.Blocks.Interfaces.RealOutput y annotation(Placement(visible = true, transformation(origin = {90.0, 0.0}, extent = {{-10.0, -10.0}, {10.0, 10.0}}, rotation = 0), iconTransformation(origin = {90.0, 0.0}, extent = {{-10.0, -10.0}, {10.0, 10.0}}, rotation = 0)));
equation
  when initial() then
    SystemDynamics.Functions.Utilities.InitRandomNormal();
  end when;
  when sample(0, tSample) then
    y = mean + stdev * SystemDynamics.Functions.Utilities.RandomNormal(time);
  end when;
  annotation(Diagram(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10})), Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 0, 255}, extent = {{-80.0, -80.0}, {80.0, 80.0}}), Text(visible = true, lineColor = {0, 0, 255}, extent = {{-0.0, -124.0}, {0.0, -80.0}}, textString = "%name", fontName = "Arial"), Text(visible = true, lineColor = {0, 0, 255}, extent = {{-6.0, 36.0}, {-6.0, 68.0}}, textString = "mean=%mean", fontName = "Arial"), Text(visible = true, lineColor = {0, 0, 255}, extent = {{-4.0, -6.0}, {-4.0, 24.0}}, textString = "stdev=%stdev", fontName = "Arial"), Text(visible = true, lineColor = {0, 0, 255}, extent = {{-2.0, -54.0}, {-2.0, -24.0}}, textString = "tSample=%tSample", fontName = "Arial")}));
end NoiseNormal;

Please any help on this
Many thanks

  • Index
  • » Users
  • » ae_graham
  • » Profile
You are here: