Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Reinitialization of Discrete State in Explicit Event

Please login with a confirmed email address before reporting spam

Hello, everyone,

I need to use the Explicit Event to change some variable at prescribed times.
However, I find that the variables does not change its values at the current event, but at the next event.

I have attached a file named "Test for Explicit Event" to explain what I mean. The setting of the explicit event is shown in Fig. 1. The initial values for variables a and b are both t and the time range for the simulation is "range(0,1,10)". So, the initial values of a and b are both zero. Moreover, the event starts at t = 1 s with a period of 1 s.

The final results can be seen in Table 1. Clearly, the value of variable a do not change instantly. For example, when t = 1 s, variable a should be 1, but it remains as zero and change to 1 at t = 2 s.

Can anyone help me solve the problem? Thanks in advance.


0 Replies Last Post 3 juin 2017, 03:19 UTC−4
COMSOL Moderator

Hello CHEN

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.