#3482 closed defect (duplicate)
Wrong creation of Clock with real interval
| Reported by: | Rüdiger Franke | Owned by: | somebody |
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.4 |
| Component: | Backend | Version: | |
| Keywords: | Cc: |
Description
The following model creates a clock with Real interval. It worked if dt was constant; it fails if dt is a parameter (see e.g. Modelica_Synchronous):
model RealParameterClock parameter Real dt = 0.1 annotation(Evaluate = true); input Real u; output Real y(start = 0); equation when Clock(dt) then y = previous(y) + u; end when; end RealParameterClock;
The code attempts to access the non existing previous(dt):
RealParameterClock_15syn.c:63:53: error: ‘$P$CLKPRE$Pdt’ undeclared (first use in this function)
data->simulationInfo.clocksData[i].interval = $P$CLKPRE$Pdt;
^
Alternatively in the Cpp runtime (+simCodeTarget=Cpp):
OMCppRealParameterClock.cpp: In member function ‘virtual void RealParameterClock::getTimeEvent(time_event_type&)’:
OMCppRealParameterClock.cpp:402:45: error: ‘_$CLKPRE_P_dt’ was not declared in this scope
time_events.push_back(std::make_pair(0.0, _$CLKPRE_P_dt));
^
Change History (7)
comment:1 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 10 years ago
| Component: | Frontend → Backend |
|---|
comment:3 by , 10 years ago
I guess this could be easily fixed by modifying back end module clockPartitioning. The function SynchronousFeatures.substClockExp should only wrap the inExp if it is variable (not constant nor parameter expression of type real).
comment:4 by , 10 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:5 by , 10 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | reopened → closed |
Note:
See TracTickets
for help on using tickets.

duplicate #3498