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
  • » Miche72
  • » Profile

Posts

Posts

Dear all,

I need some help. I try to implement a simple example from ”Michael M. Tiller”, Introduction to Physical Modeling with Modelica”, namely the example in chapter 7.2.3. Here is the code:

model LogicCircuit

Modelica.Blocks.Sources.BooleanPulse i1(width={50}, period={2});
Modelica.Blocks.Sources.BooleanPulse i2(width={50}, period={4});
Modelica.Blocks.Sources.BooleanPulse i3(width={50}, period={8});

And and1, and2;
Or or1;
Not not1, not2;
Boolean o1, o2;

equation
// o1 - output signal
connect(i1.outPort, and1.inPort1);
connect(i3.outPort, and1.inPort2);
connect(and1.outPort, not1.inPort);
connect(not1.outPort, or1.inPort1);
connect(i2.outPort, or1.inPort2);
o1 = or1.outPort.signal[1];

// o2 - output signal
connect(i1.outPort, not2.inPort);
connect(not2.outPort, and2.inPort1);
connect(i2.outPort, and2.inPort2);
o2 = and2.outPort.signal[1];
end LogicCircuit;

But when I try to run script in openmodelica I got the following error message:

>> loadFile("LogicCircuit.mo")
true

>> simulate(LogicCircuit, startTime = 0.0, stopTime = 16.0)
record SimulationResult
resultFile = "",
simulationOptions = "startTime = 0.0, stopTime = 16.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'LogicCircuit', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
messages = "Failed to build model: LogicCircuit",
timeFrontend = 0.0,
timeBackend = 0.0,
timeSimCode = 0.0,
timeTemplates = 0.0,
timeCompile = 0.0,
timeSimulation = 0.0,
timeTotal = 0.0
end SimulationResult;
[C:/OpenModelica1.9.1/share/doc/omc/testmodels/LogicCircuit.mo:7:3-7:17:writable] Error: Klass And hittades inte i definitionsområde LogicCircuit.
Error: Fel inträffade under utflatning av modell LogicCircuit

I can’t figure out what is wrong!?

Thanks and all the best!

Michael Palander

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