{"action":"opened","issue":{"url":"https://api.github.com/repos/tbeu/Modelica/issues/484","repository_url":"https://api.github.com/repos/tbeu/Modelica","labels_url":"https://api.github.com/repos/tbeu/Modelica/issues/484/labels{/name}","comments_url":"https://api.github.com/repos/tbeu/Modelica/issues/484/comments","events_url":"https://api.github.com/repos/tbeu/Modelica/issues/484/events","html_url":"https://github.com/tbeu/Modelica/issues/484","id":196978841,"number":484,"title":"Clarification: use of pre() in algorithms","user":{"login":"modelica-trac-importer","id":22202507,"avatar_url":"https://avatars.githubusercontent.com/u/22202507?v=3","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":[],"state":"open","locked":false,"assignee":{"login":"beutlich","id":14896695,"avatar_url":"https://avatars.githubusercontent.com/u/14896695?v=3","gravatar_id":"","url":"https://api.github.com/users/beutlich","html_url":"https://github.com/beutlich","followers_url":"https://api.github.com/users/beutlich/followers","following_url":"https://api.github.com/users/beutlich/following{/other_user}","gists_url":"https://api.github.com/users/beutlich/gists{/gist_id}","starred_url":"https://api.github.com/users/beutlich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beutlich/subscriptions","organizations_url":"https://api.github.com/users/beutlich/orgs","repos_url":"https://api.github.com/users/beutlich/repos","events_url":"https://api.github.com/users/beutlich/events{/privacy}","received_events_url":"https://api.github.com/users/beutlich/received_events","type":"User","site_admin":false},"assignees":[{"login":"beutlich","id":14896695,"avatar_url":"https://avatars.githubusercontent.com/u/14896695?v=3","gravatar_id":"","url":"https://api.github.com/users/beutlich","html_url":"https://github.com/beutlich","followers_url":"https://api.github.com/users/beutlich/followers","following_url":"https://api.github.com/users/beutlich/following{/other_user}","gists_url":"https://api.github.com/users/beutlich/gists{/gist_id}","starred_url":"https://api.github.com/users/beutlich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beutlich/subscriptions","organizations_url":"https://api.github.com/users/beutlich/orgs","repos_url":"https://api.github.com/users/beutlich/repos","events_url":"https://api.github.com/users/beutlich/events{/privacy}","received_events_url":"https://api.github.com/users/beutlich/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/tbeu/Modelica/milestones/34","html_url":"https://github.com/tbeu/Modelica/milestone/34","labels_url":"https://api.github.com/repos/tbeu/Modelica/milestones/34/labels","id":2209204,"number":34,"title":"Design69","description":"69th Modelica Design Meeting in Oberpfaffenhofen, Germany","creator":{"login":"modelica-trac-importer","id":22202507,"avatar_url":"https://avatars.githubusercontent.com/u/22202507?v=3","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":0,"state":"closed","created_at":"2016-12-21T08:14:16Z","updated_at":"2016-12-21T16:43:07Z","due_on":"2011-01-26T08:00:00Z","closed_at":"2016-12-21T08:14:16Z"},"comments":0,"created_at":"2016-12-21T16:43:07Z","updated_at":"2016-12-21T16:43:07Z","closed_at":null,"body":"**Reported by PHarman on 23 Jan 2011 13:26 UTC**\nIn Modelica.Blocks.Sources.BooleanTable there is an algorithm section containing the following when-clause:\n\n```\n        when time >= pre(nextTime) and n > 0 then\n\t\tif index < n then\n\t\t\tindex := index + 1;\n\t\t\tnextTime := table[index];\n\t\t\ty := not y;\n\t\telseif index == n then\n\t\t\tindex := index + 1;\n\t\t\ty := not y;\n\t\tend if;\n\tend when;\n```\n\nWhilst I can't see any specific part of the specification that says this is illegal, it doesn't help statically checking of the set of algorithms: the statements \"index := index+1\" or \"y := not y\" could have a very different meaning depending on whether there are other algorithms setting \"index\" or \"y\", changing whether the right-hand-side is referring to current or previous values.\n\nFrom the point of view of the modeller it is confusing, in particular the fact that \"index\" is used on the RHS of one algorithm (index := index+1) as the previous value, but used in the RHS of the next (nextTime := table[index]) as the just-calculated value.\n\nIs this example legal? Should it be as follows?:\n\n```\n        when time >= pre(nextTime) and n > 0 then\n\t\tif pre(index) < n then\n\t\t\tindex := pre(index) + 1;\n\t\t\tnextTime := table[index];\n\t\t\ty := not pre(y);\n\t\telseif pre(index) == n then\n\t\t\tindex := pre(index) + 1;\n\t\t\ty := not pre(y);\n\t\tend if;\n\tend when;\n```\n\n\n----\n\nMigrated-From: https://trac.modelica.org/Modelica/ticket/484"}}
{"actor":{"display_login":"modelica-trac-importer"}}