Home > LIB_SimulationModel > create
LIB_SimulationModel.create() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
创建仿真模型
签名
typescript
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>;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
参数名
参数 | 类型 | 描述 |
|---|---|---|
libraryUuid | string | 库 UUID,可以使用 LIB_LibrariesList 内的接口获取 |
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>
仿真模型 UUID
备注
ADD since EDA v3.2.167
示例
javascript
// 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);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21