{"action":"created","issue":{"url":"https://api.github.com/repos/modelica/ModelicaSpecification/issues/578","repository_url":"https://api.github.com/repos/modelica/ModelicaSpecification","labels_url":"https://api.github.com/repos/modelica/ModelicaSpecification/issues/578/labels{/name}","comments_url":"https://api.github.com/repos/modelica/ModelicaSpecification/issues/578/comments","events_url":"https://api.github.com/repos/modelica/ModelicaSpecification/issues/578/events","html_url":"https://github.com/modelica/ModelicaSpecification/issues/578","id":377082937,"node_id":"MDU6SXNzdWUzNzcwODI5Mzc=","number":578,"title":"Add comment about sorting of reinit-clause to the Modelica specification","user":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"labels":[{"id":971423513,"node_id":"MDU6TGFiZWw5NzE0MjM1MTM=","url":"https://api.github.com/repos/modelica/ModelicaSpecification/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"open","locked":false,"assignee":{"login":"HansOlsson","id":13217430,"node_id":"MDQ6VXNlcjEzMjE3NDMw","avatar_url":"https://avatars0.githubusercontent.com/u/13217430?v=4","gravatar_id":"","url":"https://api.github.com/users/HansOlsson","html_url":"https://github.com/HansOlsson","followers_url":"https://api.github.com/users/HansOlsson/followers","following_url":"https://api.github.com/users/HansOlsson/following{/other_user}","gists_url":"https://api.github.com/users/HansOlsson/gists{/gist_id}","starred_url":"https://api.github.com/users/HansOlsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansOlsson/subscriptions","organizations_url":"https://api.github.com/users/HansOlsson/orgs","repos_url":"https://api.github.com/users/HansOlsson/repos","events_url":"https://api.github.com/users/HansOlsson/events{/privacy}","received_events_url":"https://api.github.com/users/HansOlsson/received_events","type":"User","site_admin":false},"assignees":[{"login":"mtiller","id":144876,"node_id":"MDQ6VXNlcjE0NDg3Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/144876?v=4","gravatar_id":"","url":"https://api.github.com/users/mtiller","html_url":"https://github.com/mtiller","followers_url":"https://api.github.com/users/mtiller/followers","following_url":"https://api.github.com/users/mtiller/following{/other_user}","gists_url":"https://api.github.com/users/mtiller/gists{/gist_id}","starred_url":"https://api.github.com/users/mtiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtiller/subscriptions","organizations_url":"https://api.github.com/users/mtiller/orgs","repos_url":"https://api.github.com/users/mtiller/repos","events_url":"https://api.github.com/users/mtiller/events{/privacy}","received_events_url":"https://api.github.com/users/mtiller/received_events","type":"User","site_admin":false},{"login":"sjoelund","id":3016460,"node_id":"MDQ6VXNlcjMwMTY0NjA=","avatar_url":"https://avatars0.githubusercontent.com/u/3016460?v=4","gravatar_id":"","url":"https://api.github.com/users/sjoelund","html_url":"https://github.com/sjoelund","followers_url":"https://api.github.com/users/sjoelund/followers","following_url":"https://api.github.com/users/sjoelund/following{/other_user}","gists_url":"https://api.github.com/users/sjoelund/gists{/gist_id}","starred_url":"https://api.github.com/users/sjoelund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjoelund/subscriptions","organizations_url":"https://api.github.com/users/sjoelund/orgs","repos_url":"https://api.github.com/users/sjoelund/repos","events_url":"https://api.github.com/users/sjoelund/events{/privacy}","received_events_url":"https://api.github.com/users/sjoelund/received_events","type":"User","site_admin":false},{"login":"casella","id":4233148,"node_id":"MDQ6VXNlcjQyMzMxNDg=","avatar_url":"https://avatars1.githubusercontent.com/u/4233148?v=4","gravatar_id":"","url":"https://api.github.com/users/casella","html_url":"https://github.com/casella","followers_url":"https://api.github.com/users/casella/followers","following_url":"https://api.github.com/users/casella/following{/other_user}","gists_url":"https://api.github.com/users/casella/gists{/gist_id}","starred_url":"https://api.github.com/users/casella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/casella/subscriptions","organizations_url":"https://api.github.com/users/casella/orgs","repos_url":"https://api.github.com/users/casella/repos","events_url":"https://api.github.com/users/casella/events{/privacy}","received_events_url":"https://api.github.com/users/casella/received_events","type":"User","site_admin":false},{"login":"MartinOtter","id":7248038,"node_id":"MDQ6VXNlcjcyNDgwMzg=","avatar_url":"https://avatars3.githubusercontent.com/u/7248038?v=4","gravatar_id":"","url":"https://api.github.com/users/MartinOtter","html_url":"https://github.com/MartinOtter","followers_url":"https://api.github.com/users/MartinOtter/followers","following_url":"https://api.github.com/users/MartinOtter/following{/other_user}","gists_url":"https://api.github.com/users/MartinOtter/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinOtter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinOtter/subscriptions","organizations_url":"https://api.github.com/users/MartinOtter/orgs","repos_url":"https://api.github.com/users/MartinOtter/repos","events_url":"https://api.github.com/users/MartinOtter/events{/privacy}","received_events_url":"https://api.github.com/users/MartinOtter/received_events","type":"User","site_admin":false},{"login":"christoff-buerger","id":7884278,"node_id":"MDQ6VXNlcjc4ODQyNzg=","avatar_url":"https://avatars2.githubusercontent.com/u/7884278?v=4","gravatar_id":"","url":"https://api.github.com/users/christoff-buerger","html_url":"https://github.com/christoff-buerger","followers_url":"https://api.github.com/users/christoff-buerger/followers","following_url":"https://api.github.com/users/christoff-buerger/following{/other_user}","gists_url":"https://api.github.com/users/christoff-buerger/gists{/gist_id}","starred_url":"https://api.github.com/users/christoff-buerger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christoff-buerger/subscriptions","organizations_url":"https://api.github.com/users/christoff-buerger/orgs","repos_url":"https://api.github.com/users/christoff-buerger/repos","events_url":"https://api.github.com/users/christoff-buerger/events{/privacy}","received_events_url":"https://api.github.com/users/christoff-buerger/received_events","type":"User","site_admin":false},{"login":"HansOlsson","id":13217430,"node_id":"MDQ6VXNlcjEzMjE3NDMw","avatar_url":"https://avatars0.githubusercontent.com/u/13217430?v=4","gravatar_id":"","url":"https://api.github.com/users/HansOlsson","html_url":"https://github.com/HansOlsson","followers_url":"https://api.github.com/users/HansOlsson/followers","following_url":"https://api.github.com/users/HansOlsson/following{/other_user}","gists_url":"https://api.github.com/users/HansOlsson/gists{/gist_id}","starred_url":"https://api.github.com/users/HansOlsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansOlsson/subscriptions","organizations_url":"https://api.github.com/users/HansOlsson/orgs","repos_url":"https://api.github.com/users/HansOlsson/repos","events_url":"https://api.github.com/users/HansOlsson/events{/privacy}","received_events_url":"https://api.github.com/users/HansOlsson/received_events","type":"User","site_admin":false},{"login":"jespermattsson","id":13779895,"node_id":"MDQ6VXNlcjEzNzc5ODk1","avatar_url":"https://avatars2.githubusercontent.com/u/13779895?v=4","gravatar_id":"","url":"https://api.github.com/users/jespermattsson","html_url":"https://github.com/jespermattsson","followers_url":"https://api.github.com/users/jespermattsson/followers","following_url":"https://api.github.com/users/jespermattsson/following{/other_user}","gists_url":"https://api.github.com/users/jespermattsson/gists{/gist_id}","starred_url":"https://api.github.com/users/jespermattsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jespermattsson/subscriptions","organizations_url":"https://api.github.com/users/jespermattsson/orgs","repos_url":"https://api.github.com/users/jespermattsson/repos","events_url":"https://api.github.com/users/jespermattsson/events{/privacy}","received_events_url":"https://api.github.com/users/jespermattsson/received_events","type":"User","site_admin":false},{"login":"henrikt-ma","id":25294143,"node_id":"MDQ6VXNlcjI1Mjk0MTQz","avatar_url":"https://avatars3.githubusercontent.com/u/25294143?v=4","gravatar_id":"","url":"https://api.github.com/users/henrikt-ma","html_url":"https://github.com/henrikt-ma","followers_url":"https://api.github.com/users/henrikt-ma/followers","following_url":"https://api.github.com/users/henrikt-ma/following{/other_user}","gists_url":"https://api.github.com/users/henrikt-ma/gists{/gist_id}","starred_url":"https://api.github.com/users/henrikt-ma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrikt-ma/subscriptions","organizations_url":"https://api.github.com/users/henrikt-ma/orgs","repos_url":"https://api.github.com/users/henrikt-ma/repos","events_url":"https://api.github.com/users/henrikt-ma/events{/privacy}","received_events_url":"https://api.github.com/users/henrikt-ma/received_events","type":"User","site_admin":false},{"login":"gkurzbach","id":25528503,"node_id":"MDQ6VXNlcjI1NTI4NTAz","avatar_url":"https://avatars1.githubusercontent.com/u/25528503?v=4","gravatar_id":"","url":"https://api.github.com/users/gkurzbach","html_url":"https://github.com/gkurzbach","followers_url":"https://api.github.com/users/gkurzbach/followers","following_url":"https://api.github.com/users/gkurzbach/following{/other_user}","gists_url":"https://api.github.com/users/gkurzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/gkurzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkurzbach/subscriptions","organizations_url":"https://api.github.com/users/gkurzbach/orgs","repos_url":"https://api.github.com/users/gkurzbach/repos","events_url":"https://api.github.com/users/gkurzbach/events{/privacy}","received_events_url":"https://api.github.com/users/gkurzbach/received_events","type":"User","site_admin":false},{"login":"svorkoetter","id":25961958,"node_id":"MDQ6VXNlcjI1OTYxOTU4","avatar_url":"https://avatars2.githubusercontent.com/u/25961958?v=4","gravatar_id":"","url":"https://api.github.com/users/svorkoetter","html_url":"https://github.com/svorkoetter","followers_url":"https://api.github.com/users/svorkoetter/followers","following_url":"https://api.github.com/users/svorkoetter/following{/other_user}","gists_url":"https://api.github.com/users/svorkoetter/gists{/gist_id}","starred_url":"https://api.github.com/users/svorkoetter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svorkoetter/subscriptions","organizations_url":"https://api.github.com/users/svorkoetter/orgs","repos_url":"https://api.github.com/users/svorkoetter/repos","events_url":"https://api.github.com/users/svorkoetter/events{/privacy}","received_events_url":"https://api.github.com/users/svorkoetter/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/modelica/ModelicaSpecification/milestones/45","html_url":"https://github.com/modelica/ModelicaSpecification/milestone/45","labels_url":"https://api.github.com/repos/modelica/ModelicaSpecification/milestones/45/labels","id":3792691,"node_id":"MDk6TWlsZXN0b25lMzc5MjY5MQ==","number":45,"title":"ModelicaSpec3.2rev2","description":"","creator":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"closed","created_at":"2018-11-03T10:09:41Z","updated_at":"2018-11-03T18:54:40Z","due_on":"2012-09-07T07:00:00Z","closed_at":"2018-11-03T10:09:41Z"},"comments":27,"created_at":"2018-11-03T18:53:49Z","updated_at":"2018-11-03T18:58:59Z","closed_at":null,"author_association":"COLLABORATOR","body":"**Reported by otter on 29 Jun 2011 09:02 UTC**\nIt is not obvious how to handle reinit(..) in a tool. It seems therefore useful to add a comment in section 8.3.6 of the Modelica specification:\n\n[_A reinit(..) clause should be sorted together with all other equations. This can be performed in the following way:_\n\n_A statement of the form:_\n\n```\n    when condition then\n       reinit(x, expr)\n    end when;\n```\n\n_is mapped to the following equation:_\n\n```\n    b = condition\n    x = if edge(b) then expr else fromIntegrator(id_x);\n```\n\n_where fromIntegrator(..) is a known tool specific function and id_x is the known identifier to identify \"x\" (e.g., the index of x in the state vector). This mapped equation can be sorted with all other equations under the assumption that the state x is an \"unknown\" and no longer a \"known\". As for all when-equations, it is an error if an algebraic loop contains equations from when-clauses with different when-conditions. \n\nExamples:\n_\n\n\n```\nalgorithm\n  when z > 0 then\n     reinit(x, 2*y)\n     reinit(y, 2*x)\n  end when;\n```\n_\nthis is o.k., since mapped to:_\n\n\n```\nalgorithm\n   x := pre(x)\n   y := pre(y)\n   b := z > 0\n   x := if b and not pre(b) then 2*y else fromIntegrator(id_x);\n   y := if b and not pre(b) then 2*x else fromIntegrator(id_x);\n```\n\n_\nOn the other hand:_\n\n```\nequation\n   when y > 0 then\n     reinit(x, 2*y);\n   end when;\n\n   when x > 0 then\n     reinit(y, 2*x)\n   end when;\n```\n\n_is an error, since mapped to an algebraic loop with equations from two when clauses:_\n\n```\nequation\n   x = if edge(y>0) then 2*y else fromIntegrator(id_x);\n   y = if edge(x>0) then 2*x else fromIntegrator(id_y); \n\n   /* These are two equations in two unknowns\n      0 = f1(x,y)   // when-condition y > 0\n      0 = f2(x,y)   // when-condition x > 0\n   */\n```\n\n]\n\n----\n\nMigrated-From: https://trac.modelica.org/Modelica/ticket/578"},"comment":{"url":"https://api.github.com/repos/modelica/ModelicaSpecification/issues/comments/435612558","html_url":"https://github.com/modelica/ModelicaSpecification/issues/578#issuecomment-435612558","issue_url":"https://api.github.com/repos/modelica/ModelicaSpecification/issues/578","id":435612558,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTYxMjU1OA==","user":{"login":"modelica-trac-importer","id":22202507,"node_id":"MDQ6VXNlcjIyMjAyNTA3","avatar_url":"https://avatars1.githubusercontent.com/u/22202507?v=4","gravatar_id":"","url":"https://api.github.com/users/modelica-trac-importer","html_url":"https://github.com/modelica-trac-importer","followers_url":"https://api.github.com/users/modelica-trac-importer/followers","following_url":"https://api.github.com/users/modelica-trac-importer/following{/other_user}","gists_url":"https://api.github.com/users/modelica-trac-importer/gists{/gist_id}","starred_url":"https://api.github.com/users/modelica-trac-importer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modelica-trac-importer/subscriptions","organizations_url":"https://api.github.com/users/modelica-trac-importer/orgs","repos_url":"https://api.github.com/users/modelica-trac-importer/repos","events_url":"https://api.github.com/users/modelica-trac-importer/events{/privacy}","received_events_url":"https://api.github.com/users/modelica-trac-importer/received_events","type":"User","site_admin":false},"created_at":"2018-11-03T18:58:59Z","updated_at":"2018-11-03T18:58:59Z","author_association":"COLLABORATOR","body":"**Comment by otter on 4 Jun 2013 13:10 UTC**\nDiscussion during lunch (Hilding, Hans, Gerd, Martin):\n\nreinit(..) is a hack to describe a very restricted class of impulses, and the idea is to guide the semantics from the semantics of impulses: For mechanical systems, the approach is as follows:\n\n  If an impact occurs, the discontinuous change of state variables is computed by integrating over the equations in infinite small time. By this integration, all finite forces become zero and do not contribute (only the infinite, dirac impulse, forces contribute). Once the discontinuous change of the state variables has been computed, normal integration continuous with the finite forces that depend on these state variables.\n  This indicates, that proposal 1 should be used: compute the discontinuous change of the state variables at the end of the model evaluation and then apply it to the model (with the new event iteration).\n\nThe \"algorithm\" part is against this approach. A simple fix would be to not allow reinit(..) in algorithm sections. This gives Proposal 3:\n\nProposal 3:\n\n * reinit(..) is only allowed in equation sections, but no in algorithm sections.\n * Delayed assignment - reinit(x, ) means that x will be given a new value  for the next event iteration - but not for this event iteration. \n * Tools that allow reinit in algorithm section, can still support it for some time. In \"pedantic\" mode, it is however forbidden.\n\nAgreement by Hilding, Hans, Gerd, Martin on this proposal"}}
{"actor":{"display_login":"modelica-trac-importer"}}