Commit d1e7ca76 by dongshufeng

准备实现前推回代法,还未完成

parent a7c2b118
......@@ -111,10 +111,24 @@
<table>
<th>dev_id</th>
<th>ohm</th>
<th>a_re</th>
<th>a_im</th>
<th>b_re</th>
<th>b_im</th>
<th>c_re</th>
<th>c_im</th>
<th>d_re</th>
<th>d_im</th>
<tr>
<td>UInt64</td>
<td>Utf8</td>
<td>Utf8</td>
<td>Utf8</td>
<td>Utf8</td>
<td>Utf8</td>
<td>Utf8</td>
<td>Utf8</td>
<td>Utf8</td>
</tr>
</table>
......
......@@ -118,5 +118,5 @@ pub unsafe fn run(ptr: i32, len: u32) -> u64 {
let mut bytes = BytesMut::with_capacity(8);
bytes.put_i32(offset);
bytes.put_u32(len);
return bytes.get_u64();
bytes.get_u64()
}
\ No newline at end of file
dy_topo = [];
dev_topo = [];
terminal_cn_dev = [];
tn_input = [];
shunt_meas = [];
// general matrix
gm = [];
\ No newline at end of file
......@@ -61,11 +61,15 @@ pub unsafe fn run(ptr: i32, len: u32) -> u64 {
if let Some((mat_re, mat_im)) = config.get(&s) {
if let Some(f) = length.get_f64() {
let ratio = f / 1000.0;
let (mut v1, _) = (mat_re * ratio).into_raw_vec_and_offset();
let (v2, _) = (mat_im * ratio).into_raw_vec_and_offset();
v1.extend(v2);
let s = get_csv_str(&serde_json::to_string(&v1).unwrap());
csv_str.push_str(&format!("{dev_id},{s}\n"));
let u_re = vec![1., 0., 0., 0., 1., 0., 0., 0., 1.];
let u_im = vec![0., 0., 0., 0., 0., 0., 0., 0., 0.];
let (z_re, _) = (mat_re * ratio).into_raw_vec_and_offset();
let (z_im, _) = (mat_im * ratio).into_raw_vec_and_offset();
let u_re_json = get_csv_str(&serde_json::to_string(&u_re).unwrap());
let u_im_json = get_csv_str(&serde_json::to_string(&u_im).unwrap());
let z_re_json = get_csv_str(&serde_json::to_string(&z_re).unwrap());
let z_im_json = get_csv_str(&serde_json::to_string(&z_im).unwrap());
csv_str.push_str(&format!("{dev_id},{u_re_json},{u_im_json},{z_re_json},{z_im_json},{u_im_json},{u_im_json},{z_re_json},{z_im_json}\n"));
} else {
warn!("Length is not set for acline {}", rsr.name);
continue;
......@@ -84,7 +88,14 @@ pub unsafe fn run(ptr: i32, len: u32) -> u64 {
// build schema
let schema = Schema::new(vec![
Field::new("dev_id", DataType::UInt64, false),
Field::new("ohm", DataType::Utf8, false),
Field::new("a_re", DataType::Utf8, false),
Field::new("a_im", DataType::Utf8, false),
Field::new("b_re", DataType::Utf8, false),
Field::new("b_im", DataType::Utf8, false),
Field::new("c_re", DataType::Utf8, false),
Field::new("c_im", DataType::Utf8, false),
Field::new("d_re", DataType::Utf8, false),
Field::new("d_im", DataType::Utf8, false),
]);
let csv_bytes = vec![("".to_string(), csv_str.into_bytes())];
PluginOutput {
......
......@@ -132,7 +132,7 @@ pub unsafe fn run(ptr: i32, len: u32) -> u64 {
let mut bytes = BytesMut::with_capacity(8);
bytes.put_i32(offset);
bytes.put_u32(len);
return bytes.get_u64();
bytes.get_u64()
}
fn create_static_topo(island: &Island, prop_defs: &[PropDefine], defines: &HashMap<u64, RsrDefine>, csv_bytes: &mut Vec<(String, Vec<u8>)>, schema: &mut Vec<Schema>) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论