Skip to content

Commit

Permalink
update website
Browse files Browse the repository at this point in the history
  • Loading branch information
mengleiz committed Sep 1, 2023
1 parent 9f27659 commit 150f651
Show file tree
Hide file tree
Showing 18 changed files with 333 additions and 255 deletions.
74 changes: 41 additions & 33 deletions _modules/network_gym_client/adapter.html

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions _modules/network_gym_client/env.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,18 @@ <h1>Source code for network_gym_client.env</h1><div class="highlight"><pre>


<span class="bp">self</span><span class="o">.</span><span class="n">steps_per_episode</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;steps_per_episode&#39;</span><span class="p">])</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">steps_per_episode</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s1">&#39;In crease the &quot;steps_per_episode&quot;, the min value is 2!&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">episodes_per_session</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;episodes_per_session&#39;</span><span class="p">])</span>

<span class="n">step_length</span> <span class="o">=</span> <span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;measurement_interval_ms&#39;</span><span class="p">]</span> <span class="o">+</span> <span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;measurement_guard_interval_ms&#39;</span><span class="p">]</span>
<span class="n">step_length</span> <span class="o">=</span> <span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;measurement_interval_ms&#39;</span><span class="p">]</span>
<span class="k">if</span> <span class="s1">&#39;measurement_guard_interval_ms&#39;</span> <span class="ow">in</span> <span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">]:</span>
<span class="n">step_length</span> <span class="o">=</span> <span class="n">step_length</span> <span class="o">+</span> <span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;measurement_guard_interval_ms&#39;</span><span class="p">]</span>


<span class="c1"># compute the simulation time based on setting</span>
<span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;simulation_time_s&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">((</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;app_and_measurement_start_time_ms&#39;</span><span class="p">]</span> <span class="o">+</span> <span class="n">step_length</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">steps_per_episode</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">episodes_per_session</span><span class="p">)</span><span class="o">/</span><span class="mi">1000</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Environment duration: &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;simulation_time_s&#39;</span><span class="p">])</span> <span class="o">+</span> <span class="s2">&quot;s&quot;</span><span class="p">)</span>
<span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;env_end_time_ms&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;measurement_start_time_ms&#39;</span><span class="p">]</span> <span class="o">+</span> <span class="n">step_length</span> <span class="o">*</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">steps_per_episode</span><span class="p">)</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">episodes_per_session</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Environment duration: &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;env_end_time_ms&#39;</span><span class="p">])</span> <span class="o">+</span> <span class="s2">&quot; ms&quot;</span><span class="p">)</span>
<span class="c1">#Define config params</span>
<span class="n">module_path</span> <span class="o">=</span> <span class="s1">&#39;network_gym_client.envs.&#39;</span><span class="o">+</span><span class="n">config_json</span><span class="p">[</span><span class="s1">&#39;env_config&#39;</span><span class="p">][</span><span class="s1">&#39;env&#39;</span><span class="p">]</span><span class="o">+</span><span class="s1">&#39;.adapter&#39;</span>
<span class="n">module</span> <span class="o">=</span> <span class="n">importlib</span><span class="o">.</span><span class="n">import_module</span><span class="p">(</span><span class="n">module_path</span><span class="p">,</span> <span class="n">package</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
Expand All @@ -352,7 +358,6 @@ <h1>Source code for network_gym_client.env</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">observation_space</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">adapter</span><span class="o">.</span><span class="n">get_observation_space</span><span class="p">()</span>

<span class="bp">self</span><span class="o">.</span><span class="n">northbound_interface_client</span> <span class="o">=</span> <span class="n">NorthBoundClient</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">config_json</span><span class="p">)</span> <span class="c1">#initial northbound_interface_client</span>
<span class="c1">#self.max_counter = int(config_json[&#39;env_config&#39;][&#39;simulation_time_s&#39;] * 1000/config_json[&#39;env_config&#39;][&#39;GMA&#39;][&#39;measurement_interval_ms&#39;])# Already checked the interval for Wi-Fi and LTE in the main file</span>

<span class="c1">#self.link_type = config_json[&#39;rl_config&#39;][&#39;link_type&#39;] </span>
<span class="bp">self</span><span class="o">.</span><span class="n">current_step</span> <span class="o">=</span> <span class="mi">0</span>
Expand Down
Loading

0 comments on commit 150f651

Please sign in to comment.