Opened 5 years ago
Last modified 4 years ago
#6079 new defect
Conflict between modelica_synchronous and pulse source
| Reported by: | Owned by: | Karim Adbdelhak | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Backend | Version: | |
| Keywords: | Cc: | bernhard.thiele@… |
Description
Hi,
I implemented a wrapping counter using the modelica_synchronous framework. There is also a pulse source in the same model, with the same period value.
The presence of this source triggers the problem:
Instead of incrementing at the same frequency as the pulse source, the counter doesn't increment until the 7th period.
A hold function behind the wrapping counter outputs impulses, so something is going very wrong.
After working properly for 7 periods, the counter stops
See the attached image.
When the pulse source is removed or set to a different period, the wrapping counter behaves as expected.
Does anyone have a clue what's happening here?
Best regards,
Paul van der Hulst
Attachments (2)
Change History (6)
by , 5 years ago
| Attachment: | wrapping_counter.png added |
|---|
comment:1 by , 5 years ago
I tried to run the test case in Dymola. This is the outcome
Continuous time parts and discrete parts don't decompose for:
Clock_0.isTicking
cSample.isTicking
y
Equations:
equation
when cSample then
y = (if time <= 0 or previous(y) == 5 then 1 else previous(y)+1);
end when;
cSample = Clock_0;
Clock_0 = Clock(period);
Decomposition in base clocks failed.
See the file dsmodelBaseClockDecomposition0.mof.
----------- dsmodelBaseClockDecomposition0.mof file
// Base-clock decomposition
// An erroneous non-decomposible partition of continuous time and discrete time parts.
//
// clock variables
Clock_0
cSample
// clock equation
cSample = Clock_0;
Clock_0 = Clock(period);
// unknowns
y
// equation
when cSample then
y = (if time <= 0 or previous(y) == 5 then 1 else previous(y)+1);
end when;
//
//
// Continuous time partition.
//
// unknowns
yhold
// equation
yhold = hold(y);
//
//
// Continuous time partition.
//
// unknowns
phi1.count
phi1.T_start
phi1.T_width
phi1.y
// equation
when integer((time-phi1.startTime)/phi1.period) > pre(phi1.count) then
phi1.count = pre(phi1.count)+1;
phi1.T_start = time;
end when;
phi1.y = phi1.offset+(if time < phi1.startTime or phi1.nperiod == 0 or
phi1.nperiod > 0 and phi1.count >= phi1.nperiod then 0 else (if time <
phi1.T_start+phi1.T_width then phi1.amplitude else 0));
phi1.T_width = 0.01*(phi1.period*phi1.width);
I am not too familiar with clocked systems, I hope this helps
comment:2 by , 5 years ago
| Cc: | added |
|---|---|
| Component: | *unknown* → Backend |
| Milestone: | Future → 1.17.0 |
| Owner: | changed from to |
comment:3 by , 5 years ago
| Milestone: | 1.17.0 → 1.18.0 |
|---|
Retargeted to 1.18.0 because of 1.17.0 timed release.

Graphical output of erroneous model