From herve.ressencourt@____.fr Mon Jan 15 15:18:13 2007 Date: Mon, 15 Jan 2007 14:50:53 +0100 From: herve.ressencourt Reply-To: openmodelicainterest (at) ida.liu.se To: openmodelicainterest (at) ida.liu.se Subject: Pb with Simulation of discrete event systems Good afternoon, First off all : Best wishes for the new year 2007! To describe simple automotive functions having both continuous ans discrete components, I needed a timer. I was not able to find the timer component in the Modelica Standard library shipped with OpenModelica 1.4.2. Therefore, I imported the one included in the Modelica Standard library 2.2 from www.modelica.org: ----- block Timer "Timer measuring the time from the time instant where the Boolean input became true" extends Modelica.Blocks.Interfaces.partialBooleanBlockIcon; Modelica.Blocks.Interfaces.BooleanInput u; Modelica.Blocks.Interfaces.RealOutput y; protected discrete Modelica.SIunits.Time entryTime "Time instant when u became true"; initial equation pre(entryTime)=0; equation when edge(u) then entryTime=time; end when; y=if u then time - entryTime else 0.0; end Timer; ----- In order to test it, I used the following step at time 6: -------- model Test_Timer Modelica.Blocks.Sources.BooleanStep booleanStep(startTime=6); Timer timer_int; equation connect(booleanStep.y,timer_int.u); end Test_Timer; -------- The joined picture shows that the model reacted when its input is switched to true but there is a problem in the result: a time impulse occurred at time = 6. Did it ever occur with other open modelica users? How can I use timers with OpenModelica? Many thanks in advance. Best Regards Hervé R. --------------------------------------------- Hervé RESSENCOURT Ingénieur Doctorant Société ACTIA BU Diagnostic - Equipe recherche 05 61 17 68 79 Laboratoire d'Analyse et d'Architecture des Systèmes du CNRS Groupe DISCO (Diagnostic, Supervision et COnduite qualitatifs)