Hi
I made a three-phase grid-tied inverter integrated with pv & bess model, and using “from file” block to import solar irradiation and variable load value in 24 seconds, under simulation everything is fine, controller works well.
But in codegen mode, it appears three error as attachment.
It seems like “from file” can not be used in codegen mode, then which method can I adopt to solve those problem, and can be work in codegen mode.
load_value.csv (46.8 KB)
irradiation_value.csv (26.6 KB)
> But in codegen mode, it appears three error as attachment.
I cannot see your model, but our this forum post describing the technique. The difference is that the file is read only at the start of the simulation / code generation process during model initialization. The “DC Microgrid” C2000 model uses a similar technique, but encodes the data as a vector in the model initialization commands.
Note that rather than using the “Clock” block you’ll want to use an integrator with rollover to prevent issues as the time approaches infinity. Again, look in the “DC Microgrid” demo model at the “Time Generator” subsystem in the “DC Power Grid” part of the model.