Message Boards Message Boards

0
|
10756 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Toggling flip-flop does not work :-(

Posted 10 years ago

I created the following class:

model TestBlock2
  import L = Modelica.Electrical.Digital.Interfaces.Logic; 
  Modelica.Electrical.Digital.Sources.Set set(x = Modelica.Electrical.Digital.Interfaces.Logic.'0') annotation(Placement(visible = true, transformation(origin = {-137.421, -25}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Digital.Sources.Clock clock(startTime = 0, period = 1, width = 50) annotation(Placement(visible = true, transformation(origin = {-137.421, 25}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Digital.Sources.Table table(x = {L.'0', L.'1', L.'0'}, t = {0, 0.5, 3.5}, y0 = L.'0') annotation(Placement(visible = true, transformation(origin = {-137.691, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Digital.Registers.DFFREGSRH dFFREGSRH annotation(Placement(visible = true, transformation(origin = {-32.668, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Digital.Gates.InvGate invGate annotation(Placement(visible = true, transformation(origin = {5, 32.02}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(invGate.y, dFFREGSRH.dataIn[1]) annotation(Line(visible = true, origin = {-13.964, 36.492}, points = {{28.964, -4.473}, {38.964, -4.473}, {38.964, 16.965}, {-39.493, 16.965}, {-39.493, -12.492}, {-27.904, -12.492}}, color = {127, 0, 127}));
  connect(dFFREGSRH.dataOut[1], invGate.x) annotation(Line(visible = true, origin = {-10.117, 28.01}, points = {{-13.351, -4.01}, {2.117, -4.01}, {2.117, 4.01}, {9.117000000000001, 4.01}}, color = {127, 0, 127}));
  connect(table.y, dFFREGSRH.set) annotation(Line(visible = true, origin = {-67.39, 49}, points = {{-60.302, 21}, {17.39, 21}, {17.39, -21}, {25.522, -21}}, color = {127, 0, 127}));
  connect(set.y, dFFREGSRH.reset) annotation(Line(visible = true, origin = {-79.822, -5.5}, points = {{-47.599, -19.5}, {4.822, -19.5}, {4.822, 19.5}, {37.954, 19.5}}, color = {127, 0, 127}));
  connect(clock.y, dFFREGSRH.clock) annotation(Line(visible = true, origin = {-77.322, 21.5}, points = {{-50.099, 3.5}, {7.322, 3.5}, {7.322, -3.5}, {35.454, -3.5}}, color = {127, 0, 127}));
  annotation(Diagram(coordinateSystem(extent = {{-148.5, -105}, {148.5, 105}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})));
end TestBlock2;

which should represent an toggling flip-flop. I created this simple test case while trying to do something a bit more complex and in debugging it I noticed that something was not right.

The above test case should toggle at one half the clock rate but instead the output remains at a solid 0.0 <=> 'Unitialized' as shown in the screen shot below:

System Modeler Output

Being unable to figure out what was wrong, I entered the same circuit in another simulator, which I will leave unnamed, and lo and behold ... it works:

Alternate Simulator Output

My question is rather simple. It seems that either my installation is corrupted in some complicated way or there are bugs in the library or the usage of these blocks within SystemModeler needs to satisfy some undocumented characteristics. Can you please be of assistance?

Regards,

Fulvio Spagna

POSTED BY: Fulvio Spagna
Posted 10 years ago

Dear Fulvio, This issue has been fixed and will be available in the next release of SystemModeler. enter image description here

POSTED BY: Johan Rhodin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract