feat: 添加了正交基模式
This commit is contained in:
@@ -16,7 +16,7 @@ class ModelBasicParametersUnit(BaseModel):
|
||||
range: List[Union[float,int,str,bool]]
|
||||
|
||||
class ModelBasicInfo(BaseModel):
|
||||
base_url = "http://localhost:8105/api/v1"
|
||||
base_url: str = Field(default="http://localhost:8105/api/v1")
|
||||
nports: int = Field(default=2)
|
||||
cell_name: str
|
||||
template_name: str
|
||||
@@ -82,6 +82,7 @@ class ModelBasic:
|
||||
parameters_list.append({parameters_name[i]:res[i] for i in range(len(res))})
|
||||
|
||||
for res in parameters_list:
|
||||
print(f"Simulating with parameters: {res}")
|
||||
request_unit = SimulationRequestUnit(
|
||||
user_id=self.info.user_id,
|
||||
template_name=self.info.template_name,
|
||||
@@ -125,21 +126,26 @@ class ModelBasic:
|
||||
|
||||
simulation_response_model:SimulationResponseUnit = SimulationResponseUnit(**(response[0]))
|
||||
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.05)
|
||||
|
||||
response = send_get_request(f"{self.info.base_url}/simulations/input_hash/{simulation_response_model.input_hash}")
|
||||
|
||||
assert isinstance(response, dict), "Response is not a dictionary."
|
||||
uuid_model = UuidResponseUnit(**response)
|
||||
|
||||
|
||||
time.sleep(0.01) # Wait for 2 seconds before checking the status again
|
||||
time.sleep(0.05) # Wait for 2 seconds before checking the status again
|
||||
|
||||
status = uuid_model.status
|
||||
while status != "completed" and status != "failed":
|
||||
time.sleep(0.01) # Wait for 2 seconds before checking again
|
||||
time.sleep(0.05) # Wait for 2 seconds before checking again
|
||||
response = send_get_request(f"{self.info.base_url}/simulations/input_hash/{simulation_response_model.input_hash}")
|
||||
assert isinstance(response, dict), "Response is not a dictionary."
|
||||
uuid_model = UuidResponseUnit(**response)
|
||||
try:
|
||||
uuid_model = UuidResponseUnit(**response)
|
||||
except Exception as e:
|
||||
print(f"Error parsing response: {e}")
|
||||
continue
|
||||
assert response is not None, "No response received from the server."
|
||||
status = uuid_model.status
|
||||
|
||||
|
||||
45
models/mlin.py
Normal file
45
models/mlin.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from typing import List,Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from schemas.paramer import SimulationRequestUnit
|
||||
from skrf import Network
|
||||
import re
|
||||
from models.basic import ModelBasic, ModelBasicParametersUnit, ModelBasicInfo, ModelBasicDatasetUnit
|
||||
|
||||
W = []
|
||||
L = []
|
||||
i = 15.52
|
||||
while i <= 100:
|
||||
W.append(i)
|
||||
L.append(i)
|
||||
i = int(i*1.05*100 + 0.5) / 100.0
|
||||
|
||||
class Mlin(ModelBasic):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@property
|
||||
def info(self) -> ModelBasicInfo:
|
||||
return ModelBasicInfo(
|
||||
nports=2,
|
||||
cell_name="mlin",
|
||||
template_name="em_interface_compound",
|
||||
user_id=0,
|
||||
template_version=""
|
||||
)
|
||||
|
||||
@property
|
||||
def settings(self) -> dict:
|
||||
return {}
|
||||
|
||||
@property
|
||||
def parameters(self) -> List[ModelBasicParametersUnit]:
|
||||
return [
|
||||
ModelBasicParametersUnit(name="W",type="number",range=W),
|
||||
ModelBasicParametersUnit(name="L",type="number",range=L)
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user