Intern Simulation in Freelance, before working with the real Controller Hardware
Hi at all!
Currently, I'm writing my Bachelor-thesis and work with ABB Freelance.
I've written a program in CBF for the water and air regulation of a tank, we have in our University. I've written it with the FBD an made a visual graphic, too.
The Hardware we have is Freelance 2000, a non-redudandant CPU rack-system.
Everything is working fine. But there is a problem.
I need to make an intern simulation before working with the real water tank.
It's not that difficult to write a new program and use an emulator instead of the Freelance 2000. But it has to be in one program:
1. start the intern simulation: if everything is alright then
2. start the real controller.
Unfortunately, I have no idea how to use the emulator and the real controller in one program. If someone could give me an advice, I would be really thankful.
in Freelance you can only assign a complete resource from the P-Tree to either the emulator or real hardware. That means the complete application of a single controller either runs on the emulator or in the real hardware.
I see two ways for what you want:
A) Before you start a new program assign the controller resource from the P-Tree to the emulator (that is done in the hardware structure). Then write your code and debug it on the emulator. Finally assign the complete resource back to the real hardware.
B) Make a copy of your project. In one copy assign the resource to the emulator in the other copy assign it to the real hardware. Whenever you do changes or add parts to your application you do that in the emulator copy only. Once it runs there, you do a block export of your changes or additions. The block export is done by selecting the changed parts in the P-Tree and then use the Edit/Export Block menu.
If all changes are exported, close the emulator project and open the real hardware project. Now import the exported changes into your real hardware project.
Hope that helps
the emulator acts as just an other Freelance-station. Add one more process-station to the project tree, add one more emulator to the hardware tree and assign the new process-station to the emulator. Emulators and real hardware working well together.
Now create your simulation program on the emulator-process-station.
For comunication between the simulator program and the real program you can use variables with enabled export.
Variables without export can be read and write only on there host station.
Variables with export can be read everywhere and write on there host station only.
After all, why not doing the simulation program on the real hardware?
"I have a watertankmodel on my workplace. For that I have written a program on CBF that regulates the Water and Airpressure, so the Water reaches e.g. 20cm and stands on that height. The program works fine.
But what I still need to do is:
I have to include a simulation in my program. I want to switch in the Program between the real model an the simulation. For example: Before working with the real Watertank, I want to check my changes with the simulation and if everything is alright, I want to start the same program with the watertank"
In that case you can simulate the watertank model in a different task in the hardware controller. You can use the SEL function (Blocks/Standard/Switches/Binary) to switch all inputs and outputs that you use in your controll application to either the real hardware variables, or the simulation variables. For each variable that connects you to the process you would actually have 3 variables total. The hardware variable would go to the upper input of the function, the simulated variable would go to the lower input of the function and your control program, would use the output of the function. You would need one BINARY (SEL) function for each of your variables that connect to the process and all of those BINARY (SEL) functions would be triggered with the same variable that switches your control application either to the real harware or the simulation.