diff --git a/AlgebraicDataflowArchitectureModel/models/Clock.dtram b/AlgebraicDataflowArchitectureModel/models/Clock.dtram new file mode 100644 index 0000000..380ceca --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/models/Clock.dtram @@ -0,0 +1,27 @@ +model { +channel CIO1 { + out min(m, tick) == mod(m + 1, 60) +} +channel HourUpdate { + in hour(h, update(h')) == h' + out hour_hand(h_ang, update(h')) == h' / 6 * PI +} +channel MinUpdate { + in min(m, update(m')) == m' + out min_hand(m_ang, update(m')) == m' / 30 * PI +} +channel Clock { + in min(m, update(m')) == m' + out hour(h, update(m')) == if(eq(m', 0), mod(h + 1, 24), h) +} +} +geometry { + node c HourUpdate:520,340,30,30 + node c MinUpdate:520,100,30,30 + node c Clock:280,220,30,30 + node r min_hand:670,100,80,30 + node r min:250,100,80,30 + node r hour:270,340,80,30 + node r hour_hand:680,340,80,30 + node ioc CIO1:100,100,30,30 +}