


{"id":363392,"date":"2024-04-22T04:45:47","date_gmt":"2024-04-22T04:45:47","guid":{"rendered":"\/forum\/forums\/topic\/ansys-rocky-prepost\/"},"modified":"2024-04-22T04:45:47","modified_gmt":"2024-04-22T04:45:47","slug":"ansys-rocky-prepost","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/ansys-rocky-prepost\/","title":{"rendered":"ansys rocky prepost"},"content":{"rendered":"<p>I want to do the following:<\/p>\n<p>Through Rocky PrePost, start a simulation for 20 seconds.<br \/>total_time = 20, but pause the simulation every 4 seconds and perform a certain operation.<br \/>stop_time = 4<\/p>\n<p># Describing the study<br \/>study = project.GetStudy()<br \/>study.SetName(&#8216;My Simulation&#8217;)<br \/>study.SetDescription(&#8216;My DEM Simulation&#8217;)<br \/>study.SetCustomerName(&#8216;My Customer&#8217;)<br \/>study.DeleteResults()<\/p>\n<p># Solver.<br \/>solver = study.GetSimulatorRun()<br \/>solver.SetSimulationDuration(total_time, &#8216;s&#8217;)<br \/>solver.SetTimeInterval(0.25, &#8216;s&#8217;)<br \/>solver.SetUseCompressedFiles(True)<br \/>solver.SetSimulationTarget(&#8216;CPU&#8217;)<br \/>solver.SetNumberOfProcessors(20)<\/p>\n<p>study.StartSimulation(skip_summary=False, delete_results=True)<\/p>\n<p>While True:<br \/>&nbsp; &nbsp; current_time_step = GetTimeStep(&#8216;current&#8217;).GetTime()<br \/>&nbsp; &nbsp; if current_time_step % stop_time == 0:<br \/>&nbsp; &nbsp; &nbsp; &nbsp; StopSimulation()<br \/>&nbsp; &nbsp; &nbsp; &nbsp; print(&#8220;stop.&#8221;)<br \/>&nbsp; &nbsp; &nbsp; &nbsp; break<br \/>&nbsp; &nbsp; &nbsp; &nbsp; study.StartSimulation(skip_summary=False, delete_results=False)<\/p>\n<p>I understand that there are many errors here, but the main idea is as follows: there is a simulation &#8211; a total of 20 seconds. Every 4 seconds, it needs to be paused, perform &#8216;block 1&#8217;, and then resume the simulation. Can you advise how to implement this?<\/p>\n","protected":false},"template":"","class_list":["post-363392","topic","type-topic","status-closed","hentry","topic-tag-prepost","topic-tag-python","topic-tag-rocky-dem-1"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":["96.7.218.215"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["274"],"_bbp_topic_status":["unanswered"],"_bbp_subscription":["199"],"_bbp_topic_id":["363392"],"_bbp_forum_id":["27796"],"_bbp_engagement":["199","262268"],"_bbp_voice_count":["2"],"_bbp_reply_count":["4"],"_bbp_last_reply_id":["363498"],"_bbp_last_active_id":["363498"],"_bbp_last_active_time":["2024-04-22 12:26:01"]},"test":"user-deleted"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/363392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/363392\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=363392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}