Home > LIB_SimulationModel > create
LIB_SimulationModel.create() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Create a simulation model
Signature
function create(
libraryUuid: string,
model: { modelType: 'Ngspice' } & (
| {
modelFile: Blob;
modelName?: undefined | string;
modelCategory?: undefined | string;
modelPin?: undefined | string;
}
| {
modelData: string;
modelName?: undefined | string;
modelCategory?: undefined | string;
modelPin?: undefined | string;
}
),
classification?: Array<string>,
description?: string,
): Promise<string | undefined>;2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Parameters
Parameter | Type | Description |
|---|---|---|
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
model | { modelType: 'Ngspice' } & ({ modelFile: Blob; modelName?: undefined | string; modelCategory?: undefined | string; modelPin?: undefined | string } | { modelData: string; modelName?: undefined | string; modelCategory?: undefined | string; modelPin?: undefined | string }) | Simulation model data |
classification | Array<string> | (Optional) Classification |
description | string | (Optional) Description |
Returns
Promise<string | undefined>
Simulation model UUID
Remarks
ADD since EDA v3.2.167
Example
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建 Ngspice 仿真模型(modelData 传 .model 语句文本,分类传 [] = 不分类)
const modelName = `嘉立创示例_新仿真模型_${Date.now()}`;
const simulationModelUuid = await eda.lib_SimulationModel.create(
libraryUuid,
{
modelType: 'Ngspice',
modelData: '* 示例电阻模型\n.model EXAMPLE_RES RES(R=1k)\n',
modelName,
modelPin: '1,2',
},
[],
'示例仿真模型描述'
);
// 创建类保留现场(新仿真模型留在个人库中供观察)
console.log('simulationModelUuid:', simulationModelUuid);
console.log('modelName:', modelName);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21